-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a "height" parameter for rotate_extrude to help with threading #5011
Comments
Ah, ok. The Total rendering time: 0:33:55.396 Weirdly, my hull-based version which was half as fast in preview rendered twice as fast at 0:16:38.163. |
Did you try snapshot with manifold? |
The |
Even with manifold, for a small example (attached as a .txt), spiral_extrude takes about 5x longer to render and has significant noticeable artifacts, whereas rotate_extrude renders precisely the intended geometry (for a given segmentation resolution) at a fraction of the time. You can use the customizer on the attached script to toggle between spiral_extrude and rotate_extrude with a height parameter, if you apply my patch in your local tree. |
(BTW, sorry about the failing tests, I'm trying to track down the places where my output differs from expected and patch.) |
If trying to build threaded parts of any kind in OpenSCAD, there's a persistent frustration that the only in-built method to extrude a shape both vertically and rotationally is to use
linear_extrude
, which keeps the extruded polygon parallel to the XY plane (more importantly, parallel to the direction of rotation). Ideally, when creating threads (or similar helical structures, like corkscrews, corkscrew marble channels, etc), it would be possible to use 2D geometry to describe the vertical cross-section of the helix and extrude that along a helical path.Describe the solution you'd like
In a similar way that the
twist
parameter oflinear_extrude
extends linear (vertical) extrusion to do rotation as well, an optionalheight
parameter forrotate_extrude
could extend rotate extrusion to include vertical translation as well.Describe alternatives you've considered
Common solutions involve implementing the rotation in OpenSCAD using
hull()
(which only works with convex cross-sections, or usinglinear_extrude()
as in this user-created library, but these methods are painfully slow, and ad hoc for a function that is useful in many modeling contexts.Additional context
I have implemented the
height
parameter in my copy of openscad (PR incoming), and the speedup for spiralizing a semi-complex (non-convex) thread cross-section is 100x in preview mode compared to the linkedspiral_extrude
library and 200x compared to my home-brewedhull()
-based implementation (done by decomposing the cross-section into convex positive shapes and convex negative shapes, and differenceing the hulls). For a full render, the difference is even starker. The C++ implementation finishes in < 0.15s. Both other methods take 10s of minutes. (I'm still waiting for the faster one to finish, it's been at least 20 minutes. I can give actual benchmark numbers later, if required.)The text was updated successfully, but these errors were encountered: