Re:FreeCAD Simulator
by app4soft on Sunday November 15, 2020 @02:13AM
(#25099013)
Rob Miles posted announcement[0,1] of rolling out sources of "FreeCAD Simulator":
> I’ve made this horrible hack to make it easier to debug my Python macros that run inside FreeCAD and design little boxes. It means that I can use all the lovely debugging features of Visual Studio Code to find out why my code don’t work. The hack takes the form of a few simple Python objects that fake part of the FreeCAD ones and allows your macros to run in any Python environment you fancy.
> If you like the idea of writing Python code that produces physical artefacts you might want to take a look at it.
FTR, There are amany interesting articles covering FreeCAD use for 3D Printing on Rob Miles' blog.[2,3]
Re:FreeCAD Simulator
by rurban on Monday November 16, 2020 @07:59AM
(#25111065)
In my naive opinion it would have been much easier to integrate the python debugger into FreeCAD proper. No need for mocking everything, you get the real values not fake ones. And this also does not scale. FreeCAD is constantly expanded.
This is really useful. I'm finally getting around to looking at beginning to think about writing a FreeCAD macro to create 3D celtic knotwork panels for 3D printing, and this will help :)
Re:FreeCAD Simulator
by Cynox on Monday November 16, 2020 @06:38AM
(#25110540)
OpenSCAD can only produce triangulations (STL), not CAD geometries (STEP/IGES).
If you want an OpenSCAD-like workflow, but in Python and producing CAD (Brep) files, then cadquery 2 is progressing very quickly. They now have assembly support, so constructing a multi-solid part (as a STEP file) that can be dragged and dropped into FreeCAD is quite easy.
Re:FreeCAD Simulator
by encypruon on Monday November 16, 2020 @07:00AM
(#25110646)
No need, as there is solidpython [1] which lets you use OpenSCAD from Python. The notation is brief, Pythons expressiveness makes everything easier and the learning curve is extremely low.
Re:FreeCAD Simulator
by ur-whale on Monday November 16, 2020 @08:48AM
(#25111546)
Especially OpenSCAD's language: paying the price to learn a new DSL is only a reasonable investment when said DSL brings in a ton of added value as compared to a generic programming language.
OpenSCAD's DSL is a rather feeble attempt at a functional programming language, brings in almost no added value compared to - say - python and worst of all is very limited and has no library ecosystem.
Do yourself a favor and learn one of the python-based solutions that end up calling the same computational geometry engine (namely CGAL).
Re:FreeCAD Simulator
by ur-whale on Tuesday November 17, 2020 @06:40PM
(#25131379)
SolidPython is the most mature and the one I'm using. There were others I tried before settling on solid, but TBH I forgot their name.
SolidPython has downsides though:
- it is a giant PITA to install: you have to deploy that monstrous wart called "conda" which will gobble up 6G of your drive and fricking patch you .bashrc, all of this just so you can install solid
- it lacks the following feature that native openscad has: "edit model source code with <insert fave editor here> and openscad will recompute the model automatically every time you save.
There's a way to implement that feature with an additional package (solidpython-reloader), but at that point, you've lost 80% of your target audience.
> I’ve made this horrible hack to make it easier to debug my Python macros that run inside FreeCAD and design little boxes. It means that I can use all the lovely debugging features of Visual Studio Code to find out why my code don’t work. The hack takes the form of a few simple Python objects that fake part of the FreeCAD ones and allows your macros to run in any Python environment you fancy.
> If you like the idea of writing Python code that produces physical artefacts you might want to take a look at it.
FTR, There are amany interesting articles covering FreeCAD use for 3D Printing on Rob Miles' blog.[2,3]
[0] https://twitter.com/robmiles/status/1327700851499147265
[1] https://www.robmiles.com/journal/2020/11/5/freecad-simulator...
[2] https://www.robmiles.com/journal/category/FreeCAD
[3] https://www.robmiles.com/journal/category/3D+printing
If you want an OpenSCAD-like workflow, but in Python and producing CAD (Brep) files, then cadquery 2 is progressing very quickly. They now have assembly support, so constructing a multi-solid part (as a STEP file) that can be dragged and dropped into FreeCAD is quite easy.
https://cadquery.readthedocs.io/en/latest/
[1] https://github.com/SolidCode/SolidPython
OpenSCAD's DSL is a rather feeble attempt at a functional programming language, brings in almost no added value compared to - say - python and worst of all is very limited and has no library ecosystem.
Do yourself a favor and learn one of the python-based solutions that end up calling the same computational geometry engine (namely CGAL).
SolidPython has downsides though:
There's a way to implement that feature with an additional package (solidpython-reloader), but at that point, you've lost 80% of your target audience.