Skip to content

How to construct a sketch using the edga-based API and then extrude it in a empty workplane. #1374

Discussion options

You must be logged in to vote

Remove close() (because the final arc already closes the edges).
Add assemble().

import cadquery as cq

r1 = 3/16
r2 = 2*r1
h = 2
b = 1
angle = 30 # degrees

s = (
    cq.Sketch()
    .segment((0,0),(0,h))
    .segment(r1,0)
    .segment(h,-90)
    .arc((r2,0), r1, 180, angle)
    .segment(b, 270+angle)
    .segment(r1,180+angle)
    .segment(b,90+angle)
    .arc((r2,0), r2, 180+angle, -angle)
    .assemble()
)

result = cq.Workplane().placeSketch(s).extrude(10)

See the docs section on the Edge-based API and the notes on assemble.
https://cadquery.readthedocs.io/en/latest/sketch.html#edge-based-api

assemble is not required in @jmwright's example because it calls rect which automatically r…

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@Willy-Schnackenpfefferhausen
Comment options

Comment options

You must be logged in to vote
1 reply
@Willy-Schnackenpfefferhausen
Comment options

Answer selected by Willy-Schnackenpfefferhausen
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@adam-urbanczyk
Comment options

@Willy-Schnackenpfefferhausen
Comment options

@adam-urbanczyk
Comment options

@adam-urbanczyk
Comment options

@Willy-Schnackenpfefferhausen
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants