bluemira.display.displayer ========================== .. py:module:: bluemira.display.displayer .. autoapi-nested-parse:: api for plotting using CAD backend Classes ------- .. autoapisummary:: bluemira.display.displayer.ViewerBackend bluemira.display.displayer.DisplayCADOptions bluemira.display.displayer.BaseDisplayer bluemira.display.displayer.DisplayableCAD bluemira.display.displayer.ComponentDisplayer Functions --------- .. autoapisummary:: bluemira.display.displayer.get_default_options bluemira.display.displayer._validate_display_inputs bluemira.display.displayer.show_cad bluemira.display.displayer._get_displayer_class Module Contents --------------- .. py:class:: ViewerBackend(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: bluemira.display.displayer.ViewerBackend :parts: 1 :private-bases: CAD viewer backends. .. py:attribute:: FREECAD :value: 'bluemira.codes._freecadapi' .. py:attribute:: POLYSCOPE :value: 'bluemira.codes._polyscope' .. py:method:: get_module() Load viewer module :returns: The loaded module. :raises ModuleNotFoundError: Cannot find backend :raises FileNotFoundError: Cannot find backend .. py:function:: get_default_options(backend=ViewerBackend.FREECAD) :returns: The default display options for the specified backend. .. py:class:: DisplayCADOptions(backend=ViewerBackend.FREECAD, **kwargs) Bases: :py:obj:`bluemira.display.tools.Options` .. autoapi-inheritance-diagram:: bluemira.display.displayer.DisplayCADOptions :parts: 1 :private-bases: The options that are available for displaying objects in 3D :param backend: the backend viewer being used .. py:attribute:: __slots__ :value: () .. py:attribute:: _options .. py:function:: _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 .. py:function:: 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. :param parts: The parts to display. :param options: The options to use to display the parts. :param labels: Labels to use for each part object :param backend: Viewer backend :param kwargs: Passed on to modifications to the plotting style options and backend .. py:class:: BaseDisplayer(options: DisplayCADOptions | None = None, **kwargs) Bases: :py:obj:`abc.ABC` .. autoapi-inheritance-diagram:: bluemira.display.displayer.BaseDisplayer :parts: 1 :private-bases: Displayer abstract class .. py:attribute:: _CLASS_DISPLAY_OPTIONS :type: ClassVar .. py:attribute:: options .. py:method:: show_cad(objs, **kwargs) :abstractmethod: Display a CAD object .. py:function:: _get_displayer_class(part) :returns: the displayer class for an object :raises DisplayError: Cannot display specific type .. py:class:: DisplayableCAD Mixin class to make a class displayable by imparting a show_cad method and options. .. py:attribute:: _display_cad_options :type: DisplayCADOptions .. py:property:: display_cad_options :type: DisplayCADOptions returns: the options that will be used to display the object. .. py:property:: _displayer :type: BaseDisplayer returns: the options that will be used to display the object. .. py:method:: 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. :rtype: axes .. py:class:: ComponentDisplayer(options: DisplayCADOptions | None = None, **kwargs) Bases: :py:obj:`BaseDisplayer` .. autoapi-inheritance-diagram:: bluemira.display.displayer.ComponentDisplayer :parts: 1 :private-bases: CAD displayer for Components .. py:method:: show_cad(comps, **kwargs) :staticmethod: Display the CAD of a component or iterable of components :param comp: Component, or iterable of Components, to be displayed :type comp: Union[Iterable[Component], Component]