From f265e66c7b0a68799bf4d8ea45e014c562caf436 Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Wed, 27 Jul 2022 22:05:43 -0400 Subject: [PATCH 01/17] Working on new and improved cheatsheet! --- doc/_static/cadquery_cheatsheet.html | 203 +++++++++++++++++---------- 1 file changed, 128 insertions(+), 75 deletions(-) diff --git a/doc/_static/cadquery_cheatsheet.html b/doc/_static/cadquery_cheatsheet.html index 57bcaefc8..a70217736 100644 --- a/doc/_static/cadquery_cheatsheet.html +++ b/doc/_static/cadquery_cheatsheet.html @@ -9,10 +9,20 @@ margin: 0.5em; padding: 0px 0.5em 0.5em; background-color: #EBEBEB; + min-width: 300px; + max-width: 30vw; + } + { + + } + h2 a, h2 a:visited, .section a,.section a:visited { + color: #1f4b8f; + font-weight: bold; + text-decoration: none; + } .column { float: left; - width: 375px; } tr { background-color: #FFFFFF; @@ -26,9 +36,15 @@ } - -
-
+ +
+

Cheatsheet

+ A Quick Guide To The Most Commonly Used Functions! +
+ For the full API ref click here!
+
+
+
+

3D Construction

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
PrimitivesAdditiveSubtractive
Workplane.box
(length, width, height)
Workplane.extrude
(until)
Workplane.cut
(toCut)
Workplane.sphere
(radius)
Workplane.sweep
(path)
Workplane.cutThruAll
(until)
Workplane.sphere
(height, radius)
Workplane.loft
(ruled, combine, clean)
Workplane.hole
(diameter, depth)
Workplane.text
(txt, fontsize, distance)
Workplane.revolve
(angleDegrees)
Workplane.intersect
(toIntersect)
+
+
+

2D Construction

+ + + + + + + + + + + + + + + + + + + + + +
Workplane.rect
(xLen, yLen)
Workplane.circle
(radius)
Workplane.ellipse
(x_radius, y_radius)
Workplane.center
(x, y)
Workplane.moveTo
(x, y)
Workplane.move
(xDist, yDist)
Workplane.lineTo
(x, y)
Workplane.line
(xDist, yDist)
Workplane.polarLine
(distance, angle)
Workplane.vLine
(distance)
Workplane.hLine
(distance)
Workplane.polyline
(listOfXYTuple)
+
+ + -
+ -
-
-
-

Selector Methods


- CadQuery selector strings allow filtering various types of object lists. - Most commonly, Edges, Faces, and Vertices are used, but all objects types can be filtered.
- - - - - - - - - - - - - - - - - - - - - - - - -
Selector MethodDescription
CQ.faces(selector=None)Select the faces of objects on the stack, optionally filtering the selection.
CQ.edges(selector=None)Select the edges of objects on the stack, optionally filtering the selection.
CQ.vertices(selector=None)Select the vertices of objects on the stack, optionally filtering the selection.
CQ.solids(selector=None)Select the solids of objects on the stack, optionally filtering the selection.
CQ.shells(selector=None)Select the shells of objects on the stack, optionally filtering the selection.
-
-
-

Selector Classes


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ClassDescription
NearestToPointSelector(pnt)Selects object nearest the provided point.
ParallelDirSelector(vector[tolerance])Selects objects parallel with the provided direction.
DirectionSelector(vector[tolerance])Selects objects aligned with the provided direction.
PerpendicularDirSelector(vector[tolerance])Selects objects perpendicular with the provided direction.
TypeSelector(typeString)Selects objects of the prescribed topological type.
DirectionMinMaxSelector(vector[directionMax])Selects objects closest or farthest in the specified direction.
StringSyntaxSelector(selectorString)Filter lists objects using a simple string syntax.
-

Selector String Modifiers


Selectors are a complex topic: see CadQuery String Selectors for more information.
@@ -265,6 +287,37 @@

Selector String Modifiers


+
+

Selector Methods


