Easy and accurate SVG to DXF conversion using Inkscape and pstoedit

If you've ever worked with a vector tool to design something to be carved with a CNC routing machine, you may have needed to convert the resulting SVG file into a DXF. In my workflow I often use Inkscape to generate my SVG graphic, but my CAD software is CamBam and it requires a DXF file.

Many people have tried to make the perfect Inkscape plugin for exporting DXF, there is Better DXF ExportBetter Better DXF Export and Big Blue Saw's DXF Export. I've had the most luck with the last one, but it was still finicky and often broke when updating Inkscape or OSX. Not only that, but at the end of the Big Blue Saw page, Simon mentions that he doesn't even use the plugin most of the time, instead relying on a command line tool called pstoedit.

With that in mind I made a small shell script which will convert an SVG file to DXF, you can save the script and run it directly or add the functions to your startup script.

The script is available on github under the project svgToDxf. If you choose to add the functions directly to your startup script, as I have, simply copy the functions here and paste them in your .bashrc file. Now all you need to do to convert an SVG file to DXF is use the command svgToDxf MyCoolDesign.svg and the output will be MyCoolDesign.dxf

OpenSCAD linear extrude that interpolates between two shapes

Full source code is available for this thing on thingiverse.

OpenSCAD has proven to be an easy to use and flexible tool, but at times I'm left scratching my head to figure out ways around its limitations. In this case I had two squares with rounded corners, their sizes and the corner radius for both squares are configurable. Now I wanted a square tube to join these two pieces together.

Final shape
My hope was that I could get it close enough with some fancy parameters piped into the OpenSCAD linear_extrude function. It seemed possible since there are some pretty fancy parameters regarding rotations and twists. After checking out the documentation it didn't look like there was anything that would be close.

For this project I found a module by Felipe C. da S. Sanches to create squares with rounded corners. I'm sure there are many like it, but this was the first one I found and it worked as advertised.

So made a little module using this which wraps around a rectangle for one side, and another which fits into a rectangle for the other side:


This simply creates a rectangle with rounded corners and subtracts a slightly smaller rectangle from the middle, then extrudes the whole assembly some height. This piece goes around a rectangle with square corners, so the inside has square corners. Then I created a second tube designed to fit into a rectangle with rounded corners, so the outside of this tube must have rounded corners. After spacing them out I get something that looks like this:
Multiple rounded rectangles


This is where I realized I need some fancy function to extrude the bottom shape into something which meets up with the upper shape. The solution I ended up with works the same way as the 3D printer I'll print this object with: slice it up into multiple extrusions. For each extrusion I interpolate the inner radius, outer radius, width and length depending on how far into the overall extrusion we are.

With this I can now create a shape which connects my two adapters. The final product printed out nicely:
Printed object
Finished product!

Installed adapter
Fits perfectly.

A week of 3D printing with the OrdBot Hadron

It has been about a week since my OrdBot's first successful calibration print and it seems like a good time to write down some of my initial problems, experiences and solutions. However before I get into that a review of my 3D printer stack.

Hardware
OrdBot Hadron
3/8"-12 TPI ACME Z-Axis screws
1.8 degree Nema17 X/Y motors
1.8 degree Nema23 Z motors
Qu-bd MBE Extruder (with some modifications)

Electronics
AzteegX1 v1.0 (644P processor)
Lava heatbed, I have only used PLA at this point so this is still disconnected.

Software
Mac OSX
Marlin firmware
Slic3r v0.9.9
Pronterface (March 2012 release)
Repetier-host Mac (0.56, lower versionthan linux/windows releases for some reason)

Now for the problems encountered during the past week, approximately in the order which I ran into them.

Pololu A4988 - I have used these before on my ShapeOko CNC machine. They have been so reliable that I completely forgot how to set them up, as such I blew up 3 drivers while setting up the electronics. So be careful, check the polarity and for the love of everything don't measure voltage when your multimeter is in continuity mode!

