Hey! This thing is still a Work in Progress. Files, instructions, and other stuff might change!
Inkscape font4OpenSCAD extension
by sawdusty, 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
Inkscape font -> DXF file -> OpenSCAD with Write.scad
I really like the Write extension for OpenSCAD http://www.thingiverse.com/thing:16193, but as soon as I used it I wanted different fonts.
I work with Inkscape a lot and I like the text fonts it has built in. This Inkscape extension is a python script to begin the process of creating a font face (a DXF file) for OpenSCAD and the Write extension. Some manual work is necessary in Inkscape to finish the process, but it's worth it.
- Install Inkscape.
- Copy the two files, font4OpenSCAD.inx and font4OpenSCAD.py to the extensions folder of Inkscape. For Windows users this is (probably) found at c:/Program Files/Inkscape/share/extensions. If you're running Linux, see the Inkscape website for help in finding this folder, it varies with the version you installed.
- Open Inkscape with a new document.
- Go to the Text menu, select Text and Font... and decide which font you want to work with. Remember the name, exactly as shown in the Font Family list.
- Close the Text and Font dialog.
- Go to the Exensions menu, select Text > Font4OpenSCAD.
- In the dialog box, type in the name of the font you want to use.
- Click the Apply button.
Once the "Font4OpenSCAD is working" message disappears, you have to finish the process manually. I hope to find a way to do this in the script later, but only time will tell whether I succeed.
To finish and create the DXF output:
- Press Ctrl + Alt + A to select all elements on all layers of the file.
- Go to the Path menu and select Stroke To Path. This will take a few seconds to finish. You will know it is done when the Path menu returns to its normal appearance instead of being highlighted.
- Go back to the Extensions menu and select Modify Path > Flatten Beziers...
- Enter a value of 0.2 in the Flatness field. You can try making this smaller, but the OpenSCAD rendering time will increase greatly.
- Click the Apply button. Again, Inkscape will take a few seconds to process all of the elements.
- Close the Flatten Beziers dialog.
- Go to the File menu and click Save As... and choose DXF as the file type.
- Enter your fonts name, with .dxf at the end (Inkscape will not add this for you).
- Click the Save button.
- In the "Desktop Cutting Plotter" dialog, enable the "Use LWPOLYLINE" option, but disable the "use ROBO-Master" option.
- Click OK.
- I recommend saving the SVG file of the font too. In case one or more characters do not appear, you can fix them in the SVG file and re-export, but Inkscape will not read the DXF file back in. (Note the missing "M" in the font image shown. It has an internal path that has to be "reversed". It works nicely after that. BTW, the font in the image is "Pristina".)
Use the resulting DXF file in OpenSCAD with the Write extension as you would one of the default fonts. The file TestWriteFont.scad is a slightly modified SCAD file from the excellent Write.scad thing by HarlanDMii http://www.thingiverse.com/HarlanDMii that lets you set the font name in a variable and then test all of the charcters in the font.
The DXF output files should not be posted as "things" unless you KNOW the original font is open source, or public domain. Most computer fonts are not, but I believe the ones with Inkscape are. Please proceed carefully and knowledgeably.
The output of this extension will not create "solid" letters like those in the default fonts packaged with the Write extension. The output is mostly "hollow" characters. You can edit the individual letters to make them "solid". It is not difficult, and can be done pretty quickly in the XML editor in Inkscape if you're familiar with that program. You need to break the characters into separate paths first, then it's pretty easy, but time consuming. Again, this is something I hope to automate, or maybe someone else will beat me to it. (I will try to add steps for this manual process later.)
Font size and positioning will vary with the font you choose.
While I have printed a couple of items with characters produced with fonts created as described, I cannot test this exhaustively. Please don't ask me about problems, I probably will not be able to help.
- Last, this is the first Inkscape extension I have created and the first program I have ever written in Python. While it was not difficult, it is by no means an example of great code.
Inkscape font4OpenSCAD extension by sawdusty is licensed under the Creative Commons - Attribution license.
What does this mean?
- You must attribute (give credit) to the creator of this Thing.
- Remixing or Changing this Thing is allowed.
- Commercial use is allowed.
Show Some Love
Say thanks by giving sawdusty a tip and help them continue to share amazing Things with the Thingiverse community.Tip Designer
We're sure sawdusty 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).