Skip to content

View

The view action provides a web UI for displaying rendered models in your browser using OCP CAD Viewer. The UI server is started automatically. Models being viewed automatically re-render when model files are saved.

With the view command running, the UI is available at:

http://localhost:4040

Usage

bdbox model.py view
bdbox mypackage.mymodule view
python model.py view
python -m mypackage.mymodule view

Automatic re-render on save

With models from files (e.g. model.py), the viewer monitors the model file's directory for changes.

With models from module (e.g. mypackage.mymodule), the viewer monitors all imported files within the toplevel package namespace for changes. For example, if a model in mypackage.mymodule imports mypackage.othermodule, then changes within mypackage.othermodule will also cause the model to be re-rendered. This is useful for models with shared components that aren't within the model's own module, such as in monorepositories with shared parts or components.

Options

Optional arguments to view include:

  • --no-open-browser: Don't open a browser tab when starting the viewer
  • --export FILE: Save rendered model to FILE on each render

Note

For more information about file exports, see the export command documentation.

See all options with --help:

bdbox view --help  # Model not required for --help
bdbox view --help  # Model not required for --help
python model.py view --help
python -m mypackage.mymodule view --help

Parameters panel

The web UI displays a parameters panel

When your model defines parameters, controls for those parameters appear in the web UI's parameters panel. Adjust parameter values or select presets in the panel. The model re-renders automatically.

See the Parameter Panel documentation for details.