+ CadQuery selector strings allow filtering various types of object lists. + Most commonly, Edges, Faces, and Vertices are used, but all objects types can be filtered.
+ + + + + + + + + + + + + + + + + + + + + + + + +
Selector MethodsSelector Classes +
CQ.faces(selector)NearestToPointSelector(pnt)
CQ.edges(selector)ParallelDirSelector(vector)
CQ.vertices(selector)DirectionSelector(vector)
CQ.solids(selector)DirectionMinMaxSelector(vector)
CQ.shells(selector)TypeSelector(typeString)
+

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. From 23e4c5985b01481240abffe9092219fc05b3a63b Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Wed, 27 Jul 2022 22:41:05 -0400 Subject: [PATCH 02/17] Rearranging and styling --- doc/_static/cadquery_cheatsheet.html | 199 ++++++++++++++------------- 1 file changed, 106 insertions(+), 93 deletions(-) diff --git a/doc/_static/cadquery_cheatsheet.html b/doc/_static/cadquery_cheatsheet.html index a70217736..577f24ba7 100644 --- a/doc/_static/cadquery_cheatsheet.html +++ b/doc/_static/cadquery_cheatsheet.html @@ -3,6 +3,7 @@ CadQuery Cheatsheet + - -
-

Cheatsheet

- A Quick Guide To The Most Commonly Used Functions! -
- For the full API ref click here!
+ + -
- +

3D Construction

- +
- - - + + + + + @@ -68,7 +79,7 @@

Workplane.cut
(toCut)

- + @@ -86,7 +97,7 @@

2D Construction

-

PrimitivesAdditiveSubtractive
PrimitivesAdditiveSubtractive
Workplane.box
(length, width, height)
Workplane.sphere
(radius)
Workplane.sphere
(radius)
Workplane.sweep
(path)
Workplane.cutThruAll
(until)
+
@@ -103,7 +114,7 @@

Workplane.polarLine
(distance, angle)

- + @@ -111,7 +122,7 @@

Sketching

-

Workplane.rect
(xLen, yLen)
Workplane.circle
(radius)
Workplane.vLine
(distance)
Workplane.vLine
(distance)
Workplane.hLine
(distance)
Workplane.polyline
(listOfXYTuple)
+
@@ -131,7 +142,7 @@

Sketch.rect
(w, h)
Sketch.circle
(r)
CadQuery String Selectors for more information.
Axis Strings are: X, Y, Z, XY, YZ, XZ
-
vertex A single point in space
+
@@ -204,7 +215,7 @@

Selector String Modifiers


Selector Methods


CadQuery selector strings and classes allow filtering to select objects.
-
Modifier Description
+
+ + + + +
Selector Methods Selector Classes @@ -234,7 +245,7 @@

Selector Methods


Named Planes


Direction references refer to the global directions.
- +
@@ -300,7 +311,7 @@

Named Planes


Name xDir
+
@@ -326,7 +337,7 @@

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. -
Class Description
+
@@ -383,7 +394,7 @@

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. -
Selector Selector Class
+
@@ -437,7 +448,7 @@

