Loading
Hey! This thing is still a Work in Progress. Files, instructions, and other stuff might change!

FreeCAD sketch to OpenSCAD script

by Bror, published

FreeCAD sketch to OpenSCAD script by Bror Dec 15, 2012

Description

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)

Recent Comments

view all
Cool need to check that out at some time :)

Liked By

view all

License

GNU - GPL
FreeCAD sketch to OpenSCAD script by Bror is licensed under the GNU - GPL license.

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

Instructions

Usage (outlined in attached images):
1. Make sketch in FreeCAD,
2. Export sketch as "Flattened SVG" under File -> Export,
3. (Windows) Run Inkscape plugin from context menu.

3. (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

Installation:
1. Install Inkscape plugin (see parent thing by Dan Newman for details).
2. (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
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.
Cool need to check that out at some time :)
Top