Bend operation

181 views
Skip to first unread message

Wink Saville

unread,
Jun 26, 2020, 12:25:31 AM6/26/20
to cadq...@googlegroups.com
I recently discovered Curv and was impressed with the breadth of operations it could perform. In particular, it supported both bend and twist and it was possible to create a mobius strip in a few lines of code:

    let
      boxX=25; boxY=25; boxZ=100
    in
      boxF [boxX,boxY,boxZ]
      >> twist (180*deg/boxZ)
      >> rotate {angle: 90*deg, axis: Y_axis}
      >> bend {angle: 360*deg}
      >> lipschitz 2

But its language is limited, for instance no I/O, and the generated STL had some issues. Prior to Curv I've played with OpenSCAD, but its language was really poor, IMHO. So I've continued my search for a parametric 3D modeling system a programmer might enjoy and found CadQuery. Python isn't my favorite language but it won't be a limitation, as it's capable of doing most anything.

Anyway, creating a mobius strip isn't my goal, my near term goal is to use my 3D printer to create a flying wing R/C model. Being able to twist and bend the wing isn't a must have, but would be nice.

I see there is a twistExtrude but didn't see a bend operation, did I miss it or are there other ways to bend a 3D object in CadQuery?

-- Wink

Adam Urbanczyk

unread,
Jun 27, 2020, 11:34:17 AM6/27/20
to CadQuery
I'm not familiar with the terminology that Curv is using. CQ is a scripted CAD tool that uses B-rep. This means that you can model in terms of extrusions,revolutions,sweeps, lofts,fillets,chamfers. You could use sweeps to model a wing. Sweeps with auxiliary spine are need to control the twist and are not yet implemented in CQ. TwistExtrude is a good example of how to implement such an operation. I think what you are calling "bend" is roughly this:

import cadquery as cq

a = 1
b = 5
h = b*5
d = a*5

s = (
    cq.Workplane("XY")
    .ellipse(a,b)
    .sweep(
        cq.Workplane("XZ")
        .spline([(0,0),(0,h),(d,h+5*d)],[(0,1),(1,1)])
    )
)


Which results in:

Wink Saville

unread,
Jun 27, 2020, 1:10:24 PM6/27/20
to CadQuery
Thanks for the code!!

Can you point me to some web content that explains the notion of "wires".

Also what is the difference between a "prismatic solid" vs "swept solid".

I ask because I've used "extrude" but haven't used swept yet and the API docs say about each:

Workplane.extrude(distance[, combine, …]) Use all un-extruded wires in the parent chain to create a prismatic solid.
Workplane.sweep(path[, multisection, …]) Use all un-extruded wires in the parent chain to create a swept solid.

I've done a couple searches "cad un-extruded wires" and "cad prismatic solid vs swept solid", but I'm hoping you can point me "good" content.


I didn't see your image, here is what I see after executing your program, again look's really nice!!!!

adams-wing.png
Reply all
Reply to author
Forward
0 new messages