Source: https://github.com/supermerill/FreePySCADYou like OpenSCAD but you hate it at the same time? You can't work in FreeCAD because don't like wasting your time moving the mouse and clicking? FreePySCAD is for you!
note: it's in a beta stage right now. You can use it but some fucntions may have some restrictions (these should be indicated here or in the wiki). It needs the FreeCAD 0.19 version, because the text() function, but you may be able to use older ones if you don't use it.
How it works
FreePySCAD is a python library for FreeCAD to let user write their code in a text editor and see the result after a "compilation" process, like OpenSCAD but in FreeCAD.
To install the library, clone the github repository into the "FreeCAD X.xx/mod" directory
To write your code, you can open the FreeCAD macro editor and beginning your macro with
"from FreePySCAD.freepyscad import *"
You can also type in the python console "exec(open('path_to/my_pycad.py').read())", this has the advantage to show the errors. The geometry passed inside the scene().redraw(...) function will be added inside the current document, replacing everything.
FreePySCAD Beta - Combining OpenSCAD and FreeCAD
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
FreePySCAD Beta - Combining OpenSCAD and FreeCAD
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
- HakanSeven12
- Veteran
- Posts: 1481
- Joined: Wed Feb 06, 2019 10:30 pm
Re: FreePySCAD Beta - Combining OpenSCAD and FreeCAD
Nice work I like the idea
Support me: Hakan Seven on Patreon
Modern UI: Modern UI on FreeCAD Forum
Trails Workbench: Trails Workbench on FreeCAD Forum
Modern UI: Modern UI on FreeCAD Forum
Trails Workbench: Trails Workbench on FreeCAD Forum
Re: FreePySCAD Beta - Combining OpenSCAD and FreeCAD
Not sure why it's openscad, with a different syntax.
Braces are replaced with parenthesis
The ; (semicolons) are replaced with , (commas) and is required to place it after ) if no other ) are directly after that to respect the python syntax.
Modifiers like translate, rotate must not be unattached. Use the parenthesis or a dot:
OpenSCAD: difference(){ translate([1,1,0]) cube(2); rotate([0,0,45]) cube(2); }
FreePySCAD: difference()( translate([1,1,0]).cube(2), rotate([0,0,45])(cube(2)),)
After more than 50 years, it's about time the software industry standardised its language.
Braces are replaced with parenthesis
The ; (semicolons) are replaced with , (commas) and is required to place it after ) if no other ) are directly after that to respect the python syntax.
Modifiers like translate, rotate must not be unattached. Use the parenthesis or a dot:
OpenSCAD: difference(){ translate([1,1,0]) cube(2); rotate([0,0,45]) cube(2); }
FreePySCAD: difference()( translate([1,1,0]).cube(2), rotate([0,0,45])(cube(2)),)
After more than 50 years, it's about time the software industry standardised its language.
Re: FreePySCAD Beta - Combining OpenSCAD and FreeCAD
I have, in the past, imported openscad files into freecad, to fillet edges, etc, and export as stl. It mostly works. I would get annoyed in remembering ','s instead of ';' or whatever. While I'm having a whinge, when did it happen that if entering a numeric value, you have to first delete the original value? It is only in some software that is necessary, I noticed it first with Borland Delphi, iirc (unless you added a sr to take care of it). Freecad is similar. And then there is shift delete / insert, ctrl c / v not always being available.