pygfx.objects.Line

class pygfx.objects.Line(geometry: Geometry | None = None, material: Material | None = None, *, visible: bool = True, render_order: float = 0, render_mask: str | int = 'auto', name: str = '')

Bases: WorldObject

An object representing a line using a list of vertices (3D positions).

Some materials will render the line as a continuous line, while other materials will consider each pair of consecutive points a segment.

The picking info of a Line (the result of renderer.get_pick_info()) will for most materials include vertex_index (int) and segment_coord (float, sub-segment coordinate).

Parameters:
  • geometry (Geometry) – The data defining the shape of the object. Must contain at least a “positions” buffer. Depending on the usage of the material, can also include buffers “texcoords”, “colors”, and “sizes”.

  • material (Material) – The data defining the appearance of the object.

  • visible (bool) – Whether the object is visible.

  • render_order (int) – The render order (when applicable for the renderer’s blend mode).

  • render_mask (str) – Determines the render passes that the object is rendered in. It’s recommended to let the renderer decide, using “auto”.

  • position (Vector) – The position of the object in the world. Default (0, 0, 0).

Examples

Animation Mixer

Animation Mixer

Animations with glTF

Animations with glTF

Gizmo to transform world objects

Gizmo to transform world objects

Displaying an image in a scene

Displaying an image in a scene

Directional Shadow 1

Directional Shadow 1

Directional Shadow 2

Directional Shadow 2

Spotlight Shadow

Spotlight Shadow

Spotlights

Spotlights

Line Drawing

Line Drawing

Line Drawing Performance

Line Drawing Performance

Line plot

Line plot

Line Segments

Line Segments

Thick Lines

Thick Lines

Multi-Object Selection

Multi-Object Selection

Volume and Mesh Slicing 1

Volume and Mesh Slicing 1

Mesh and Volume Slicing 2

Mesh and Volume Slicing 2

Panzoom Camera

Panzoom Camera

Scene Overlay

Scene Overlay

Subplots 1

Subplots 1

Skinned Mesh

Skinned Mesh

Skinning Animation

Skinning Animation

Detached Bind Mode

Detached Bind Mode

Use a Skybox

Use a Skybox

Lights

Lights

Boundary Boxes

Boundary Boxes

Orbit Camera

Orbit Camera

Performance of drawing many Lines

Performance of drawing many Lines

High resolution screenshot

High resolution screenshot

Integrate Pygfx in Qt

Integrate Pygfx in Qt

Two Canvases

Two Canvases

Depth Overlay 1

Depth Overlay 1

Axes Helper 1

Axes Helper 1

Axis Helper 2

Axis Helper 2

Lines in 2D

Lines in 2D

Dashing

Dashing

Lines with different thicknesses

Lines with different thicknesses

Lines drawn with different thickness_space

Lines drawn with different thickness_space

Validate ruler

Validate ruler

Text anchor

Text anchor

Text direction

Text direction

Text size

Text size

Validate view offset

Validate view offset