Monday, 17 September 2012

STL to STEP...

Although there is significant amounts of hardware about the house, the kids have only shown marginal interest in computers and electronics for other than playing Minecraft with and occasionally homework. Along with Huxley #710, in an attempt to address this issue, we recently acquired a Raspberry PI for my two children to play with. Of course it needs a case and Thingiverse would be the place to go. But....
Raspberry PI E2712RSV1.0B1.1

I downloaded Thing 28070 and printed it out
It would seem our Raspberry PI is unlike others, specifically: -
  • The pitch of the audio and video connectors is different
  • The PCB is 1 mm wider
  • The network connector is longer
  • There is a white plastic tab on the underside of the USB connectors which fouls
On closer inspection of the pictures attached to Thing 28070 it would seem that others cases don't fit well, perhaps due to the network connector. It's unclear in the image for Thing 28070 that it cleared the case correctly in the original version.

Essentially this means that the cases on Thingiverse would not work out of the box. The problem with Thingiverse is that most people post STL files which are surface models (not easily manipulated) and those that post source files often post SKP (Goolge Sketchup) or OpenScad, neither of which I use or are 'portable'. Of course designing a new case is entirely possible but in doing so the efforts of others are lost. To this end I decided to revisit the use of a CAD file converter.

Sanity warning
CAD conversion tools should be avoided where ever possible as there are always translation errors. These errors result from things as simple as rounding up or down of dimensions, to complex issues such as how geometry should be interpreted and subsequently represented. I tread here where angels fear to walk!

The tool that popped out of a Goolge search for conversion of STL files to STEP files was InStep V2.0 by Solveering. I prefer STEP files as once they import into my CAD software they are quite manageable (modifiable), probably resulting from the fact that its format is defined in an ISO standard. Suitably downloaded and installed I threw the file at InStep and checked out the error report in InStep. It was quite an extensive list of errors and InStep's STL mesh correction tools were unable to fix the issue so it might be a dead end.

Issues with STL files are not particularly surprising as exported STL files often have errors and junk in them. The easiest tool to fix most STL files errors is NetFab which just about any one can use. Certainly it has fixed any STL's I have downloaded from Thingiverse or created for printing with Pronterface. In this instance though it was too tough a nut to crack. I had one more thing to try before starting from scratch.

MeshLab with Thing 28070

A more sophisticated tool I found some time ago is MeshLab. This has quite a number of menu options and I watched some videos on YouTube to see what it could do. Meshlab has lots of clean up options and the ability to create a script which can be used on imported STL files. Here is a copy of the script (.mlx file) I used to clean up Thing 28070:

filter name="Remove Duplicate Faces"
filter name="Remove Duplicated Vertex"
filter name="Merge Close Vertices" param max="1.09781" min="0" name="Threshold" type="RichAbsPerc" value="0.15489"


Having run this script on Thing 28070 and exported the updated STL from MeshLab, I then re-imported it into InStep and checked the error report. Here is a copy of the report from InStep

*** InStep V2.0 Data Summary ***
 File Name: RaspberryPi_v15 ML.stl
 File Path: C:\28070 - Pi Case
 Report Location: C:\Temp\tmp148.txt

 Independent Bodies        : 2
 Total number of Vertices : 2658
 Total number of Edges    : 8142

 ### Features/Facets for the Bodies ###
 Body 1 : 4202
 Body 2 : 1226

 ### Degenerate Features ###
 None found

 ### Edge Issues ###
 No Issues detected

 ### Vertex Proximity ###

 Point 0 to Point 1 Distance is smallest at 0.024337

Using the Export option from from InStep I created a STEP file, then imported the STEP file it into my CAD software and to my surprise it worked!
InStep V2.0 with Thing 28070

In working with the files in my CAD system there have been some minor issues. It seems that the STEP file has to have operations performed on it separately from natively generated geometry. So a cut may have to be performed in two operations. However for the most part it proved very robust.

Imported Thing 28070 STEP file generated by InStep
Of course you're not interested in the Thing I created because now you can easily create your own custom version!

I can't promise the next STL will 'fix' so readily but if Solveering keep this tool available, it could be a very useful facility to have available.

2016 Edit :
 - Solveering upgraded the software.
 - Do check out my later post on FreeCad

Inspired by Thing 24721 and Thing 28070 is Thing 30646
Thing 30646 bottom with SD card protector
Thing 30646 top with cut out for network connector
Thing 30646 assembly (Thing 21718)
Thing 30646 Assembly

Thing 30646 with Raspberry PI (RS Version B1.1)

Rendering of PCB STEP file Thing 21718

Thing 30646 RS Raspberry PI case


  1. Thank you for the pointer about InStep. I have exactly the same problem with .STL files on Thingiverse. After an extensive search I didn't find any other tools to convert to STEP or IGES. I need this formats for the very useful Fusion 360 cloud based CAD tool:

  2. Hello,

    InSTEP does seem like a useful program, but a visit to the website seems to indicate it will become a commercial software in the near future. For personal and hobby use I find it difficult to justify purchase of such software.

    About Fusion 360, well as a Linux (Ubuntu) user I am not trusting of free commercial and/or cloud-based products. You put yourself and your designs at the mercy of the whim of a company which has objectives that may conflict with your needs. Look at what happened with Tinkercad: it's progressively shutting down, even for paying customers.

    Nicolinux, your extensive search was not completely extensive: there is actually a free and open source 3D CAD software that can convert STL to STEP or IGES: FreeCAD. FreeCAD is available for Windows, Linux and Mac, although the Mac version may not be as up-to-date and may suffer from Mac-specific bugs (none of the developers are Mac-users, the Mac builds are provided by the community and due to few Mac users no Mac-specific bug hunting and solving is done).

    I imported thing 28070 into FreeCAD and was successful in converting the STL into a solid shape. Although for that FreeCAD requires a single body shape, so I had to use FreeCAD's mesh tools to delete the lower cover. After that I could convert the top cover to solid, clean its planar faces up and export to STEP (a process which will have to be repeated for the lower cover). Of course in my case STEP export is irrelevant because I do my modeling in FreeCAD, which is fully parametric. So I could directly edit the model by "plugging" holes and cutting out holes elsewhere.