Examples of Filtering Edges


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
+
From 66f83ca7fdad8d5303ba96c581c57c16bacb96ff Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Wed, 27 Jul 2022 23:07:42 -0400 Subject: [PATCH 04/17] Adding links for reference materials to "Getting Started" in README --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index b6b052d9f..5c890873e 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,7 @@ The original version of CadQuery was built on the FreeCAD API. This was great be ## Getting started -To quickly play around with CadQuery and see it's capabilities, see the [CQ-editor GUI](https://github.com/CadQuery/CQ-editor) manual. -If you want to use CadQuery for your own project, keep reading: +To learn more about designing with CadQuery, visit the [documentation](https://cadquery.readthedocs.io/en/latest/intro.html), [examples](https://cadquery.readthedocs.io/en/latest/examples.html), and [cheatsheet](https://cadquery.readthedocs.io/en/latest/_static/cadquery_cheatsheet.html). It is currently possible to use CadQuery for your own projects in 3 different ways: * Using the [CQ-editor GUI](https://github.com/CadQuery/CQ-editor) From 2d861a88da1d711ef64ddabfe6b432c7efca82a3 Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Wed, 27 Jul 2022 23:08:32 -0400 Subject: [PATCH 05/17] Changing wording to make things a bit clearer. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c890873e..f0199546b 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,8 @@ The original version of CadQuery was built on the FreeCAD API. This was great be To learn more about designing with CadQuery, visit the [documentation](https://cadquery.readthedocs.io/en/latest/intro.html), [examples](https://cadquery.readthedocs.io/en/latest/examples.html), and [cheatsheet](https://cadquery.readthedocs.io/en/latest/_static/cadquery_cheatsheet.html). -It is currently possible to use CadQuery for your own projects in 3 different ways: +To get started playing around with CadQuery and see it's capabilities, take a look at the [CQ-editor GUI](https://github.com/CadQuery/CQ-editor). This easy-to-use IDE is a great way to get started desiging with CadQuery. + * Using the [CQ-editor GUI](https://github.com/CadQuery/CQ-editor) * From a [Jupyter notebook](https://github.com/bernhard-42/jupyter-cadquery) * As a standalone library From bc47c8bc9ae7b76bb784ec7e020475891bca3aaf Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Wed, 27 Jul 2022 23:08:49 -0400 Subject: [PATCH 06/17] Changing wording, adding VSCode extension --- README.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f0199546b..75a18c9c1 100644 --- a/README.md +++ b/README.md @@ -38,13 +38,27 @@ To learn more about designing with CadQuery, visit the [documentation](https://c To get started playing around with CadQuery and see it's capabilities, take a look at the [CQ-editor GUI](https://github.com/CadQuery/CQ-editor). This easy-to-use IDE is a great way to get started desiging with CadQuery. +There are currently 4 different ways to use CadQuery for designing your next project: * Using the [CQ-editor GUI](https://github.com/CadQuery/CQ-editor) * From a [Jupyter notebook](https://github.com/bernhard-42/jupyter-cadquery) +* Using a [VSCode extension](https://marketplace.visualstudio.com/items?itemName=roipoussiere.cadquery) * As a standalone library * Linux [installation video](https://youtu.be/sjLTePOq8bQ) * Windows [installation video](https://youtu.be/3Tg_RJhqZRg) -There are two ways to install CadQuery and its dependencies. One is using conda, and the other is using pip. Pip is shown first below, followed by two sections on installing CadQuery via conda, and a non-intrusive way to install conda on a system. +There are two ways to install the CadQuery library and its dependencies. One is using conda, and the other is using pip. Pip is shown first below, followed by two sections on installing CadQuery via conda, and a non-intrusive way to install conda on a system. + +### CQ-editor GUI + +CQ-editor is an IDE that allows users to edit CadQuery model scripts in a GUI environment. It includes features such as: + +* A graphical debugger that allows you to step through your scripts. +* A CadQuery stack inspector. +* Export to various formats, including STEP and STL, directly from the menu. + +The installation instructions for CQ-editor can be found [here](https://github.com/CadQuery/CQ-editor#installation). + +CQ editor screenshot ### CadQuery Installation Via Pip @@ -115,18 +129,6 @@ cmd /K ""%USERPROFILE%/Miniforge3/Scripts/activate.bat" "%USERPROFILE%/Miniforge ``` You might want to consider using `/NoScripts=0` to have an activation shortcut added to the start menu. -### CQ-editor GUI - -CQ-editor is an IDE that allows users to edit CadQuery model scripts in a GUI environment. It includes features such as: - -* A graphical debugger that allows you to step through your scripts. -* A CadQuery stack inspector. -* Export to various formats, including STEP and STL, directly from the menu. - -The installation instructions for CQ-editor can be found [here](https://github.com/CadQuery/CQ-editor#installation). - -CQ editor screenshot - ### Jupyter CadQuery supports Jupyter notebook out of the box using the jupyter-cadquery extension created by @bernhard-42: From d6f52ee9b6afce6d0c86b1e960d58ef9623c6406 Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Thu, 28 Jul 2022 21:00:54 -0400 Subject: [PATCH 07/17] Adding import/export and assembly funcs --- doc/_static/cadquery_cheatsheet.html | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/doc/_static/cadquery_cheatsheet.html b/doc/_static/cadquery_cheatsheet.html index 870f2d93f..b2f7df55f 100644 --- a/doc/_static/cadquery_cheatsheet.html +++ b/doc/_static/cadquery_cheatsheet.html @@ -140,6 +140,38 @@

