Skip to content

API Reference

jupyterscad.view(obj, width=400, height=400, grid_unit=-1, outfile=None, openscad_exec=None)

View an OpenSCAD object.

Typical usage example:

>>> view(cube(3))

Parameters:

  • obj

    OpenSCAD object to visualize.

  • width (int, default: 400 ) –

    Visualization pixel width on page.

  • height (int, default: 400 ) –

    Visualization pixel height on page.

  • grid_unit (float, default: -1 ) –

    Grid cell size, 0 to disable, -1 for automatic.

  • outfile (Optional[Union[str, PathLike]], default: None ) –

    Name of stl file to generate. No stl file is generated if None.

  • openscad_exec (Optional[Union[str, PathLike]], default: None ) –

    Path to openscad executable.

Returns:

  • Renderer

    Rendering to be displayed.

Raises:

  • OpenSCADError

    An error occurred running OpenSCAD.

jupyterscad.view_stl(stl_file, width=400, height=400, grid_unit=-1)

View a stl.

Typical usage example:

>>> view_stl(cube(3))

Parameters:

  • stl_file (Union[str, PathLike]) –

    stl file to visualize.

  • width (int, default: 400 ) –

    Visualization pixel width on page.

  • height (int, default: 400 ) –

    Visualization pixel height on page.

  • grid_unit (float, default: -1 ) –

    Grid cell size, 0 to disable, -1 for automatic

Returns:

  • Renderer

    Rendering to be displayed.

jupyterscad.render_stl(obj, outfile, openscad_exec=None)

Render a stl from an OpenSCAD object.

Typical usage example:

>>> render_stl(cube(3), 'cube.stl')

Parameters:

  • obj

    OpenSCAD object to visualize.

  • outfile (Union[str, PathLike]) –

    Name of stl file to generate. No stl file is generated if None.

  • openscad_exec (Optional[Union[str, PathLike]], default: None ) –

    Path to openscad executable.

Raises:

  • OpenSCADException

    An error occurred running OpenSCAD.