Lofted logarithmic spiral

53 views
Skip to first unread message

neri-engineering

unread,
Jan 3, 2025, 7:38:29 PMJan 3
to CadQuery
First of all, Happy New Year to you all.  Looking forward to a great year of CAD modeling.

Okay, this is kind of a wild question, I don't necessarily expect an answer, just wanted to get your thinking juices flowing.  This question applies to really any CAD tool not just CadQuery/OCCT/FreeCAD.

I have a logarithmic spiral loft that looks like this:

logarithmic-spiral.png

Code for this is down below, it's really really simple.  At every step of the way I define my "control shape" as planar (it's a rotating triangle), in the XY.  This works great.  However, with forms that have a spiraling nature, a spherical representation of the control shape is more suitable.  With very complicated shapes especially.  You can think IMAX versus typical movie theater.  IMAX projects onto a sphere, movie theater projects onto plane.  I was looking for a way to define a loft, or something similar, which has a spiraling/natural character and where the control surfaces are defined as spherical cross sections.

What soft of low-level hooks would I use to accomplish that, or what sorts of higher-level APIs are available to accomplish that.  I can certainly get away with planar cross sections, no problem.  But it would be nice...  Kind of nifty...

Here is the code.



from cadquery import Workplane

profile = Workplane("XY")

profile = profile.workplane(offset= -64)
profile = profile.moveTo(0, 8)
profile = profile.lineTo(-8, -8)
profile = profile.lineTo(8, -8)
profile = profile.close()

profile = profile.workplane(offset= 64 - 32)
profile = profile.moveTo(-4, 0)
profile = profile.lineTo(4, -4)
profile = profile.lineTo(4, 4)
profile = profile.close()

profile = profile.workplane(offset= 32 - 16)
profile = profile.moveTo(0, -2)
profile = profile.lineTo(2, 2)
profile = profile.lineTo(-2, 2)
profile = profile.close()

profile = profile.workplane(offset= 16 - 8)
profile = profile.moveTo(1, 0)
profile = profile.lineTo(-1, -1)
profile = profile.lineTo(-1, 1)
profile = profile.close()

profile = profile.workplane(offset= 8 - 4)
profile = profile.moveTo(0, 1/2)
profile = profile.lineTo(-1/2, -1/2)
profile = profile.lineTo(1/2, -1/2)
profile = profile.close()

profile = profile.workplane(offset= 4 - 2)
profile = profile.moveTo(-1/4, 0)
profile = profile.lineTo(1/4, -1/4)
profile = profile.lineTo(1/4, 1/4)
profile = profile.close()

profile = profile.workplane(offset= 2 - 1)
profile = profile.moveTo(0, -1/8)
profile = profile.lineTo(1/8, 1/8)
profile = profile.lineTo(-1/8, 1/8)
profile = profile.close()

profile = profile.workplane(offset= 1 - 1/2)
profile = profile.moveTo(1/16, 0)
profile = profile.lineTo(-1/16, -1/16)
profile = profile.lineTo(-1/16, 1/16)
profile = profile.close()

spiral = profile.loft(ruled= False, combine= False)
show_object(spiral)



Sent with Proton Mail secure email.

Adam Urbanczyk

unread,
Jan 18, 2025, 11:13:11 AMJan 18
to CadQuery
You can loft or sweep non-planar shapes, if that is your question.

Neri

unread,
Feb 27, 2025, 4:04:19 AMFeb 27
to CadQuery
How?  For example, how would I loft a hemisphere to a smaller, concentric, and aligned hemisphere?
Reply all
Reply to author
Forward
0 new messages