r/OpenPythonSCAD • • Jun 17 '25

osimport() error

openscad built from the latest openscad/openscad git commit. can show a cube just fine via python. but when I try to osimport() an stl, I get an error:

Running Python 3.13.3 without venv.
ERROR: Traceback (most recent call last):
  File "<string>", line 5, in <module>
NameError: name 'osimport' is not defined

Execution aborted

my file:

from openscad import *
fa=2
fs=.1

d=osimport("cs/2.stl")
d.show()
2 Upvotes

6 comments sorted by

View all comments

Show parent comment

2

u/gadget3D Jun 18 '25

I think when someone codes:

from <module> import *

he/she needs at least be more aware about the potentional risk,.

maybe python as an option to turn on such a warning ?

2

u/yahbluez Jun 18 '25

maybe but for examples it would be very very usefull to use a readable methode to import stuff.

Think about how much the readability increases by just using

import openscad as CAD

with that an interested reader would see what comes from the import and waht not.

This exaples are made to get people in not for people how already know eveything about your project.

This is only a little bit more typing but ads respect for python developement and the interested reader.

I guess you already knwo that I see your work in expanding the capability of openscad with python as a important step to enhance opencad.