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§
- AddHole
From Offset - Add a hole to a closed path by offsetting it a uniform distance inward.
- Boolean
Intersection - 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.
- Boolean
Subtract - 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’.
- Boolean
Union - 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.
- Camera
Drag End - Camera drag ended
- Camera
Drag Move - Camera drag continued.
- Camera
Drag Start - Camera drag started.
- Center
OfMass - Get the center of mass of entities in the scene or the default scene.
- Close
Path - Closes a path, converting it to a 2D solid.
- Curve
GetControl Points - Get control points of the given curve.
- Curve
GetEnd Points - Find the start and end of a curve.
- Curve
GetType - Get type of the given curve.
- Curve
SetConstraint - Get the plane for sketch mode.
- Default
Camera Center ToScene - Updates the camera to center to the center of the current scene’s bounds
- Default
Camera Center ToSelection - Updates the camera to center to the center of the current selection (or the origin if nothing is selected)
- Default
Camera Focus On - Focus the default camera upon an object in the scene.
- Default
Camera GetSettings - Gets the default camera’s camera settings
- Default
Camera GetView - Gets the default camera’s view state
- Default
Camera Look At - Change what the default camera is looking at.
- Default
Camera Perspective Settings - Change what the default camera is looking at.
- Default
Camera SetOrthographic - Use orthographic projection.
- Default
Camera SetPerspective - Use perspective projection.
- Default
Camera SetView - Sets the default camera’s view state
- Default
Camera Zoom - Adjust zoom of the default camera.
- Density
- Get the density of entities in the scene or the default scene.
- Disable
DryRun - 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.
- Edge
Lines Visible - Changes visibility of scene-wide edge lines on brep solids
- Enable
DryRun - 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.
- Enable
Sketch Mode - Sketch on some entity (e.g. a plane, a face).
- Engine
Util Evaluate Path - Evaluates the position of a path in one shot (engine utility for kcl executor)
- Entity
Circular Pattern - Create a circular pattern using this entity.
- Entity
Clone - 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.
- Entity
Fade - Fade entity in or out.
- Entity
GetAll Child Uuids - What are all UUIDs of this entity’s children?
- Entity
GetChild Uuid - What is the UUID of this entity’s n-th child?
- Entity
GetDistance - What is the distance between these two entities?
- Entity
GetNum Children - How many children does the entity have?
- Entity
GetParent Id - What is this entity’s parent?
- Entity
GetSketch Paths - What are all UUIDs of all the paths sketched on top of this entity?
- Entity
Linear Pattern - Create a linear pattern using this entity.
- Entity
Linear 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.
- Entity
Make Helix - Create a helix using the input cylinder and other specified parameters.
- Entity
Make Helix From Edge - Create a helix using the specified parameters.
- Entity
Make Helix From Params - Create a helix using the specified parameters.
- Entity
Mirror - Mirror the input entities over the specified axis. (Currently only supports sketches)
- Entity
Mirror Across Edge - Mirror the input entities over the specified edge. (Currently only supports sketches)
- Entity
SetOpacity - 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.
- Extend
Path - 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.
- Face
GetCenter - Obtains the surface “center of mass”
- Face
GetGradient - Determines the gradient (dFdu, dFdv) + normal vector on a brep face evaluated by parameters u,v
- Face
GetPosition - Determines a position on a brep face evaluated by parameters u,v
- Face
IsPlanar - Determines whether a brep face is planar and returns its surface-local planar axes if so
- GetEntity
Type - What type of entity is this?
- GetNum
Objects - Get the number of objects in the scene
- GetSketch
Mode Plane - Get the plane for sketch mode.
- Handle
Mouse Drag End - Stop dragging the mouse.
- Handle
Mouse Drag Move - Continue dragging the mouse.
- Handle
Mouse Drag Start - Start dragging the mouse.
- Highlight
SetEntities - Changes the current highlighted entity to these entities.
- Highlight
SetEntity - 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.
- Import
File - 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.
- Import
Files - Import files to the current model.
- Loft
- Command for lofting sections to create a solid
- Make
Axes Gizmo - Add a gizmo showing the axes.
- Make
Offset 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.
- Make
Plane - Make a new plane
- Mass
- Get the mass of entities in the scene or the default scene.
- Mouse
Click - Send a mouse click event Updates modified/selected entities.
- Mouse
Move - Send a mouse move event
- Move
Path 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
- Object
Bring ToFront - Bring an object to the front of the scene
- Object
SetMaterial Params Pbr - Set the material properties of an object
- Object
Visible - Hide or show an object
- Orient
ToFace - Looks along the normal of the specified face (if it is planar!), and fits the view to it.
- Path
GetCurve Uuid - Obtain curve id by index
- Path
GetCurve Uuids ForVertices - Obtain curve ids for vertex ids
- Path
GetInfo - Query the given path.
- Path
GetSketch Target Uuid - Obtain the sketch target id (if the path was drawn in sketchmode) for a path
- Path
GetVertex Uuids - Obtain vertex ids for a path
- Plane
Intersect AndProject - Utility method. Performs both a ray cast and projection to plane-local coordinates. Returns the plane coordinates for the given window coordinates.
- Plane
SetColor - Set the color of a plane.
- Project
Entity ToPlane - Project an entity on to a plane.
- Project
Points ToPlane - Project a list of points on to a plane.
- Reconfigure
Stream - Reconfigure the stream.
- Remove
Scene Objects - Remove scene objects.
- Revolve
- Command for revolving a solid 2d.
- Revolve
About Edge - Command for revolving a solid 2d about a brep edge
- Scene
Clear All - Removes all of the Objects in the scene
- Select
Add - Adds one or more entities (by UUID) to the selection.
- Select
Clear - Clear the selection
- Select
Get - Find all IDs of selected entities
- Select
Remove - Removes one or more entities (by UUID) from the selection.
- Select
Replace - Replaces current selection with these entities (by UUID).
- Select
With Point - Modifies the selection by simulating a “mouse click” at the given x,y window coordinate Returns ID of whatever was selected.
- Send
Object - Send object to front or back.
- SetBackground
Color - Set the background color of the scene.
- SetCurrent
Tool Properties - Set the properties of the tool lines for the scene.
- SetDefault
System Properties - Set the default system properties used when a specific property isn’t set.
- SetGrid
Auto 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.
- SetGrid
Reference Plane - Align the grid with a plane or a planar face.
- SetGrid
Scale - Set the scale of the grid lines in the video feed.
- SetObject
Transform - Set the transform of an object.
- SetScene
Units - 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.
- SetSelection
Filter - What kind of entities can be selected?
- SetSelection
Type - When you select some entity with the current tool, what should happen to the entity?
- SetTool
- Set the current tool.
- Sketch
Mode 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.
- Solid2d
AddHole - Add a hole to a Solid2d object before extruding it.
- Solid3d
Fillet Edge - Fillets the given edge with the specified radius.
- Solid3d
GetAdjacency Info - Get a concise description of all of solids edges.
- Solid3d
GetAll Edge Faces - Gets all faces which use the given edge.
- Solid3d
GetAll Opposite Edges - Gets all edges which are opposite the given edge, across all possible faces.
- Solid3d
GetCommon Edge - Gets the shared edge between these two faces if it exists
- Solid3d
GetExtrusion Face Info - Get a concise description of all of an extrusion’s faces.
- Solid3d
GetNext Adjacent Edge - Gets the next adjacent edge for the given edge, along the given face.
- Solid3d
GetOpposite Edge - Gets the edge opposite the given edge, along the given face.
- Solid3d
GetPrev Adjacent Edge - Gets the previous adjacent edge for the given edge, along the given face.
- Solid3d
Shell Face - Command for shelling a solid3d face
- Start
Path - Start a new path.
- Surface
Area - Get the surface area of entities in the scene or the default scene.
- Sweep
- Extrude the object along a path.
- Take
Snapshot - Take a snapshot of the current view.
- Twist
Extrude - Command for twist extruding a solid 2d.
- Update
Annotation - Update an annotation
- View
Isometric - Fit the view to the scene with an isometric view.
- Volume
- Get the volume of entities in the scene or the default scene.
- Zoom
ToFit - Fit the view to the specified object(s).
Enums§
- Image
Format - Enum containing the variety of image formats snapshots may be exported to.
- Modeling
Cmd - Commands that the KittyCAD engine can execute.
- Modeling
CmdEndpoint - Each modeling command (no parameters or fields).
Traits§
- Modeling
CmdOutput - Anything that can be a ModelingCmd output.
- Modeling
CmdVariant - Some modeling command executed on the KittyCAD engine.