You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/sketch.rst
+53-22Lines changed: 53 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,8 +193,8 @@ Supported operations include :meth:`~cadquery.Workplane.extrude`,
193
193
Sketches can be created as separate entities and reused, but also created ad-hoc
194
194
in one fluent chain of calls as shown below.
195
195
196
-
197
-
Note that the sketch is placed on all locations that are on the top of the stack.
196
+
Sketches in-place
197
+
=================
198
198
199
199
Constructing sketches in-place can be accomplished as follows.
200
200
@@ -218,8 +218,35 @@ Constructing sketches in-place can be accomplished as follows.
218
218
219
219
Sketch API is available after the :meth:`~cadquery.Workplane.sketch` call and original `workplane`.
220
220
221
+
Placing an existing sketch on a workplane
222
+
=========================================
223
+
224
+
Sometimes it is desired to place an existing sketches as-is on a workplane. This can be done with :meth:`~cadquery.Workplane.placeSketch`
225
+
226
+
.. cadquery::
227
+
:height: 600px
228
+
229
+
import cadquery as cq
230
+
231
+
s = cq.Sketch().trapezoid(3, 1, 110).vertices().fillet(0.2)
232
+
233
+
result = (
234
+
cq.Workplane()
235
+
.box(5, 5, 5)
236
+
.faces(">X")
237
+
.workplane()
238
+
.transformed((0, 0, -90))
239
+
.placeSketch(s)
240
+
.cutThruAll()
241
+
)
242
+
243
+
Sketches spanning multiple elements
244
+
===================================
245
+
221
246
When multiple elements are selected before constructing the sketch, multiple sketches will be created.
222
247
248
+
Note that the sketch is placed on all locations that are on the top of the stack.
249
+
223
250
.. cadquery::
224
251
:height: 600px
225
252
@@ -244,27 +271,10 @@ When multiple elements are selected before constructing the sketch, multiple ske
244
271
.cutBlind(-0.5, taper=10)
245
272
)
246
273
247
-
Sometimes it is desired to reuse existing sketches and place them as-is on a workplane.
248
-
274
+
Lofting between two sketches
275
+
============================
249
276
250
-
.. cadquery::
251
-
:height: 600px
252
-
253
-
import cadquery as cq
254
-
255
-
s = cq.Sketch().trapezoid(3, 1, 110).vertices().fillet(0.2)
256
-
257
-
result = (
258
-
cq.Workplane()
259
-
.box(5, 5, 5)
260
-
.faces(">X")
261
-
.workplane()
262
-
.transformed((0, 0, -90))
263
-
.placeSketch(s)
264
-
.cutThruAll()
265
-
)
266
-
267
-
Reusing of existing sketches is needed when using :meth:`~cadquery.Workplane.loft`.
277
+
Two sketches on different workplanes are needed when using :meth:`~cadquery.Workplane.loft`.
268
278
269
279
.. cadquery::
270
280
:height: 600px
@@ -278,3 +288,24 @@ Reusing of existing sketches is needed when using :meth:`~cadquery.Workplane.lof
278
288
result = Workplane().placeSketch(s1, s2.moved(Location(Vector(0, 0, 3)))).loft()
279
289
280
290
When lofting only outer wires are taken into account and inner wires are silently ignored. Note that only sketches on the top of stack are considered for the current operation (i.e. there are no pending sketches), so when lofting or sweeping all relevant sketches have to be added in one `placeSketch` call.
291
+
292
+
Offsets made easy
293
+
=================
294
+
295
+
Conveniently, it is possible to reuse a sketch to create an :meth:`~cadquery.Sketch.offset` shape.
0 commit comments