Skip to content

actors

ArrowGlyph

Bases: GlyphObject

Class representing the arrow as a 3D object.

Parameters:

Name Type Description Default
directed bool

If True arrow object will created. If False all tip settings will be ignored.

True
tip_resolution int

Number of triangles in the tip (min=1)

20
tip_length float

Length of the tip

0.25
tip_radius float

Radius of the tip

0.12
shaft_resolution int

Number of shaft edges (min=3)

20
shaft_radius int

Radius of the shaft

0.03

directed property writable

length property writable

shaft_radius property writable

shaft_resolution property writable

tip_length property writable

tip_radius property writable

tip_resolution property writable

__init__(directed=True, tip_resolution=20, tip_length=0.25, tip_radius=0.12, shaft_resolution=20, shaft_radius=0.03)

ScalarBarObject

Bases: SceneObject

Class for creating scalar bar for SceneObject.

actor = vtkScalarBarActor() instance-attribute

lookup_table property writable

number_of_labels property writable

orientation property writable

position property writable

ratio property writable

size property writable

ticklabel_size property writable

title property writable

title_size property writable

__init__()

write(filename)

SphereGlyph

Bases: GlyphObject

Class representing the sphere as a 3D object.

radius property writable

resolution property writable

size property writable

__init__(radius=0.05, resolution=10)

SurfaceObject

Bases: PolydataObject

selected_paths = [] instance-attribute

selected_point_ids = [] instance-attribute

__init__()

catch_event(picked_point_id, event=None, key=None, **kwargs)

Catch mouse button events.

Parameters:

Name Type Description Default
picked_point_id int

Picked point ID

required
event str

Mouse event name

None
key str

Currently pressed key name

None
**kwargs dict

Additional kwargs, for compability

{}

Returns:

Name Type Description
list list

Actors to represent selected object

close_loop()

Close loop on pressed L-key and Right Mouse Button.

Returns:

Name Type Description
list list[SphereGlyph | TubeObject]

Actors to show closed loop

hide_edges()

Hide edges of the surface.

select_loop(point_id)

Finds shortest path between last and current selected points Makes TubeObject to show selected loop lines.

Parameters:

Name Type Description Default
point_id int

Selected point's ID

required

Returns:

Name Type Description
list list[SphereGlyph | TubeObject]

SphereGlyph or TubeObject to show first selected point or loop's lines

select_point(point_id)

Method for selecting points usign S-key and Left Mouse Button.

Parameters:

Name Type Description Default
point_id int

Id of selected point

required

Returns:

Name Type Description
list list

Actors to represent selected points

show_edges(color=None, line_width=0.3, as_tube=False)

Set edge visibility of the surface.

Parameters:

Name Type Description Default
color str

Color of the edges

None
line_width float

Edges line width

0.3
as_tube bool

If true edges will be showed as tubes

False

stop_point_selection()

Method to finish selecting points usign S-key and Right Mouse Button.

Returns:

Name Type Description
list list

Actors to show selected points

undo_previous_path()

Method for removing the final part of the selected path up until the previous selected point using U-key and Left Mouse Button.

Returns:

Name Type Description
list list[SphereGlyph | TubeObject]

SphereGlyph or TubeObject to show first selected point or loop's lines

undo_previous_selection()

Method for removing previous selected point using U-key and Left Mouse Button.

Returns:

Name Type Description
list list[SphereGlyph | TubeObject]

Actors to represent selected points

TextObject

Bases: SceneObject

Represents a text object in a 3D scene.

Attributes:

Name Type Description
actor vtkBillboardTextActor3D

The VTK actor representing the text object.

text str

The text content of the object.

position tuple

The position of the object in 3D space.

font_size int

The font size of the text.

color tuple

The color of the text.

background_color tuple

The background color of the text.

actor = vtkBillboardTextActor3D() instance-attribute

background_color property writable

Get the background color of the text.

Returns:

Name Type Description
tuple tuple[int, int, int]

The background color as a tuple of (r, g, b) values.

bold property writable

Get the bold property of the text.

Returns:

Name Type Description
bool bool

True if bold, False otherwise.

color property writable

Get the color of the text.

Returns:

Name Type Description
tuple tuple[int, int, int]

The color as a tuple of (r, g, b) values.

font_size property writable

Get the font size of the text.

Returns:

Name Type Description
int int

The font size.

italic property writable

Get the italic property of the text.

Returns:

Name Type Description
bool bool

True if italic, False otherwise.

position property writable

Get the position of the object in 3D space.

Returns:

Name Type Description
tuple tuple[float, float, float]

The position as a tuple of (x, y, z) coordinates.

text property writable

Get the text content of the object.

Returns:

Name Type Description
str str

The text content.

__init__(font_size=12, color=(0, 0, 0))

TextObjects

Bases: SceneObject

Represents a collection of text objects in a 3D scene.

Attributes:

Name Type Description
text_objects list

A list of TextObject instances.

actors property

Get the VTK actors representing the text objects.

Returns:

Name Type Description
list list

A list of vtkBillboardTextActor3D instances.

text_objects = [] instance-attribute

__init__()

add_text(text, position, color, size)

Add a new text object to the collection.

Parameters:

Name Type Description Default
text str

The text content.

required
position tuple

The position of the object in 3D space.

required
color tuple

The color of the text.

required

TubeObject

Bases: PolydataObject

input_data property writable

mapper_input_connection = self.tube.GetOutputPort() instance-attribute

radius property writable

resolution property writable

tube = vtkTubeFilter() instance-attribute

__init__(resolution=6, radius=0.1)