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§
- AddHoleFrom Offset 
- 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.
- CameraDrag End 
- Camera drag ended
- CameraDrag Move 
- Camera drag continued.
- CameraDrag Start 
- 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.
- CurveGetControl Points 
- Get control points of the given curve.
- CurveGetEnd Points 
- Find the start and end of a curve.
- CurveGetType 
- Get type of the given curve.
- CurveSetConstraint 
- Get the plane for sketch mode.
- DefaultCamera Center ToScene 
- Updates the camera to center to the center of the current scene’s bounds
- DefaultCamera Center ToSelection 
- Updates the camera to center to the center of the current selection (or the origin if nothing is selected)
- DefaultCamera Focus On 
- Focus the default camera upon an object in the scene.
- DefaultCamera GetSettings 
- Gets the default camera’s camera settings
- DefaultCamera GetView 
- Gets the default camera’s view state
- DefaultCamera Look At 
- Change what the default camera is looking at.
- DefaultCamera Perspective Settings 
- Change what the default camera is looking at.
- DefaultCamera SetOrthographic 
- Use orthographic projection.
- DefaultCamera SetPerspective 
- Use perspective projection.
- DefaultCamera SetView 
- Sets the default camera’s view state
- DefaultCamera Zoom 
- 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.
- EdgeLines Visible 
- 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.
- EnableSketch Mode 
- Sketch on some entity (e.g. a plane, a face).
- EngineUtil Evaluate Path 
- Evaluates the position of a path in one shot (engine utility for kcl executor)
- EntityCircular Pattern 
- 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.
- EntityGetAll Child Uuids 
- What are all UUIDs of this entity’s children?
- EntityGetChild Uuid 
- What is the UUID of this entity’s n-th child?
- EntityGetDistance 
- What is the distance between these two entities?
- EntityGetNum Children 
- How many children does the entity have?
- EntityGetParent Id 
- What is this entity’s parent?
- EntityGetSketch Paths 
- What are all UUIDs of all the paths sketched on top of this entity?
- EntityLinear Pattern 
- Create a linear pattern using this entity.
- EntityLinear Pattern Transform 
- 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.
- EntityMake Helix 
- Create a helix using the input cylinder and other specified parameters.
- EntityMake Helix From Edge 
- Create a helix using the specified parameters.
- EntityMake Helix From Params 
- Create a helix using the specified parameters.
- EntityMirror 
- Mirror the input entities over the specified axis. (Currently only supports sketches)
- EntityMirror Across Edge 
- 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.
- ExtrudeToReference 
- Command for extruding a solid 2d to a reference geometry.
- 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
- GetSketchMode Plane 
- Get the plane for sketch mode.
- HandleMouse Drag End 
- Stop dragging the mouse.
- HandleMouse Drag Move 
- Continue dragging the mouse.
- HandleMouse Drag Start 
- 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
- MakeAxes Gizmo 
- Add a gizmo showing the axes.
- MakeOffset Path 
- 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
- MovePath Pen 
- 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
- ObjectBring ToFront 
- Bring an object to the front of the scene
- ObjectSetMaterial Params Pbr 
- 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.
- PathGetCurve Uuid 
- Obtain curve id by index
- PathGetCurve Uuids ForVertices 
- Obtain curve ids for vertex ids
- PathGetInfo 
- Query the given path.
- PathGetSketch Target Uuid 
- Obtain the sketch target id (if the path was drawn in sketchmode) for a path
- PathGetVertex Uuids 
- Obtain vertex ids for a path
- PlaneIntersect AndProject 
- 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.
- ProjectEntity ToPlane 
- Project an entity on to a plane.
- ProjectPoints ToPlane 
- Project a list of points on to a plane.
- ReconfigureStream 
- Reconfigure the stream.
- RemoveScene Objects 
- Remove scene objects.
- Revolve
- Command for revolving a solid 2d.
- RevolveAbout Edge 
- Command for revolving a solid 2d about a brep edge
- SceneClear All 
- Removes all of the Objects in the scene
- SceneGetEntity Ids 
- Get the ids of a given entity type.
- 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).
- SelectWith Point 
- 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.
- SetCurrentTool Properties 
- Set the properties of the tool lines for the scene.
- SetDefaultSystem Properties 
- Set the default system properties used when a specific property isn’t set.
- SetGridAuto Scale 
- Set the grid lines to auto scale. The grid will get larger the further you zoom out, and smaller the more you zoom in.
- SetGridReference Plane 
- 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.
- SketchMode Disable 
- 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.
- Solid3dCutEdges 
- Cut the list of given edges with the given cut parameters.
- Solid3dFillet Edge 
- Fillets the given edge with the specified radius.
- Solid3dGetAdjacency Info 
- Get a concise description of all of solids edges.
- Solid3dGetAll Edge Faces 
- Gets all faces which use the given edge.
- Solid3dGetAll Opposite Edges 
- Gets all edges which are opposite the given edge, across all possible faces.
- Solid3dGetCommon Edge 
- Gets the shared edge between these two faces if it exists
- Solid3dGetExtrusion Face Info 
- Get a concise description of all of an extrusion’s faces.
- Solid3dGetNext Adjacent Edge 
- Gets the next adjacent edge for the given edge, along the given face.
- Solid3dGetOpposite Edge 
- Gets the edge opposite the given edge, along the given face.
- Solid3dGetPrev Adjacent Edge 
- Gets the previous adjacent edge for the given edge, along the given face.
- Solid3dShell Face 
- 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.