
- OPENSCAD SCREW THREADS INSTALL
- OPENSCAD SCREW THREADS CODE
The best way to learn how SolidPython works is to look at the includedĮxample code.
OPENSCAD SCREW THREADS CODE
Scad_render_to_file (b, 'out_file.scad') Example Code # use() puts the module `box()` into the global namespace They pollute the global namespace, though, and you may have better luck with import_scad(),
OpenSCAD has the use() and include() statements for importing SCAD code, and SolidPython has them, too. Scad_render_to_file (mount, 'motor_mount_file.scad') # MCAD contains about 15 separate packages, each included as its own namespace # If it's installed for OpenSCAD (on MacOS, at: `` $HOME/Documents/OpenSCAD/libraries``) # MCAD is OpenSCAD 's most common utility library:
Recursively import OpenSCAD code by calling import_scad() with a directory argument. Scadfile = import_scad( '/path/to/scadfile.scad') Relative paths willĬheck the current location designated in OpenSCAD library directories _. Use solid.import_scad(path) to import OpenSCAD code. Scad_render_to_file() 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 scad_render_to_file(py_scad_obj, filepath.scad) to store Uses parentheses with comma-delimited lists.Ĭube(10), # Note the comma between each element!Ĭall scad_render(py_scad_obj) to generate SCAD code. OpenSCAD uses curly-brace blocks () to create its tree. Include SolidPython at the top of your Python file:įrom solid.utils import * # Not required, but the utils module is useful OPENSCAD SCREW THREADS INSTALL
Install current master straight from Github: Where you can easily control dependencies for a given project) (You may need to use sudo pip install solidpython, depending on external libraries (images! 3D geometry! web-scraping!.mutable, slice-able list and string types.That doesn't seem like such a savings, but the following SolidPythonĬode is a lot shorter (and I think clearer) than the SCAD code it compiles to:ĭ = cube( 5) + right( 5)(sphere( 5)) - cylinder(r= 2, h= 6)īecause you're using Python, a lot of things are easy that would be hard Valid OpenSCAD code from Python code with minimal overhead. SolidPython is a generalization of Phillip Tiefenbacher's openscad Directions: (up, down, left, right, forward, back) for arranging things: _.