| Primitives | Additive | Subtractive |
|---|---|---|
| box (length, width, height) |
extrude (until) |
cutBlind (until) |
| sphere (radius) |
revolve (angleDegrees) |
cutThruAll () |
| cylinder (height, radius) |
loft (ruled) |
hole (diameter, depth) |
| text (txt, fontsize, distance) |
sweep (path, isFrenet, transitionMode) |
shell (thickness) |
| ^ quickly perform ^ +/- boolean ops with (..., combine="a/s") or use union/cut(shape) |
fillet (radius) |
|
| chamfer (length) |
| rect (xLen, yLen) |
circle (radius) |
ellipse (x_radius, y_radius) |
| center (x, y) |
moveTo (x, y) |
move (xDist, yDist) |
| lineTo (x, y) |
line (xDist, yDist) |
polarLine (distance, angle) |
| vLine (distance) |
hLine (distance) |
polyline (listOfXYTuple) |
| rect (w, h) |
circle (r) |
ellipse (a1, a2) |
| trapezoid (w, h, a1) |
regularPolygon (r, n) |
polygon (pts) |
| fillet (d) |
chamfer (d) |
finalize () |
| importers.importDXF (path, tol) |
importers.importStep ("path") |
| exporters.export (solid, "path/solid.***") |
Where *** can be: svg, step, stl, amf, vrml, json |
| vertex | A single point in space |
| edge | A connection between two or more vertices along a particular path (called a curve) |
| wire | A collection of edges that are connected together |
| face | A set of edges or wires that enclose a surface |
| shell | A collection of faces that are connected together along some of their edges |
| solid | A shell that has a closed interior |
| compound | A collection of solids |
| Mod | Description |
|---|---|
| | | Parallel to = ParallelDirSelector |
| # | Perpendicular to = PerpendicularDirSelector |
| +/- | Pos/Neg direction = DirectionSelector |
| > | Max = DirectionMinMaxSelector(directionMax=True) |
| < | Min = DirectionMinMaxSelector(directionMax=False) |
| % | Curve/surface type = TypeSelector |
Eg: select the top face (> in Z direction) =
.faces(">Z")
|
|
| Selector Methods | Selector Classes |
|---|---|
| faces(selector) | NearestToPointSelector(pnt) |
| edges(selector) | ParallelDirSelector(vector) |
| vertices(selector) | PerpendicularDirSelector(vector) |
| solids(selector) | DirectionMinMaxSelector(vector) |
| shells(selector) | RadiusNthSelector(n) |
| AndSelector(selector, selector) | |
| SumSelector(selector, selector) | |
| SubtractSelector(selector, selector) | |
| InverseSelector(selector) |
| translate (Vector(x, y, z)) |
rotateAboutCenter (Vector(x, y, z), angleDegrees) |
rotate (Vector(x, y, z), Vector(x, y, z), angleDegrees) |
|
Position a workplane relative to an existing feature with:
.workplane(offset, origin) sets the offset perpendicular to the current plane
sets the origin relative to (0,0) on the current plane
|
||
| Name | xDir | yDir | zDir |
|---|---|---|---|
| XY | +x | +y | +z |
| YZ | +y | +z | +x |
| XZ | +x | +z | -y |
| front | +x | +y | +z |
| back | -x | +y | -z |
| left | +z | +y | -x |
| right | -z | +y | +x |
| top | +x | -z | +y |
| bottom | +x | +z | -y |
| Class | Description |
|---|---|
| CQ(obj) | Provides enhanced functionality for a wrapped CAD primitive. |
| Plane(origin, xDir, normal) | A 2d coordinate system in space, with the x-y axes on the a plane, and a particular point as the origin. |
| Workplane(inPlane[origin, obj]) | Defines a coordinate system in space, in which 2D coordinates can be used. |
| Selector | Selector Class | Selects | # Objects Returned |
|---|---|---|---|
| +Z | DirectionSelector | Faces with normal in +z direction | 0 or 1 |
| |Z | ParallelDirSelector | Faces parallel to xy plane | 0..many |
| -X | DirectionSelector | Faces with normal in neg x direction | 0..many |
| #Z | PerpendicularDirSelector | Faces perpendicular to z direction | 0..many |
| %Plane | TypeSelector | Faces of type plane | 0..many |
| >Y | DirectionMinMaxSelector | Face farthest in the positive y dir | 0 or 1 |
| <Y | DirectionMinMaxSelector | Face farthest in the negative y dir | 0 or 1 |
| Selector | Selector Class | Selects | # Objects Returned |
|---|---|---|---|
| +Z | DirectionSelector | Edges aligned in the Z direction | 0..many |
| |Z | ParallelDirSelector | Edges parallel to z direction | 0..many |
| -X | DirectionSelector | Edges aligned in neg x direction | 0..many |
| #Z | PerpendicularDirSelector | Edges perpendicular to z direction | 0..many |
| %Plane | TypeSelector | Edges type line | 0..many |
| >Y | DirectionMinMaxSelector | Edges farthest in the positive y dir | 0 or 1 |
| <Y | DirectionMinMaxSelector | Edges farthest in the negative y dir | 0 or 1 |
| Selector | Selector Class | Selects |
|---|---|---|
| >Y | DirectionMinMaxSelector | Vertices farthest in the +Y dir |
| <Y | DirectionMinMaxSelector | Vertices farthest in the -Y dir |
| >>Y[-2] | CenterNthSelector | 2nd farthest vertex in the +Y dir |
| <<Y[0] | CenterNthSelector | 1st closest vertex in the Y dir |