How to I assign an imported STl file to a variable, polygon, or otherwise manipulate it?


I have 2 STL files that I want to chop, rotate, and glue together. If I printed them and literally chopped and glued them together, I would be done. Very simple operations.

I imported them both into OpenSCAD, but I can't find docs or figure out a way to do anything to the STL files once they are imported. They imported fine. I don't know how to assign a variable name to the imported object, which I presume is the next step before I can rotate and move the objects around. I might be going in the wrong direction though, I don't know. usually during an import of a module you can assign a variable name, or instantiate it. Since the import also instantiates it, I'm at a loss for what to do next. I've programmed in a smattering of languages, but haven't touched OpenSCAD in ~3+ years.

When searching, I find a cornucopia of slightly related information like how to import a file from 2011, but nothing about how to work with it once it's been imported.


Posted 2020-04-11T00:19:57.243

Reputation: 702



One can create a module to import the respective STL files.

module bring_it_on_1() {



translate([-10, 20, 0])


Other modifiers can be used and will act on the STL file appropriately.


Posted 2020-04-11T00:19:57.243

Reputation: 8 399


The OpenSCAD forum has a discussion regarding this topic: which includes a link to a program to convert STL to OpenSCAD, which may reduce or eliminate the problem you experience.

– fred_dot_u – 2020-08-16T10:24:02.013