Leveling the bed - This was tedious but not particularly difficult. The LAVA heatbed has 8 M3 screws along the perimeter so calibration was just a matter of carefully tightening them until the height is just right. To measure the height I lowered the printer nozzle until it had just enough space for a piece of paper to slide underneath with little resistance, at this point I manually jogged the nozzle along the perimeter adjusting the M3 screws as necessary until the bed was level.

Setting the Z-Axis endstop - This step is ongoing and was very tedious without a way to precisely raise or lower the endstop actuator (a screw in sliding t-slot nut). I have it set fairly close, but still find myself hitting the "stop motor" button and manually turning the Z-Axis screws while the first layer is printing. Eventually I will print out something like this and dial in the Z endstop a more reliably.

Configuring steps per mm - This was the longest part of the process, and I'm still not sure why. Fortunately it wasn't difficult, just tedious. I know the steps per revolution on my motors (200), the microstep resolution for the steppers (16x), the pitch of MXL belts (2.032mm) and the number of teeth on the pulley (16). Using the equation on the buildlog.net configuration page gave me a number which ended up being way too small. My calibration object of choice was the nickel test thing on thingiverse, I just kept printing them out, measuring the insides and adding a ratio multiplier until satisfied that things were the correct size.

Pololu A4988 overheating - Once I had my machine calibrated I started trying to print larger objects that took more time. Without fail after 5-10 minutes after starting the machine would start losing steps. Eventually I noticed how hot the stepper drivers were and mounted a fan pointing at them which fixed the problem.

The notorious QU-BD MBE. This thing gave me a ton of trouble, so much so that I ordered a J-Head after the first day of trying to get it up and running. That said I've managed to get it to print very reliably and haven't yet felt the need to install the J-Head.

QU-BD pre-upgrades - Before I even had my printer assembled I performed some upgrades on the QU-BD. First is the QU-BD Modification Kit from the MakerSlide store. Secondly I hobbed the stock raptor gear with a small tap in my electric hand drill.

QU-BD overheating jam - There is a fan and heatsink on the extruder. I wired it (incorrectly) to the Azteeg X1 fan input, making it configurable in gcode (M106 and M107). My slic3r configuration toggled the fan on and off, so occasionally the cold-end of the extruder was heating up too much causing a jam. My current solution is disabling the cooling option in slic3r, but eventually I will wire the fan directly to the 12v input.

QU-BD underheating jam - My printer is in the kitchen and there is a nice crossdraft going through the room now that it is nice outside. The crossdraft was causing the nozzle to drop below 165 degrees, when this happens things usually jam. I need to wrap the hot end in some sort of insulation which will hopefully fix this problem.

QU-BD slicer jam - While printing the nautilus near thing I was noticing frequent jams during the infill stage. The thing about this object was that there was very little amount of infill needed so the filament moved very slowly. My best guess is that the filament was sitting in one place so long that it heated up too high in the extruder which caused the jam. After reconfiguring slic3r to leave the object hollow there were no more jams on this print.

Pronterface vs. Repetier-host - This could probably be a blog post on its own. They both work but suffice to say that repetier-host is leaps and bounds ahead of pronterface in terms of usability. The one problem I had was that repetier-host allows you to configure the controller buffer size, the default is 63 which causes stuttering when printing complex surfaces with short line segments. I upped this value to 127 when I was 75% finished with the owl print (below) and you can tell just from looking at the surface of the model where I made that change because the surface quality improved dramatically. I just wish I had found that setting before printing all those feathers!

This owl is my longest print to date at 3 1/2 hours. This print was running while a draft was running past the printer, I probably fixed 5 or 6 jams while it printed which caused a several noticeable defects (most of them on the owls back).
3D Prints

After many attempts I finally got the Nautilus Gear to print. Now that everything is dialed in I could print one out in about an hour (~12 minutes for the two clips and ~18 minutes per gear).
3D Prints