Spherical extrude

23 views
Skip to first unread message

neri-engineering

unread,
Oct 20, 2024, 12:11:59 PM10/20/24
to CadQuery
I have a rather difficult question and please excuse me if the question itself does not make perfect sense, because the problem itself is difficult to explain.

I am familiar with 'Workplane.extrude()' which takes 'taper' as optional argument.

If we omit using 'taper' in this function for the time being, then we can imagine the extrusion of a 2D shape defined in the XY plane for example, as being an extrusion of that shape towards a "vanishing point" at infinity, which lies on the positive z axis.

I am interested in a tapered extrude which allows me specify the "vanishing point" as being a finite point, somewhere.

What am I trying to do exactly, you may ask, and why do I need such a function?  I have an outline drawn on a sphere, sphere being centered around the origin of sphere.  I want to "extrude" that shape from the spherical surface to the origin of sphere, where all the extrusion lines will meet at a point (center of sphere), since in this case the origin of sphere is the "vanishing point".

plot_bevel_gear.png

To get around the fact that extrusions always start from a plane, I can myself compute the "projection" from the sphere onto the table on which the sphere is lying, and I can use THAT 2D outline to then project towards my vanishing point, which is the point at the center of the sphere.  This is a bit reminiscent of some classical problems in complex analysis.  If you can't understand what I just explained, you may just ignore this last little insight.

gnomic-projection.png

One would use this sort of strategy, or related strategy, when implementing bevel gear teeth, for example.

However I am not interested in using any ready-made library, nor am I interested in using "Numpy".  I want to learn how to do this at the low level, using only APIs that are already exposed in the CadQuery core libraries, for my own purposes.

Any insights would be appreciated.  Thanks.  Hopefully my explanation made sense.

Sent with Proton Mail secure email.

neri-engineering

unread,
Oct 20, 2024, 2:05:24 PM10/20/24
to CadQuery
I have managed to partially answer my own question with the following code:



import cadquery as cq

def loft_test():
    outline = cq.Workplane("XY")
    outline = outline.moveTo(1, 1)
    outline = outline.lineTo(1, 0)
    outline = outline.lineTo(0, 0)
    outline = outline.close();
    outline = outline.workplane(offset= 3.0)
    outline = outline.moveTo(0.01, 0.01)
    outline = outline.lineTo(0.01, 0)
    outline = outline.lineTo(0,    0)
    outline.close()
    thing = outline.loft(combine= True)
    return thing

show_object(loft_test())



However I would really like to loft to a single point, and I'm still researching how to do that.

I am also operating on the assumption that my loft is going to be from something drawn on a plane, and that lofting a drawing which is on the sphere is too complex and is not feasible/practical.  This is okay with me, as I can perform the gnomonic projection (from sphere to plane) as mentioned previously, and loft from there, then finally taking the intersection with a sphere of resulting object.  Thanks for any potential answers.

Sent with Proton Mail secure email.

--
cadquery home: https://github.com/CadQuery/cadquery
post issues at https://github.com/CadQuery/cadquery/issues
run it at home at : https://github.com/CadQuery/CQ-editor
---
You received this message because you are subscribed to the Google Groups "CadQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cadquery+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cadquery/YMtzPPbPHWdBVEeY0f2cRIKiY9_WfKVyytbX1SyGbsOSgxiABdfMPIlYx0hxrql5pGGXvTMHifw49Uxp_s_rCE9sv1wVOWy-JLXCDnc6TiE%3D%40protonmail.com.

Adam Urbanczyk

unread,
Oct 21, 2024, 6:03:43 PM10/21/24
to CadQuery
Loft to vertex is supported by OCCT. I'll try to add it to CQ.

Neri

unread,
Oct 22, 2024, 3:12:15 AM10/22/24
to CadQuery
Thank you.  Your great work is greatly appreciated.  CadQuery is a very powerful tool.  My winter projects underway...

Neri

unread,
Oct 23, 2024, 11:50:16 AM10/23/24
to CadQuery
Hi there,

gnomonic.png

My bevel gear generator is progressing much faster than I thought (why am I not using CQ_Gears?  Well, I don't want any dependencies for my code, and I wasn't able to get CQ_Gears to work)
I'm done with the gnomonic projection and it's time to draw splines/edges on the plane and then use a loft.

If and when we loft to a vertex, I don't know if it will be better or worse than lofting to a scaled path which is sitting "higher", for reasons of performance and accuracy.  Eventually I will be intersecting the whole thing with a sphere or something like this, anyways.

How would I know when the loft to vertex has been added?  Is there any timeline for this change, or should I just proceed to loft to a scaled mini-copy of my shape?

On Tuesday, October 22, 2024 at 12:03:43 AM UTC+2 Adam Urbanczyk wrote:

Adam Urbanczyk

unread,
Oct 23, 2024, 6:55:37 PM10/23/24
to CadQuery
For a quick look you should be able to use the shape-improvements branch. So far only the free function loft.
Reply all
Reply to author
Forward
0 new messages