Crate kittycad_modeling_cmds

Source
Expand description

KittyCAD’s Modeling API lets you design 3D models.

§Beware

This project does not use semver. We are using 0.1.x for everything. If you use this crate, commit your Cargo.lock to avoid being broken when we publish a new version. Why? Because we use this primarily for KittyCAD server and clients, where we are on top of all changes.

Re-exports§

pub use ok_response::output;

Modules§

base64
Base64 data that encodes to url safe base64, but can decode from multiple base64 implementations to account for various clients and libraries. Compatible with serde and JsonSchema.
coord
Various coordinate systems.
datetime
chrono wrapper for datetimes.
each_cmd
Definition of each modeling command.
format
Import and export types.
id
Modeling command IDs, used to associated requests and responses. Also used to construct commands which refer to previous commands.
impl_extern_type
A little macro for easy implementation of cxx::ExternType
length_unit
A length unit is a type that converts a length value from one unit to another. In the case of the engine we will always convert to millimeters, since that is what the engine uses.
ok_response
When a modeling command is successful, these responses could be returned.
session
Controlling the rendering session.
shared
Types that are shared between various modeling commands, like Point3d.
units
Units of measurement.
websocket
Types for the WebSocket API. Types for the websocket server.

Macros§

impl_extern_type
This tells the c++ interop what the native c++ names are from https://docs.rs/cxx/latest/src/cxx/extern_type.rs.html

Structs§

