KEMBAR78
CadQuery Cheat Sheet | PDF | Geometric Shapes | Elementary Geometry
100% found this document useful (1 vote)
846 views2 pages

CadQuery Cheat Sheet

This document provides a quick guide to commonly used functions in the CQ-Editor 3D modeling software. It summarizes functions for 3D and 2D construction, import/export, assemblies, selectors, workplane positioning, and examples of filtering faces and edges.

Uploaded by

Anthony Vo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
846 views2 pages

CadQuery Cheat Sheet

This document provides a quick guide to commonly used functions in the CQ-Editor 3D modeling software. It summarizes functions for 3D and 2D construction, import/export, assemblies, selectors, workplane positioning, and examples of filtering faces and edges.

Uploaded by

Anthony Vo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Cheatsheet

A Quick Guide To The Most Commonly Used Functions!


Full API reference | Examples | Install CQ-Editor | Mode

3D Construction 2D Construction
Primitives Additive Subtractive rect circle ellipse
(x_radius,
box extrude cutBlind
(xLen, yLen) (radius)
y_radius)
(length, width,
(until) (until)
height) center moveTo move
(x, y) (x, y) (xDist, yDist)
sphere revolve cutThruAll
(radius) (angleDegrees) () lineTo line polarLine
(x, y) (xDist, yDist) (distance, angle)
cylinder loft hole
(height, radius) (ruled)
(diameter, vLine hLine polyline
depth) (distance) (distance) (listOfXYTuple)

text sweep shell Sketching


(txt, fontsize, (path, isFrenet,
(thickness)
distance) transitionMode) rect circle ellipse
(w, h) (r) (a1, a2)
^ quickly perform ^ fillet
+/- boolean ops with (radius) trapezoid regularPolygon polygon
(..., combine="a/s") (w, h, a1) (r, n) (pts)
or use chamfer
union/cut(shape) (length) fillet chamfer finalize
(d) (d) ()

Import/Export Selector String Modifiers


importers.importDXF importers.importStep Axis Strings are: X, Y, Z, XY, YZ, XZ
(path, tol) ("path")
Mod Description
exporters.export Where *** can be: svg, step,
(solid, "path/solid.***") stl, amf, vrml, json | Parallel to = ParallelDirSelector
# Perpendicular to = PerpendicularDirSelector
+/- Pos/Neg direction = DirectionSelector
Assemblies > Max =
Assembly add DirectionMinMaxSelector(directionMax=True)
() (obj, loc, color)
< Min =
constrain solve DirectionMinMaxSelector(directionMax=False)
(***) () % Curve/surface type = TypeSelector
save Where *** can be: Eg: select the top face (> in Z direction) = .faces(">Z")
step, xml, gltf,
("path/assembly.***")
vtkjs, vrml

Selector Methods Workplane Positioning


CadQuery selector strings and classes allow filtering to select objects. rotate
translate rotateAboutCenter (Vector(x, y,
Selector Methods Selector Classes (Vector(x, y, (Vector(x, y, z), z), Vector(x,
z)) angleDegrees) y, z),
faces(selector) NearestToPointSelector(pnt) angleDegrees)
edges(selector) ParallelDirSelector(vector) Position a workplane relative to an existing feature with:
vertices(selector) PerpendicularDirSelector(vector) .workplane(offset, origin)
sets the offset perpendicular to the current plane
solids(selector) DirectionMinMaxSelector(vector) sets the origin relative to (0,0) on the current plane
shells(selector) RadiusNthSelector(n)
AndSelector(selector, selector)
SumSelector(selector, selector)
SubtractSelector(selector, selector)
InverseSelector(selector)

Named Planes
Direction references refer to the global directions.
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
Examples of Filtering Faces
All types of filters work on faces. In most cases, the selector refers to the direction of the
normal vector of the face. If a face is not planar, selectors are evaluated at the center of mass
of the face. This can lead to results that are quite unexpected.
# Objects
Selector Selector Class Selects
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 0..many
direction
#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

Examples of Filtering Edges


Some filter types are not supported for edges. The selector usually refers to the direction of
the edge. Non-linear edges are not selected for any selectors except type (%). Non-linear
edges are never returned when these filters are applied.
# Objects
Selector Selector Class Selects
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 0 or 1
dir

Examples of Filtering Vertices


Only a few of the filter types apply to vertices. The location of the vertex is the subject of the
filter.
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

You might also like