+

Selector Selector Class
+ + + + + + + + +
importers.importDXF
(path, tol)
importers.importStep
("path")
exporters.export
(solid, "path/solid.***")
Where *** can be: svg, step, stl, amf, vrml, json
+
+
+

Assemblies

+ + + + + + + + + + + + + +
Assembly(
(obj)
Assembly.add
(obj)
Assembly.constrain
(***)
Assembly.solve
()
Assembly.save
("path/assembly.***")
Where *** can be: step, xml, gltf, vtkjs, vrml
+
+
Workplane.union
(angleDegrees)

2D Construction

@@ -119,8 +125,6 @@

Workplane.polyline
(listOfXYTuple) -

-

Sketching

@@ -206,9 +210,9 @@

BREP Terminology


-

Selector String Modifiers


-
See CadQuery String Selectors for more information.
- Axis Strings are: X, Y, Z, XY, YZ, XZ
+

Selector String Modifiers

+


+
Axis Strings are: X, Y, Z, XY, YZ, XZ
From efb24ce08fbbda7c492cb3f34dc0ab5f2c2be596 Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Thu, 28 Jul 2022 22:44:54 -0400 Subject: [PATCH 09/17] Fix cut cmds --- doc/_static/cadquery_cheatsheet.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/_static/cadquery_cheatsheet.html b/doc/_static/cadquery_cheatsheet.html index 17f0ff424..4cbb6edb5 100644 --- a/doc/_static/cadquery_cheatsheet.html +++ b/doc/_static/cadquery_cheatsheet.html @@ -82,22 +82,22 @@

Workplane.sphere
(radius)

- + - + - + - +
ModifierWorkplane.sweep
(path)
Workplane.cutThruAll
(until)
Workplane.cutThruAll
()
Workplane.sphere
(height, radius)
Workplane.loft
(ruled, combine, clean)
Workplane.hole
(diameter, depth)
Workplane.cutBlind
(until)
Workplane.text
(txt, fontsize, distance)
Workplane.revolve
(angleDegrees)
Workplane.intersect
(toIntersect)
Workplane.hole
(diameter, depth)
Workplane.union
(angleDegrees)
Workplane.intersect
(toIntersect)
From 54845a44552c4193fd0f5bfcbb6c357474838923 Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Thu, 28 Jul 2022 22:57:57 -0400 Subject: [PATCH 10/17] Typo --- doc/_static/cadquery_cheatsheet.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/_static/cadquery_cheatsheet.html b/doc/_static/cadquery_cheatsheet.html index 4cbb6edb5..d32c6a587 100644 --- a/doc/_static/cadquery_cheatsheet.html +++ b/doc/_static/cadquery_cheatsheet.html @@ -85,7 +85,7 @@

Workplane.cutThruAll
() - Workplane.sphere
(height, radius) + Workplane.cylinder
(height, radius) Workplane.loft
(ruled, combine, clean) Workplane.cutBlind
(until) From c75917a4d47c72601c8cf40e2aeef5d4b23dd3a4 Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Thu, 28 Jul 2022 23:39:37 -0400 Subject: [PATCH 11/17] Command change --- doc/_static/cadquery_cheatsheet.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/_static/cadquery_cheatsheet.html b/doc/_static/cadquery_cheatsheet.html index d32c6a587..61ace0c1c 100644 --- a/doc/_static/cadquery_cheatsheet.html +++ b/doc/_static/cadquery_cheatsheet.html @@ -140,7 +140,7 @@

Sketch.fillet
(d) Sketch.chamfer
(d) - Sketch.clean
() + Sketch.finalize
()

From b88a2078427b07b6d4f34454499ea377a0276a4b Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Thu, 28 Jul 2022 23:46:49 -0400 Subject: [PATCH 12/17] Fixed mobile table sizing! Should work on most devices now. --- doc/_static/cadquery_cheatsheet.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/_static/cadquery_cheatsheet.html b/doc/_static/cadquery_cheatsheet.html index 61ace0c1c..a265fe8ab 100644 --- a/doc/_static/cadquery_cheatsheet.html +++ b/doc/_static/cadquery_cheatsheet.html @@ -7,6 +7,7 @@ From 243c591166398f817bcb9cdf76589cc9541d7f0f Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Thu, 28 Jul 2022 23:59:22 -0400 Subject: [PATCH 13/17] Cleaning up mobile usability/readability --- doc/_static/cadquery_cheatsheet.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/_static/cadquery_cheatsheet.html b/doc/_static/cadquery_cheatsheet.html index a265fe8ab..4f0bfca43 100644 --- a/doc/_static/cadquery_cheatsheet.html +++ b/doc/_static/cadquery_cheatsheet.html @@ -17,7 +17,7 @@ } #section-container { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-around; row-gap: 10px; - overflow-y: scroll; + overflow: scroll; width: 100% } .section { @@ -26,6 +26,7 @@ background-color: #EBEBEB; min-width: 340px; max-width: min(50vw, 100%); + overflow-x: scroll; } .section-subtitle { margin-bottom: 4px; @@ -52,9 +53,12 @@ h2 { display: inline; } - @media only screen and (max-width: 600px) { + @media only screen and (max-width: 1000px) { body{ - font-size: 70% + font-size: 75% + } + .section { + max-width: 96%; } } From 086188f307a67d543426e73f64ddf82035b404e9 Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Wed, 5 Oct 2022 09:20:15 -0400 Subject: [PATCH 14/17] Revamped and ready version of cheatsheet! --- doc/_static/cadquery_cheatsheet.html | 1173 ++++++++++++++------------ 1 file changed, 650 insertions(+), 523 deletions(-) diff --git a/doc/_static/cadquery_cheatsheet.html b/doc/_static/cadquery_cheatsheet.html index 4f0bfca43..b70687a0d 100644 --- a/doc/_static/cadquery_cheatsheet.html +++ b/doc/_static/cadquery_cheatsheet.html @@ -1,529 +1,656 @@ - - CadQuery Cheatsheet - - + + CadQuery Cheatsheet + + - - - - -
-
-

