cadquery:svg
Examples of the cadquery:svg directive.
Development Status
- Development Status:
2 - Pre-Alpha
This directive is experimental.
cadquery:svg is based on the docutils “figure” directive having similar features and syntax:
The image may be captioned.
Notes may be added below the code block.
Images may be referenced by name: include from file example.
The image source code is defined in either a code-block or
literalinclude, meaning:
All options for
code-blockorliteralincludemay be used such ascode-block:linenosandcode-block:emphasize-lines.Image source code blocks may be referenced by name: CadQuery source code for a rectangular plate.
Tip
View the reStructuredText source of this page by following the View page source link in the header.
Simple rectangular plate
A simple rectangular plate measuring 2 × 2 × 0.5 mm.
1"""Simple rectangular plate."""
2
3import cadquery as cq
4
5result = cadquery.Workplane().box(2, 2, 0.5)
Notes:
Line numbers are added with
linenos.Line number 5 is emphasized with
emphasize-lines.
Pillow block
A pillow block.
(length, height, diam, thickness, padding) = (30.0, 40.0, 22.0, 10.0, 8.0)
pillow_block = (
cq.Workplane()
.box(length, height, thickness)
.faces(">Z")
.workplane()
.hole(diam)
.faces(">Z")
.workplane()
.rect(length - padding, height - padding, forConstruction=True)
.vertices()
.cboreHole(2.4, 4.4, 2.1)
)
show_object(pillow_block)
Source from file
A simple rectangular plate measuring 2 × 2 × 0.5 mm.
"""Simple rectangular plate."""
import cadquery
result = cadquery.Workplane().box(2, 2, 0.5)
Content variations
Code block: without caption or source
Code block: with both caption and source
A simple rectangular plate measuring 2 × 2 × 0.5 mm.
"""Simple rectangular plate."""
import cadquery as cq
plate = cadquery.Workplane().box(2, 2, 0.5)
Code block: with caption, source, and notes
A simple rectangular plate measuring 2 × 2 × 0.5 mm.
"""Simple rectangular plate."""
import cadquery as cq
result = cadquery.Workplane().box(2, 2, 0.5)
Notes may follow the code-block.
The model source code is loaded from a
code-blockdirective.The model is captioned.
The model source code is displayed.
These are notes.
Source from file: without caption or source
Source from file: with both caption and source
A simple rectangular plate measuring 2 × 2 × 0.5 mm.
"""Simple rectangular plate."""
import cadquery
result = cadquery.Workplane().box(2, 2, 0.5)
Source from file: with caption, source, and notes
A simple rectangular plate measuring 2 × 2 × 0.5 mm.
"""Simple rectangular plate."""
import cadquery
result = cadquery.Workplane().box(2, 2, 0.5)
Notes may follow the literalinclude.
- Material:
stainless steel
- Finish:
brushed