bluemira.display.displayer
api for plotting using CAD backend
Classes
CAD viewer backends. |
|
The options that are available for displaying objects in 3D |
|
Displayer abstract class |
|
Mixin class to make a class displayable by imparting a show_cad method and options. |
|
CAD displayer for Components |
Functions
|
|
|
Validate the lists of parts and options, applying some default options. |
|
The CAD display API. |
|
Module Contents
- class bluemira.display.displayer.ViewerBackend(*args, **kwds)
Bases:
enum.EnumCAD viewer backends.
- FREECAD = 'bluemira.codes._freecadapi'
- POLYSCOPE = 'bluemira.codes._polyscope'
- get_module()
Load viewer module
- Returns:
The loaded module.
- Raises:
ModuleNotFoundError – Cannot find backend
FileNotFoundError – Cannot find backend
- bluemira.display.displayer.get_default_options(backend=ViewerBackend.FREECAD)
- Returns:
The default display options for the specified backend.
- class bluemira.display.displayer.DisplayCADOptions(backend=ViewerBackend.FREECAD, **kwargs)
Bases:
bluemira.display.tools.OptionsThe options that are available for displaying objects in 3D
- Parameters:
backend – the backend viewer being used
- __slots__ = ()
- _options
- bluemira.display.displayer._validate_display_inputs(parts, options, labels)
Validate the lists of parts and options, applying some default options.
- Returns:
A tuple containing the list of parts, list of options and list of labels.
- Raises:
DisplayError – Number of options not equal to number of parts
- bluemira.display.displayer.show_cad(parts: bluemira.geometry.base.BluemiraGeo | list[bluemira.geometry.base.BluemiraGeo] | None = None, options: DisplayCADOptions | list[DisplayCADOptions] | list[dict[str, float | str | None]] | None = None, labels: str | list[str] | None = None, backend: str | ViewerBackend = ViewerBackend.FREECAD, **kwargs)
The CAD display API.
- Parameters:
parts (bluemira.geometry.base.BluemiraGeo | list[bluemira.geometry.base.BluemiraGeo] | None) – The parts to display.
options (DisplayCADOptions | list[DisplayCADOptions] | list[dict[str, float | str | None]] | None) – The options to use to display the parts.
labels (str | list[str] | None) – Labels to use for each part object
backend (str | ViewerBackend) – Viewer backend
kwargs – Passed on to modifications to the plotting style options and backend
- class bluemira.display.displayer.BaseDisplayer(options: DisplayCADOptions | None = None, **kwargs)
Bases:
abc.ABCDisplayer abstract class
- Parameters:
options (DisplayCADOptions | None)
- _CLASS_DISPLAY_OPTIONS: ClassVar
- options
- abstract show_cad(objs, **kwargs)
Display a CAD object
- bluemira.display.displayer._get_displayer_class(part)
- Returns:
the displayer class for an object
- Raises:
DisplayError – Cannot display specific type
- class bluemira.display.displayer.DisplayableCAD
Mixin class to make a class displayable by imparting a show_cad method and options.
- _display_cad_options: DisplayCADOptions
- property display_cad_options: DisplayCADOptions
returns: the options that will be used to display the object.
- Return type:
- property _displayer: BaseDisplayer
returns: the options that will be used to display the object.
- Return type:
- show_cad(**kwargs) None
Default method to call display the object by calling into the Displayer’s display method.
- Returns:
The axes that the plot has been displayed onto.
- Return type:
axes
- class bluemira.display.displayer.ComponentDisplayer(options: DisplayCADOptions | None = None, **kwargs)
Bases:
BaseDisplayerCAD displayer for Components
- Parameters:
options (DisplayCADOptions | None)