Skip to main content

Miscellaneous Notes on OpenScad

Importing IGES/STL into openSCAD/solidpython... I had some solid models in the IGES format that I wished to import into openSCAD, but openSCAD doesn't suport IGES. How to do the import?

Use FreeCAD to import the IGES model. From FreeCAD, export the model as STL. Let's call the file sample.stl.

Via openSCAD Only

Create an openSCAD file calles sample.scad which imports the STL file. It is a one-liner that contains the single line: import("./sample.stl");.

Start openSCAD and open sample.scad. You are done.

Via solidPython

Here is how to do the same thing using solidPython. Create a file named sample.py, which contains the following solidPython code:

#!/usr/bin/env python

import sys

sys.path.append('../SolidPython-master')

from solid import *
from solid.utils import *

# load the stl file.  the variable ``sample`` will contain
# the object when the load is complete
sample = import_stl('./sample.stl')
# the object can then be maniuplated, e.g.:
relocated = translate([5,-5,0])(sample)

# Once you've done what you want to do to the stl file,
# render it as openSCAD.
scad_render_to_file(relocated, './sample.scad')