3D Construction

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PrimitivesAdditiveSubtractive
Workplane.box
(length, width, height)
Workplane.extrude
(until)
Workplane.cut
(toCut)
Workplane.sphere
(radius)
Workplane.sweep
(path)
Workplane.cutThruAll
()
Workplane.cylinder
(height, radius)
Workplane.loft
(ruled, combine, clean)
Workplane.cutBlind
(until)
Workplane.text
(txt, fontsize, distance)
Workplane.revolve
(angleDegrees)
Workplane.hole
(diameter, depth)
Workplane.union
(angleDegrees)
Workplane.intersect
(toIntersect)
-
-
-

2D Construction

- - - - - - - - - - - - - - - - - - - - - -
Workplane.rect
(xLen, yLen)
Workplane.circle
(radius)
Workplane.ellipse
(x_radius, y_radius)
Workplane.center
(x, y)
Workplane.moveTo
(x, y)
Workplane.move
(xDist, yDist)
Workplane.lineTo
(x, y)
Workplane.line
(xDist, yDist)
Workplane.polarLine
(distance, angle)
Workplane.vLine
(distance)
Workplane.hLine
(distance)
Workplane.polyline
(listOfXYTuple)
-

Sketching

- - - - - - - - - - - - - - - - -
Sketch.rect
(w, h)
Sketch.circle
(r)
Sketch.ellipse
(a1, a2)
Sketch.trapezoid
(w, h, a1)
Sketch.regularPolygon
(r, n)
Sketch.polygon
(pts)
Sketch.fillet
(d)
Sketch.chamfer
(d)
Sketch.finalize
()
-
-
-
-

Import/Export

- - - - - - - - - -
importers.importDXF
(path, tol)
importers.importStep
("path")
exporters.export
(solid, "path/solid.***")
Where *** can be: svg, step, stl, amf, vrml, json
-
-
-

Assemblies

