Skip to main content

Jupyter renderer for the OpenSCAD & SolidPython constructive solid geometry systems

Project description

ViewSCAD: CAD in Jupyter

ViewSCAD is a module that renders within a Jupyter notebook 3D objects described in the OpenSCAD language, or described using the SolidPython module. It provides a workflow for CAD design completely within the Jupyter notebook.

Installation

ViewSCAD utilizes the openscad executable to render objects, and as such, OpenSCAD must be installed on your system.

ViewSCAD installs simply with pip:

pip install viewscad

ViewSCAD uses the pythreejs notebook extension to render the 3D graphics. If you intend to use jupyter notebook, you should be all set. However, if you intend to use jupyter lab, additional steps are necessary to get pythreejs working in the lab. Firstly, you must install node.js and npm. Then you must install the lab extensions:

jupyter labextension install @jupyter-widgets/jupyterlab-manager

Setup and Usage

See the OpenSCAD and SolidPython pages for how to use these languages to represent geometric objects.

The following shows how to use ViewSCAD to render a SolidPython object in Jupyter: solidpython example

ViewSCAD attempts to locate your openscad executable, based on your platform, but failing that, you can set the OPENSCAD_EXEC environment variable to point at your openscad command-line executable, or pass it in the constructor of the renderer:

renderer = viewscad.Renderer(openscad_exec='path_of_my_openscad')

You can also render OpenSCAD code: openscad example

The renderer can also create an .STL file directly by simply adding an outfile keyword:

r.render(c, outfile='my_thing.stl')

Intropection

By double-clicking on a rendered object, you can select faces, edges, and vertices, and learn their indices. This allows you to use several useful utilities, like Renderer.rotate_face_down() put orient the object with a particular face downward, or Renderer.place_on(), which lets you place one object upon another: introspection example

Acknowledgements

Thanks to Evan Jones for help creating the PyPI package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
viewscad-0.2.0-py3-none-any.whl (15.2 kB) Copy SHA256 hash SHA256 Wheel py3
viewscad-0.2.0.tar.gz (12.3 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page