Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slight improvement of the sketch tutorial #921

Merged
merged 4 commits into from
Nov 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions doc/sketch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,38 @@ combining them using boolean operations.
cq.Sketch()
.trapezoid(4,3,90)
.vertices()
.circle(.5,mode='s')
.circle(.5, mode='s')
.reset()
.vertices()
.fillet(.25)
.reset()
.rarray(.6,1,5,1).slot(1.5,0.4,mode='s',angle=90)
.rarray(.6,1,5,1).slot(1.5,0.4, mode='s', angle=90)
)

Note that selectors are implemented, but selection has to be explicitly reset. Sketch
class does not implement history and all modifications happen in-place.

Modes
^^^^^

Every operation from the face API accepts a mode parameter to defines how to combine the created object with existing ones. It can be fused (``mode='a'``), cut (``mode='s'``), intersected (``mode='i'``) or just stored for construction (``mode='c'``). In the last case, it is mandatory to specify a ``tag`` in order to be bale to refer to the object later on. By default faces are fused together. Note the usage of the subtractive and additive modes in the example above. The additional two are demonstrated below.
adam-urbanczyk marked this conversation as resolved.
Show resolved Hide resolved

.. cadquery::
:height: 600px

result = (
cq.Sketch()
.rect(1, 2, mode='c', tag='base')
.vertices(tag='base')
.circle(.7)
.reset()
.edges('|Y', tag='base')
.ellipse(1.2, 1, mode='i')
.reset()
.rect(2, 2, mode='i')
.clean()
)


Edge-based API
==============
Expand All @@ -62,6 +83,7 @@ If needed, one can construct sketches by placing individual edges.
Once the construction is finished it has to be converted to the face-based representation
using :meth:`~cadquery.Sketch.assemble`. Afterwards, face based operations can be applied.


Convex hull
===========

Expand Down Expand Up @@ -269,4 +291,4 @@ Reusing of existing sketches is needed when using :meth:`~cadquery.Workplane.lof
.loft()
)

When lofting only outer wires are taken into account.
When lofting only outer wires are taken into account and inner wires are silently ignored.