SolidCode / SolidPython

A python frontend for solid modelling that compiles to OpenSCAD
1.1k stars 172 forks source link

Wish: xcsg support #160

Closed ebak closed 3 years ago

ebak commented 3 years ago

Hi,

SolidPython offers me the best python based CAD workflow. Some of my projects are using intensive computed geometries, like many union of hull of spheres. Unfortunately OpenSCAD renders them slow, sometimes I can render only sub-parts with OpenSCAD and union them with Blender.

I was looking for a faster alternative of OpenSCAD and I have found AngelCAD and xcsg.

Currently I have only a very brief experience with them, which is very promising, although I cannot say anything about the maturity of these tools.

What I have did so far:

openscad VaseTop.scad --o VaseTop.csg
time xcsg --obj VaseTop.csg
...
Created OBJ file     : VaseTop.obj
xcsg finished using 0h 0m 24.197s

real    0m24,277s
user    1m15,905s
sys     0m3,348s

image

I thought it would be nice to have a SolidPython like tool which could output directly to .xcsg too. Output to .xcsg may not be as simple as generate .scad output, since .xcsg needs explicit model matrices. As I see all translate()(), rotate()() operations should calculate the proper model matrices in SolidPython side, maybe the PyGLM module could provide efficient help in it.

So it is not an issue, just a daydreaming.

Happy new year!

etjones commented 3 years ago

I think there's probably more work to outputting .xcsg code than I'm up for in SolidPython, but you're absolutely right about the speed of OpenSCAD's rendering. One similar project which SolidPython can handle, and which also works much faster than OpenSCAD, is ImplicitCAD. The code is very similar to OpenSCAD, but the renderer is much faster and there's native support for a number of extra features like rounded shapes that OpenSCAD lacks. Check it out!

ebak commented 3 years ago

Thanks for mentioning ImplicitCAD! I'll take a look. Of course SolidPython support would be very nice. Meanwhile I have started to work on an .xcsg generator