bluemira.codes._polyscope

Classes

DefaultDisplayOptions

Polyscope default display options

Functions

show_cad(parts, part_options, labels, **kwargs)

The implementation of the display API for FreeCAD parts.

polyscope_setup([up_direction, fps, aa, transparency, ...])

Setup Polyscope default scene

_init_polyscope()

Initialise polyscope (just once)

add_features(→ tuple[list[polyscope.SurfaceMesh], ...)

Grab meshes of all parts to be displayed by Polyscope

clean_name(→ str)

Cleans or creates name.

Module Contents

class bluemira.codes._polyscope.DefaultDisplayOptions

Polyscope default display options

colour: bluemira.utilities.tools.ColourDescriptor
transparency: float = 0.0
material: str = 'wax'
tesselation: float = 0.05
wires_on: bool = False
wire_radius: float = 0.001
smooth: bool = True
property color: str

See colour

Return type:

str

bluemira.codes._polyscope.show_cad(parts: bluemira.codes._freecadapi.apiShape | list[bluemira.codes._freecadapi.apiShape], part_options: list[dict], labels: list[str], **kwargs)

The implementation of the display API for FreeCAD parts.

Parameters:
  • parts (bluemira.codes._freecadapi.apiShape | list[bluemira.codes._freecadapi.apiShape]) – The parts to display.

  • part_options (list[dict]) – The options to use to display the parts.

  • labels (list[str]) – Labels to use for each part object

  • **kwargs – options passed to polyscope

bluemira.codes._polyscope.polyscope_setup(up_direction: str = 'z_up', fps: int = 60, aa: int = 1, transparency: str = 'pretty', render_passes: int = 2, gplane: str = 'none')

Setup Polyscope default scene

Parameters:
  • up_direction (str) – ‘x_up’ The positive X-axis is up. ‘neg_x_up’ The negative X-axis is up. ‘y_up’ The positive Y-axis is up. ‘neg_y_up’ The negative Y-axis is up. ‘z_up’ The positive Z-axis is up. ‘neg_z_up’ The negative Z-axis is up.

  • fps (int) – maximum frames per second of viewer (-1 == infinite)

  • aa (int) – anti aliasing amount, 1 is off, 2 is usually enough

  • transparency (str) – the transparency mode (none, simple, pretty)

  • render_passes (int) – for transparent shapes how many render passes to undertake

  • gplane (str) – the ground plane mode (none, tile, tile_reflection, shadon_only)

bluemira.codes._polyscope._init_polyscope()

Initialise polyscope (just once)

bluemira.codes._polyscope.add_features(labels: list[str], parts: bluemira.codes._freecadapi.apiShape | list[bluemira.codes._freecadapi.apiShape], options: dict | list[dict]) tuple[list[polyscope.SurfaceMesh], list[polyscope.CurveNetwork]]

Grab meshes of all parts to be displayed by Polyscope

Parameters:
  • parts (bluemira.codes._freecadapi.apiShape | list[bluemira.codes._freecadapi.apiShape]) – parts to be displayed

  • options (dict | list[dict]) – display options

  • labels (list[str])

Return type:

Registered Polyspline surface meshes

bluemira.codes._polyscope.clean_name(label: str, index_label: str) str

Cleans or creates name. Polyscope doesn’t like hashes in names, repeat names overwrite existing component.

Parameters:
  • label (str) – name to be cleaned

  • index_label (str) – if name is empty -> {index_label}: NO LABEL

Return type:

name