![]() Recursively import OpenSCAD code by calling import_scad() with a directory argument.įrom solid2 import * # MCAD is OpenSCAD's most common utility library: # If it's installed for OpenSCAD (on MacOS, at: ``$HOME/Documents/OpenSCAD/libraries``) mcad = import_scad ( 'MCAD' ) # MCAD contains about 15 separate packages, each included as its own namespace print ( dir ( mcad )) # => mount = mcad. Your_file.py from solid2 import * scadfile = import_scad ( '/path/to/scadfile.scad' ) b = scadfile. Relative paths will check the current location designated in OpenSCAD library directories. Use solid2.import_scad(path) to import OpenSCAD code. Py_scad_obj.save_as_scad() from Python will load the object in theĪlternately, you could call OpenSCAD’s command line and render Reload and Compile’ is checked in the OpenSCAD IDE, running If filepath.scad is open in the OpenSCAD IDE and Design => ‘Automatic Or: call py_scad_obj.save_as_scad("filepath.scad") to store Uses parentheses with comma-delimited lists.Ĭube(10), # Note the comma between each element!Ĭall py_scad_obj.as_scad() to generate SCAD code. Generates this OpenSCAD code: difference ()) to create its tree. ![]() This Python code: from solid2 import * d = difference ()( cube ( 10 ), sphere ( 15 ) ) d. Generates valid OpenSCAD code from Python code with minimal overhead. SolidPython is a generalization of Phillip Tiefenbacher’s openscad ![]() If you switch from the regular SolidPython:master branch to this branch, have aĪnimation, Customizer, custom Fonts, ImplicitCad, Extensions ![]()
0 Comments
Leave a Reply. |