layerview.visualization.nodes.build_area module

Build area node generation.

class layerview.visualization.nodes.build_area.BoundingBoxNodeBuilder[source]

Bases: NodeBuilder

Build area bounding box node builder

_AXIS_VECTOR_LENGTH_RATIO = 0.25
_AXIS_VECTOR_LINE_THICKNESS = 5
_COLOR_AXIS_X = (1, 0, 0, 1)
_COLOR_AXIS_Y = (0, 1, 0, 1)
_COLOR_AXIS_Z = (0, 0, 1, 1)
_COLOR_BOUNDING_BOX_DEFAULT = (0.3, 0.3, 0.3, 1)
_GEOM_VERTEX_FORMAT = [ vertex(3f) color(4b) ]
_abc_impl = <_abc_data object>
classmethod _get_geom_node_axis_vectors(size: LVector3d, length_ratio: float = 0.25) GeomNode[source]

Generate Geom

Parameters:
  • size (LVector3d) – Bounding box size.

  • length_ratio (float) – Length ratio of colored lines to respective bounding box lengths.

Returns:

GeomNode for colored axis vectors LineSegs.

Return type:

GeomNode

classmethod _get_geom_vertex_data(size: LVector3d, name: str) GeomVertexData[source]

Generate GeomVertexData for the bounding box.

Parameters:
  • size (LVector3d) – Bounding box size.

  • name (str) – Name for generated GeomVertexData.

Returns:

Bounding box GeomVertexData.

Return type:

GeomVertexData

static _get_primitive() GeomLines[source]

Generate GeomLines primitive for bounding box lines.

classmethod build_node(size: LVector3d, name: str) NodePath[source]

Build build area bounding box NodePath.

Parameters:
  • size (LVector3d) – Build area size.

  • name (str) – Name for the returned NodePath.

Returns:

Built build plate NodePath.

Return type:

NodePath

class layerview.visualization.nodes.build_area.BuildAreaNodeBuilder[source]

Bases: NodeBuilder

Build area node builder.

_abc_impl = <_abc_data object>
static _size_max_elem_wise(size: LVector3d, size_min: LVector3d) LVector3d[source]

Returns element-wise maximum between size and size_min.

static build_node(loader: Loader, size: LVector3d | None = None, size_min: LVector3d | None = None, name: str = 'build_area') NodePath[source]

Build build area NodePath.

Parameters:
  • loader (Loader) – Panda3D asset loader.

  • size (LVector3D) – Build area size.

  • size_min (Optional[LVector3D]) – Minimum allowed builder area size. Serves as bottom limit on a selective, per-axis basis.

  • name (str) – Name for the returned NodePath.

Returns:

Built build area NodePath.

Return type:

NodePath

class layerview.visualization.nodes.build_area.BuildPlateNodeBuilder[source]

Bases: NodeBuilder

Build plate node builder.

_GEOM_VERTEX_FORMAT_GRID = [ vertex(3f) color(4b) ]
_GRID_COLOR = (0, 0, 0, 1)
_GRID_SPACING = 10
_PATH_TEXTURE = Filename('/home/docs/checkouts/readthedocs.org/user_builds/layerview/envs/latest/lib/python3.8/site-packages/layerview/visualization/nodes/assets/textures/layerview.png')
_TEXTURE_OPACITY = 0.3
_TEXTURE_SCALE = 0.75
_VERTEX_FORMAT_PLATE = [ vertex(3f) normal(3f) color(4b) ]
_abc_impl = <_abc_data object>
classmethod _get_geom_data_grid_x(build_plate_size: LVector2d, grid_spacing: float = 10, name: str = '') GeomVertexData[source]

Generate GeomVertexData for build plate grid in X axis.

Parameters:
  • build_plate_size (LVector2d) – Build plate size.

  • grid_spacing (float) – Grid spacing; distance between successive grid lines.

  • name (str) – Generated GeomVertexData name.

classmethod _get_geom_data_grid_y(build_plate_size: LVector2d, grid_spacing: float = 10, name: str = '') GeomVertexData[source]

Generate GeomVertexData for build plate grid in Y axis.

Parameters:
  • build_plate_size (LVector2d) – Build plate size.

  • grid_spacing (float) – Grid spacing; distance between successive grid lines.

  • name (str) – Generated GeomVertexData name.

static _get_geom_data_plate(build_plate_size: LVector2d, name: str = '') GeomVertexData[source]

Generate build plate GeomVertexData.

Parameters:
  • build_plate_size (LVector2d) – Build plate size.

  • name (str) – Name for the generated GeomVertexData.

classmethod _get_node_plate(loader: Loader, build_plate_size: LVector2d, name: str = '') NodePath[source]

Generate the textured build plate NodePath.

This NodePath’s only purpose is to display the app’s logo.

Parameters:
  • loader (Loader) – Panda3D asset loader.

  • build_plate_size (LVector2d) – Builder plate size.

  • name (str) – Name for the generated NodePath.

static _get_primitive_linestrips(line_count: int) GeomPrimitive[source]

Generate GeomLinestrips primitive for build plate grid.

Parameters:

line_count (int) – Line count for the generated GeomLinestrips primitive.

Returns:

Generated primitive.

Return type:

GeomLinestrips

classmethod build_node(loader: Loader, build_plate_size: LVector2d, grid_spacing: float = 10, name: str = '') NodePath[source]

Build build area NodePath.

Parameters:
  • loader (Loader) – Panda3D asset loader.

  • build_plate_size (LVector2D) – Build plate size.

  • grid_spacing (float) – Build plate grid spacing. Defaults to _GRID_SPACING.

  • name (str) – Name for the returned NodePath.

Returns:

Built build plate NodePath.

Return type:

NodePath