cadquery icon indicating copy to clipboard operation
cadquery copied to clipboard

Add Sketch val and vals methods

Open lorenzncode opened this issue 3 years ago • 1 comments

In the old Discord, @adam-urbanczyk had mentioned the idea of adding val, vals to Sketch. I'm opening this issue to track the enhancement. IIUC it would work similar to the following.

# return four vertices
v = cq.Sketch().trapezoid(3, 1, 110).vertices().vals()
# return a face
f = (
    cq.Sketch().trapezoid(3, 1, 110).vertices().fillet(0.2).reset().faces().val()
)  
# loft 
s1 = cq.Sketch().circle(1.5)

s2 = cq.Sketch().rect(0.75, 0.5)

r = (
    cq.Workplane()
    .box(4.0, 4.0, 0.25)
    .faces(">Z")
    .eachpoint(lambda l: s1.wires().val().locate(l))
    .workplane(offset=3)
    .eachpoint(lambda l: s2.wires().val().locate(l))
    .loft()
)

lorenzncode avatar Jun 10 '22 01:06 lorenzncode

val and vals exist in cq_warehouse (along with add, boundingBox and text). See https://cq-warehouse.readthedocs.io/en/latest/extensions.html#sketch-class-extensions

gumyr avatar Jun 14 '22 20:06 gumyr