- - - - - - - - - - - - - -
Assembly(
(obj)
Assembly.add
(obj)
Assembly.constrain
(***)
Assembly.solve
()
Assembly.save
("path/assembly.***")
Where *** can be: step, xml, gltf, vtkjs, vrml
-
-
- -
-

Selector String Modifiers

-


-
Axis Strings are: X, Y, Z, XY, YZ, XZ
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ModifierDescription
|Parallel to = ParallelDirSelector
#Perpendicular to = PerpendicularDirSelector
+Positive direction = DirectionSelector
-Negative direction = DirectionSelector
>Max = DirectionMinMaxSelector(directionMax=True)
<Min = DirectionMinMaxSelector(directionMax=False)
%Curve/surface type = TypeSelector
-
-
-

Selector Methods


-
CadQuery selector strings and classes allow filtering to select objects.
- - - - - - - - - - - - - - - - - - - - - - - - -
Selector MethodsSelector Classes -
CQ.faces(selector)NearestToPointSelector(pnt)
CQ.edges(selector)ParallelDirSelector(vector)
CQ.vertices(selector)DirectionSelector(vector)
CQ.solids(selector)DirectionMinMaxSelector(vector)
CQ.shells(selector)TypeSelector(typeString)
-
-
-

Named Planes


-
Direction references refer to the global directions.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NamexDiryDirzDir
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
-
+ + + + +
+
+

3D Construction

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PrimitivesAdditiveSubtractive
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)
+
+
+

2D Construction

+ + + + + + + + + + + + + + + + + + + + + +
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)
+

Sketching

+ + + + + + + + + + + + + + + + +
rect
(w, h)
circle
(r)
ellipse
(a1, a2)
trapezoid
(w, h, a1)
regularPolygon
(r, n)
polygon
(pts)
fillet
(d)
chamfer
(d)
finalize
()
+
+
+
+

Import/Export

+ + + + + + + + + +
importers.importDXF
(path, tol)
importers.importStep
("path")
exporters.export
(solid, "path/solid.***")
Where *** can be: svg, step, stl, amf, vrml, json
+
+
+

Assemblies

+ + + + + + + + + + + + + +
Assembly
()
add
(obj, loc, color)
constrain
(***)
solve
()
save
("path/assembly.***")
Where *** can be: step, xml, gltf, vtkjs, vrml
+
+
+ +
+

Selector String Modifiers

+


+
Axis Strings are: X, Y, Z, XY, YZ, XZ
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ModDescription
|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


+
CadQuery selector strings and classes allow filtering to select objects.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Selector MethodsSelector 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)
+
+
+

Workplane Positioning

+ + + + + + + + + +
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 +
+
+
+
+

Named Planes


