Hey! This thing is still a Work in Progress. Files, instructions, and other stuff might change!
FreeCAD sketch to OpenSCAD script
by Bror, published
Use This Project
Give a Shout Out
If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.Print Thing Tag
I like the idea of constrained sketches available in FreeCAD. This is a hack to transfer them to OpenSCAD without too much trouble.
This Thing is an adaptation of Dan Newman's excellent Inkscape plugin (parent Thing). The main changes are:
1) Runs without input and saves .scad in the same folder as .svg file (see instructions below)
2) Does not extrude shapes, but keeps them two-dimensional
3) Ignores some transformations, and units, to get same size in OpenSCAD units as in the FreeCAD sketch.
4) Minor technical changes to circumvent ugly crash bugs in Inkscape (and FreeCAD's svg export, I think)
Usage (outlined in attached images):
- Make sketch in FreeCAD,
- Export sketch as "Flattened SVG" under File -> Export,
(Windows) Run Inkscape plugin from context menu.
- (Other OS/Or don't want to install context menu) Run the following commandline
inkscape --verb=EditSelectAll --verb=SelectionCombine --verb=EditDeselect --verb=command.extrude.openscad_auto.noprefs --verb=EditUndo --verb=EditUndo --verb=FileQuit /full/path/to/file.svg
This commandline opens your file in Inkscape, combines all paths and then runs the export plugin. The full path to file is important, it is used to determine the output directory for the SCAD file.
Prerequisites: Freecad, Inkscape
- Install Inkscape plugin (see parent thing by Dan Newman for details).
- (optional, but convenient) Make context menu, shell script or whatever you prefer to run inkscape from the commandline as per above.
To install a context menu in Windows 7 (like the one in attached image) I made .reg-file which installs the menu for svg-files, and runs Inkscape assuming it's installed at the default location. I attach this .reg file, but a) never trust a .reg-file from random internet people: check the contents yourself, and b) edit the file to match the location of your Inkscape.exe .
If you are not comfortable with .reg-files, there is a guide at
http://www.howtogeek.com/107965/how-to-add-any-application-shortcut-to-windows-explorers-context-menu/ , make a command for "svgfile" which runs
"c:[backslash]Program Files (x86)[backslash]Inkscape[backslash]inkscape.exe" --verb=EditSelectAll --verb=SelectionCombine --verb=EditDeselect --verb=command.extrude.openscad_auto.noprefs --verb=EditUndo --verb=EditUndo --verb=FileQuit "%1"
(sorry for [backslash] -- thingiverse removes them automatically it seems)
This is very much a Work in Progress, and it has not been tested at all. It just happens to work on my machine, with my settings. It should probably do something to .svg's generated with other programs as well, feel free to try.
Upgrade this Thing with Thingiverse Apps
FreeCAD sketch to OpenSCAD script by Bror is licensed under the GNU - GPL license.
What does this mean?
- Remixing or Changing this Thing is allowed.
- Commercial use is allowed.
Show Some Love
Say thanks by giving Bror a tip and help them continue to share amazing Things with the Thingiverse community.Tip Designer
We're sure Bror would love to see what you've printed. Please document your print and share a Make with the community.
To post a Make simply visit this Thing again and click I Made One to start uploading your photo. It’s even easier to post a Make via the Thingiverse Mobile app (available via Google Play and Apple App Store).