Skip to main content

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.

Release files for viewscad 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for viewscad 0.2.0
File Size Uploaded
viewscad-0.2.0.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for viewscad 0.2.0
File Interpreter ABI Platform
viewscad-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.6 kB

Release files / viewscad-0.2.0.tar.gz

Download URL viewscad-0.2.0.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7a3309c48ed9e48e4c3db44b6f0e38c2f6022b8521a4555a7aeddac87ca3bebb
BLAKE2b-256 checksum
How to use checksums
24b3ddc85d1c210a8dc44df1db4619ea816ac5ee9bbd3fb4c0a715a96b9f1f8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Release files / viewscad-0.2.0-py3-none-any.whl

Download URL viewscad-0.2.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00b72aeda1d35c398f7b3a2dc82b78ac19cd38064cb179fb465499d2faaf698a
BLAKE2b-256 checksum
How to use checksums
f892571fd0e02fe9bd8594c24ec196f3d30280facf0e556c897de34b58a16499
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page