AddHoleFromOffset
Add a hole to a closed path by offsetting it a uniform distance inward.
BooleanIntersection
Create a new solid from intersecting several other solids. In other words, the part of the input solids where they all overlap will be the output solid.
BooleanSubtract
Create a new solid from subtracting several other solids. The ‘target’ is what will be cut from. The ‘tool’ is what will be cut out from ‘target’.
BooleanUnion
Create a new solid from combining other smaller solids. In other words, every part of the input solids will be included in the output solid.
CameraDragEnd
Camera drag ended
CameraDragMove
Camera drag continued.
CameraDragStart
Camera drag started.
CenterOfMass
Get the center of mass of entities in the scene or the default scene.
ClosePath
Closes a path, converting it to a 2D solid.
CurveGetControlPoints
Get control points of the given curve.
CurveGetEndPoints
Find the start and end of a curve.
CurveGetType
Get type of the given curve.
CurveSetConstraint
Get the plane for sketch mode.
DefaultCameraCenterToScene
Updates the camera to center to the center of the current scene’s bounds
DefaultCameraCenterToSelection
Updates the camera to center to the center of the current selection (or the origin if nothing is selected)
DefaultCameraFocusOn
Focus the default camera upon an object in the scene.
DefaultCameraGetSettings
Gets the default camera’s camera settings
DefaultCameraGetView
Gets the default camera’s view state
DefaultCameraLookAt
Change what the default camera is looking at.
DefaultCameraPerspectiveSettings
Change what the default camera is looking at.
DefaultCameraSetOrthographic
Use orthographic projection.
DefaultCameraSetPerspective
Use perspective projection.
DefaultCameraSetView
Sets the default camera’s view state
DefaultCameraZoom
Adjust zoom of the default camera.
Density
Get the density of entities in the scene or the default scene.
DisableDryRun
Sets whether or not changes to the scene or its objects will be done as a “dry run” In a dry run, successful commands won’t actually change the model. This is useful for catching errors before actually making the change.
EdgeLinesVisible
Changes visibility of scene-wide edge lines on brep solids
EnableDryRun
Sets whether or not changes to the scene or its objects will be done as a “dry run” In a dry run, successful commands won’t actually change the model. This is useful for catching errors before actually making the change.
EnableSketchMode
Sketch on some entity (e.g. a plane, a face).
EngineUtilEvaluatePath
Evaluates the position of a path in one shot (engine utility for kcl executor)
EntityCircularPattern
Create a circular pattern using this entity.
EntityClone
Create a pattern using this entity by specifying the transform for each desired repetition. Transformations are performed in the following order (first applied to last applied): scale, rotate, translate.
EntityFade
Fade entity in or out.
EntityGetAllChildUuids
What are all UUIDs of this entity’s children?
EntityGetChildUuid
What is the UUID of this entity’s n-th child?
EntityGetDistance
What is the distance between these two entities?
EntityGetNumChildren
How many children does the entity have?
EntityGetParentId
What is this entity’s parent?
EntityGetSketchPaths
What are all UUIDs of all the paths sketched on top of this entity?
EntityLinearPattern
Create a linear pattern using this entity.
EntityLinearPatternTransform
Create a pattern using this entity by specifying the transform for each desired repetition. Transformations are performed in the following order (first applied to last applied): scale, rotate, translate.
EntityMakeHelix
Create a helix using the input cylinder and other specified parameters.
EntityMakeHelixFromEdge
Create a helix using the specified parameters.
EntityMakeHelixFromParams
Create a helix using the specified parameters.
EntityMirror
Mirror the input entities over the specified axis. (Currently only supports sketches)
EntityMirrorAcrossEdge
Mirror the input entities over the specified edge. (Currently only supports sketches)
EntitySetOpacity
Set opacity of the entity.
Export
Export the scene to a file.
Export2d
Export a sketch to a file.
Export3d
Export the scene to a file.
ExtendPath
Extend a path by adding a new segment which starts at the path’s “pen”. If no “pen” location has been set before (via MovePen), then the pen is at the origin.
Extrude
Command for extruding a solid 2d.
FaceGetCenter
Obtains the surface “center of mass”
FaceGetGradient
Determines the gradient (dFdu, dFdv) + normal vector on a brep face evaluated by parameters u,v
FaceGetPosition
Determines a position on a brep face evaluated by parameters u,v
FaceIsPlanar
Determines whether a brep face is planar and returns its surface-local planar axes if so
GetEntityType
What type of entity is this?
GetNumObjects
Get the number of objects in the scene
GetSketchModePlane
Get the plane for sketch mode.
HandleMouseDragEnd
Stop dragging the mouse.
HandleMouseDragMove
Continue dragging the mouse.
HandleMouseDragStart
Start dragging the mouse.
HighlightSetEntities
Changes the current highlighted entity to these entities.
HighlightSetEntity
Changes the current highlighted entity to whichever one is at the given window coordinate. If there’s no entity at this location, clears the highlight.
ImportFile
File to import into the current model. If you are sending binary data for a file, be sure to send the WebSocketRequest as binary/bson, not text/json.
ImportFiles
Import files to the current model.
Loft
Command for lofting sections to create a solid
MakeAxesGizmo
Add a gizmo showing the axes.
MakeOffsetPath
Make a new path by offsetting an object by a given distance. The new path’s ID will be the ID of this command.
MakePlane
Make a new plane
Mass
Get the mass of entities in the scene or the default scene.
MouseClick
Send a mouse click event Updates modified/selected entities.
MouseMove
Send a mouse move event
MovePathPen
Move the path’s “pen”. If you’re in sketch mode, these coordinates are in the local coordinate system, not the world’s coordinate system. For example, say you’re sketching on the plane {x: (1,0,0), y: (0,1,0), origin: (0, 0, 50)}. In other words, the plane 50 units above the default XY plane. Then, moving the pen to (1, 1, 0) with this command uses local coordinates. So, it would move the pen to (1, 1, 50) in global coordinates.
NewAnnotation
Create a new annotation
ObjectBringToFront
Bring an object to the front of the scene
ObjectSetMaterialParamsPbr
Set the material properties of an object
ObjectVisible
Hide or show an object
OrientToFace
Looks along the normal of the specified face (if it is planar!), and fits the view to it.
PathGetCurveUuid
Obtain curve id by index
PathGetCurveUuidsForVertices
Obtain curve ids for vertex ids
PathGetInfo
Query the given path.
PathGetSketchTargetUuid
Obtain the sketch target id (if the path was drawn in sketchmode) for a path
PathGetVertexUuids
Obtain vertex ids for a path
PlaneIntersectAndProject
Utility method. Performs both a ray cast and projection to plane-local coordinates. Returns the plane coordinates for the given window coordinates.
PlaneSetColor
Set the color of a plane.
ProjectEntityToPlane
Project an entity on to a plane.
ProjectPointsToPlane
Project a list of points on to a plane.
ReconfigureStream
Reconfigure the stream.
RemoveSceneObjects
Remove scene objects.
Revolve
Command for revolving a solid 2d.
RevolveAboutEdge
Command for revolving a solid 2d about a brep edge
SceneClearAll
Removes all of the Objects in the scene
SelectAdd
Adds one or more entities (by UUID) to the selection.
SelectClear
Clear the selection
SelectGet
Find all IDs of selected entities
SelectRemove
Removes one or more entities (by UUID) from the selection.
SelectReplace
Replaces current selection with these entities (by UUID).
SelectWithPoint
Modifies the selection by simulating a “mouse click” at the given x,y window coordinate Returns ID of whatever was selected.
SendObject
Send object to front or back.
SetBackgroundColor
Set the background color of the scene.
SetCurrentToolProperties
Set the properties of the tool lines for the scene.
SetDefaultSystemProperties
Set the default system properties used when a specific property isn’t set.
SetGridAutoScale
Set the grid lines to auto scale. The grid will get larger the further you zoom out, and smaller the more you zoom in.
SetGridReferencePlane
Align the grid with a plane or a planar face.
SetGridScale
Set the scale of the grid lines in the video feed.
SetObjectTransform
Set the transform of an object.
SetSceneUnits
Set the units of the scene. For all following commands, the units will be interpreted as the given units. Any previously executed commands will not be affected or have their units changed. They will remain in the units they were originally executed in.
SetSelectionFilter
What kind of entities can be selected?
SetSelectionType
When you select some entity with the current tool, what should happen to the entity?
SetTool
Set the current tool.
SketchModeDisable
Disable sketch mode. If you are sketching on a face, be sure to not disable sketch mode until you have extruded. Otherwise, your object will not be fused with the face.
Solid2dAddHole
Add a hole to a Solid2d object before extruding it.
Solid3dFilletEdge
Fillets the given edge with the specified radius.
Solid3dGetAdjacencyInfo
Get a concise description of all of solids edges.
Solid3dGetAllEdgeFaces
Gets all faces which use the given edge.
Solid3dGetAllOppositeEdges
Gets all edges which are opposite the given edge, across all possible faces.
Solid3dGetCommonEdge
Gets the shared edge between these two faces if it exists
Solid3dGetExtrusionFaceInfo
Get a concise description of all of an extrusion’s faces.
Solid3dGetNextAdjacentEdge
Gets the next adjacent edge for the given edge, along the given face.
Solid3dGetOppositeEdge
Gets the edge opposite the given edge, along the given face.
Solid3dGetPrevAdjacentEdge
Gets the previous adjacent edge for the given edge, along the given face.
Solid3dShellFace
Command for shelling a solid3d face
StartPath
Start a new path.
SurfaceArea
Get the surface area of entities in the scene or the default scene.
Sweep
Extrude the object along a path.
TakeSnapshot
Take a snapshot of the current view.
TwistExtrude
Command for twist extruding a solid 2d.
UpdateAnnotation
Update an annotation
ViewIsometric
Fit the view to the scene with an isometric view.
Volume
Get the volume of entities in the scene or the default scene.
ZoomToFit
Fit the view to the specified object(s).

Enums§

ImageFormat
Enum containing the variety of image formats snapshots may be exported to.
ModelingCmd
Commands that the KittyCAD engine can execute.
ModelingCmdEndpoint
Each modeling command (no parameters or fields).

Traits§

ModelingCmdOutput
Anything that can be a ModelingCmd output.
ModelingCmdVariant
Some modeling command executed on the KittyCAD engine.