+
Direction references refer to the global directions.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NamexDiryDirzDir
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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SelectorSelector ClassSelects# Objects Returned
+ZDirectionSelectorFaces with normal in +z direction0 or 1
|ZParallelDirSelectorFaces parallel to xy plane0..many
-XDirectionSelectorFaces with normal in neg x direction0..many
#ZPerpendicularDirSelectorFaces perpendicular to z direction0..many
%PlaneTypeSelectorFaces of type plane0..many
>YDirectionMinMaxSelectorFace farthest in the positive y dir0 or 1
<YDirectionMinMaxSelectorFace farthest in the negative y dir0 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. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SelectorSelector ClassSelects# Objects Returned
+ZDirectionSelectorEdges aligned in the Z direction0..many
|ZParallelDirSelectorEdges parallel to z direction0..many
-XDirectionSelectorEdges aligned in neg x direction0..many
#ZPerpendicularDirSelectorEdges perpendicular to z direction0..many
%PlaneTypeSelectorEdges type line0..many
>YDirectionMinMaxSelectorEdges farthest in the positive y dir0 or 1
<YDirectionMinMaxSelectorEdges farthest in the negative y dir0 or 1
-
-
-

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.
- - - - - - - - - - - - - - - - - - - - - - - - - - -
SelectorSelector ClassSelects
>YDirectionMinMaxSelectorVertices farthest in the +Y dir
<YDirectionMinMaxSelectorVertices farthest in the -Y dir
>>Y[-2]CenterNthSelector2nd farthest vertex in the +Y dir
<<Y[0]CenterNthSelector1st closest vertex in the Y dir
-
-
- +
+

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. +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SelectorSelector ClassSelects# Objects Returned
+ZDirectionSelectorFaces with normal in +z direction0 or 1
|ZParallelDirSelectorFaces parallel to xy plane0..many
-XDirectionSelectorFaces with normal in neg x direction0..many
#ZPerpendicularDirSelectorFaces perpendicular to z direction0..many
%PlaneTypeSelectorFaces of type plane0..many
>YDirectionMinMaxSelectorFace farthest in the positive y dir0 or 1
<YDirectionMinMaxSelectorFace farthest in the negative y dir0 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. +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SelectorSelector ClassSelects# Objects Returned
+ZDirectionSelectorEdges aligned in the Z direction0..many
|ZParallelDirSelectorEdges parallel to z direction0..many
-XDirectionSelectorEdges aligned in neg x direction0..many
#ZPerpendicularDirSelectorEdges perpendicular to z direction0..many
%PlaneTypeSelectorEdges type line0..many
>YDirectionMinMaxSelectorEdges farthest in the positive y dir0 or 1
<YDirectionMinMaxSelectorEdges farthest in the negative y dir0 or 1
+
+
+

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.
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
SelectorSelector ClassSelects
>YDirectionMinMaxSelectorVertices farthest in the +Y dir
<YDirectionMinMaxSelectorVertices farthest in the -Y dir
>>Y[-2]CenterNthSelector2nd farthest vertex in the +Y dir
<<Y[0]CenterNthSelector1st closest vertex in the Y dir
+
+
+ + + \ No newline at end of file From 59502fe05bf5404f32bda120d45645c575cf006a Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Wed, 5 Oct 2022 09:30:31 -0400 Subject: [PATCH 15/17] Adding links to README --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 75a18c9c1..19b35a47a 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,13 @@ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4498634.svg)](https://doi.org/10.5281/zenodo.4498634) +--- + +### Quick Links +[***Documentation***](https://cadquery.readthedocs.io/en/latest/) | [***Cheatsheet***](https://cadquery.readthedocs.io/en/latest/_static/cadquery_cheatsheet.html) | [***Discord***](https://discord.com/invite/Bj9AQPsCfx) | [***Google Group***](https://groups.google.com/g/cadquery) | [***GUI Editor***](https://github.com/CadQuery/CQ-editor) + +--- + ## What is CadQuery CadQuery is an intuitive, easy-to-use Python module for building parametric 3D CAD models. Using CadQuery, you can write short, simple scripts that produce high quality CAD models. It is easy to make many different objects using a single script that can be customized. From 273507a442d6e828bbb713c054a04e753fd8e7b5 Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Wed, 5 Oct 2022 09:55:09 -0400 Subject: [PATCH 16/17] Adding cheatsheet link to docs sidebar --- doc/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/index.rst b/doc/index.rst index a7f04d1d7..0deec25e7 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -43,6 +43,7 @@ Table Of Contents fileformat.rst examples.rst apireference.rst + API Cheatsheet selectors.rst classreference.rst importexport.rst From b9642266ed7bbcb463ea77512c36d3d0209e783e Mon Sep 17 00:00:00 2001 From: Jordan Poles Date: Thu, 6 Oct 2022 08:57:56 -0400 Subject: [PATCH 17/17] Update README.md --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index df1e892e0..940b39d60 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,18 @@ cmd /K ""%USERPROFILE%/Miniforge3/Scripts/activate.bat" "%USERPROFILE%/Miniforge ``` You might want to consider using `/NoScripts=0` to have an activation shortcut added to the start menu. +### CQ-editor GUI + +CQ-editor is an IDE that allows users to edit CadQuery model scripts in a GUI environment. It includes features such as: + +* A graphical debugger that allows you to step through your scripts. +* A CadQuery stack inspector. +* Export to various formats, including STEP and STL, directly from the menu. + +The installation instructions for CQ-editor can be found [here](https://github.com/CadQuery/CQ-editor#installation). + +CQ editor screenshot + ### Jupyter CadQuery supports Jupyter notebook out of the box using the jupyter-cadquery extension created by @bernhard-42: