Sketch API seems to be sketchy

21 views
Skip to first unread message

neri-engineering

unread,
Oct 23, 2024, 4:25:01 PM10/23/24
to CadQuery
I've tried this before and am trying again but each time, I feel like I'm just smacking my head against the wall.  The following code should be self-explanitory but I can't seem to get it to work.  Obviously it's supposed to draw a cone.  I specifically want to try to use Sketch; I know how to do this w/o Sketch API.

In particular I want to learn how to loft() with Sketch because then I can use the same Sketch object which is scaled and moved.

import cadquery as cq
sketch1 = cq.Sketch().circle(1)
sketch2 = cq.Sketch().circle(0.5)
result = cq.Workplane("XY")
result = result.placeSketch(sketch1)
result = result.workplane(offset= 5)
result = result.placeSketch(sketch2)
result = result.loft(combine= True)

Sent with Proton Mail secure email.

Adam Urbanczyk

unread,
Oct 23, 2024, 6:49:17 PM10/23/24
to CadQuery

You need to use a single placeSketch call:

sketch1 = cq.Sketch().circle(1)
sketch2 = cq.Sketch().circle(0.5)
result =(
    cq.Workplane("XY")
    .placeSketch(sketch1, sketch2.moved(z=5))
    .loft(combine= True)
)
Reply all
Reply to author
Forward
0 new messages