1
$\begingroup$

I work with Fusion360 for designing lots of things. Recently I learned how to work with parameters that I can easily modify all at once, allowing to pretty much make easily customizable pieces.

Now, Thingiverse wants customizer pieces in the shape of .SCAD files, and some people just can't work with Fusion360 (.F3D) or proper .STEP files that can be imported by most CAD programs.

I have no experience with OpenSCAD. Can I import my .STEP into openSCAD, retain my parameters and export it as a .SCAD, and if yes, how?

$\endgroup$

3 Answers 3

3
$\begingroup$

Even though OpenSCAD can import a variety of formats, the file structure will not be accepted by Thingiverse in the manner presented by the OP.

OpenSCAD is a text-based description language. One creates parameters assigned to specific aspects of a model and implements those parameters to create the desired shapes/components by typing in a text editor. The native editor for OpenSCAD provides for some management, but notepad or equivalent would work just as well.

The file format of OpenSCAD is text. None of the CAD type modeling programs will provide equivalent text output.

For your objective, you'd have to learn the basics of OpenSCAD (not particularly difficult) and reference the parameters in the STEP files, then assign them to the appropriate labels in OpenSCAD.

If you have particularly complex designs, it can be a handful. It can also be rewarding when you change a parameter as a test and the complete model follows as expected.

$\endgroup$
3
  • $\begingroup$ I find pure text based input a PITA - and never worth the effort. $\endgroup$
    – Trish
    Commented Mar 27, 2020 at 18:40
  • 4
    $\begingroup$ I find anything I can't edit as pure text a PITA and never worth the effort - the effort ends up being all wasted when you want to change something and have to start over. $\endgroup$ Commented Mar 28, 2020 at 1:00
  • $\begingroup$ WIth that said, though, I think there should be some reasonable way to automate conversion of these formats into clean, editable OpenSCAD source. It just might (or rather almost certainly will) take some programming (in whatever language you prefer) to do it. $\endgroup$ Commented Mar 28, 2020 at 1:02
3
$\begingroup$

Actually there's a solution, albeit not directly from within openscad. I've just found this:

https://github.com/agordon/openscad-step-reader/tree/master

You will need to install or build yourself opencascade, and then it's a matter of running a command line tool to convert a .step to a .scad file.

I've just done it to be able to import a Thorlabs designed optomechanical item into scad and it works swell.

./openscad-step-reader --stl-scad RM1B-Step.step > RM1B-Step.scad

Then open the converted .scad file. If you want to try, the item can be seen here, get the step file from the list of document.

The result in openscad:

enter image description here

$\endgroup$
2
$\begingroup$

I managed to get openscad-step-reader to compile, but I had to jump through a few hoops:

  1. Run the apt-get install command from the beginning of the Makefile:
    apt-get install libocct-data-exchange-dev libocct-draw-dev libocct-foundation-dev libocct-modeling-algorithms-dev libocct-modeling-data-dev libocct-ocaf-dev libocct-visualization-dev libtbb-dev

  2. Ignore anything to do with cmake. I can get cmake to work by creating a CMakeLists.txt file, but I couldn't get the Makefile it generates to work.

  3. Edit triangle.h and replace

    • ostream with std::ostream [2 changes]
    • endl with std::endl [3 changes]
  4. Edit openscad-step-reader.cpp and replace

    • endl with std::endl [1 change]
  5. Edit explore-shape.cpp and add

    • #include <GeomAbs_SurfaceType.hxx>
    • #include <BRepAdaptor_Surface.hxx>
  6. Edit the Makefile and change

    • 7.3.0 to 7.5.2 [2 changes] (I realise a better solution would be desirable for this!)
  7. Run make. The .o files should be created, but the cc command will fail (after a longish time), citing 'undefined reference' 783 times

  8. Copy the cc command that was printed whilst running make, and put all the .o files before all the -l arguments, like this:

cc openscad-step-reader.o tessellation.o openscad-triangle-writer.o explore-shape.o -lTKSTL -lTKXDESTEP -lTKBinXCAF -lTKXmlXCAF -lTKXDEIGES -lTKXCAF -lTKIGES -lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKXSBase -lTKStd -lTKStdL -lTKXml -lTKBin -lTKXmlL -lTKBinL -lTKCAF -lTKXCAF -lTKLCAF -lTKCDF -lTKMeshVS -lTKOpenGl -lTKV3d -lTKService -lTKXMesh -lTKMesh -lTKOffset -lTKFeat -lTKFillet -lTKHLR -lTKBool -lTKBO -lTKShHealing -lTKPrim -lTKTopAlgo -lTKGeomAlgo -lTKBRep -lTKGeomBase -lTKG3d -lTKG2d -lTKIGES -lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKXSBase -lTKStd -lTKStdL -lTKXml -lTKBin -lTKXmlL -lTKBinL -lTKCAF -lTKLCAF -lTKCDF -lTKMeshVS -lTKOpenGl -lTKV3d -lTKService -lTKXMesh -lTKMesh -lTKOffset -lTKFeat -lTKFillet -lTKHLR -lTKBool -lTKBO -lTKShHealing -lTKPrim -lTKTopAlgo -lTKGeomAlgo -lTKBRep -lTKGeomBase -lTKG3d -lTKG2d /usr/lib/x86_64-linux-gnu/libTKMath.so.7.5.2 /usr/lib/x86_64-linux-gnu/libTKernel.so.7.5.2 -lfreetype -lpthread -lrt -lstdc++ -ldl -lm   -o openscad-step-reader

Now, for me, the program will compile. My system is running Ubuntu Focal Fossa 20.04.6 LTS. I contacted the author (Gordon Assaf) but he said he was no longer working on the project. For me, this has been a godsend, since it allows me to import .step files downloaded from the Swagelok website into my OpenSCAD design.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .