TextBatchPrimitive#

class ansys.stk.core.graphics.TextBatchPrimitive#

Bases: IPrimitive

Render one or more strings in the 3D scene. For best performance, avoid creating lots of batches with only a few strings each. See the Batching Performance Overview.

Overview#

set

Define the positions and text of strings in a text batch. The strings are rendered in the primitive’s reference frame.

set_cartographic

For convenience. Defines the positions and text of strings in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling Set.

set_cartographic_with_optional_parameters

For convenience. Defines the positions, text, and optional parameters of strings in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling Set.

set_cartographic_with_optional_parameters_and_render_pass

For convenience. Defines the positions, text, and optional parameters of strings in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling Set.

set_partial

Update a subset of positions and/or text in a text batch.

set_partial_cartographic

For convenience. Updates a subset of positions and/or text in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling SetPartial.

set_partial_cartographic_with_indices_order

For convenience. Updates a subset of positions and/or text in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling SetPartial.

set_partial_cartographic_with_optional_parameters

For convenience. Updates a subset of positions, text, and/or per-string parameters in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling SetPartial.

set_partial_cartographic_with_optional_parameters_indices_order_and_render_pass

For convenience. Updates a subset of positions, text, and/or per-string parameters in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling SetPartial.

set_partial_with_indices_order

Update a subset of positions and/or text in a text batch.

set_partial_with_optional_parameters

Update a subset of positions, text, and/or optional per-string parameters in a text batch.

set_partial_with_optional_parameters_indices_order_and_render_pass

Update a subset of positions, text, and/or optional per-string parameters in a text batch.

set_with_optional_parameters

Define the positions, text, and optional parameters of strings in a text batch. The strings are rendered in the primitive’s reference frame.

set_with_optional_parameters_and_render_pass

Define the positions, text, and optional parameters of strings in a text batch. The strings are rendered in the primitive’s reference frame. renderPassHint is provided for efficiency.

align_to_pixel

Get or set whether the screen space position of each string is aligned to a pixel.

bounding_sphere_scale

Get or set the scale applied to the radius of this primitive’s bounding sphere.

distance_display_condition_per_string

Get or set a distance display condition that is evaluated per string in the text batch during rendering. This is different than display condition, which is evaluated once for the entire text batch…

font

Get the font used to render the text batch.

outline_color

Get or set the text’s outline color.

outline_translucency

Get or set the text’s outline translucency. Translucency is between 0 and 1, where 0 is opaque and 1 is transparent.

per_item_picking_enabled

Get or set whether individual text indices will be included in the pick results returned from the scene’s Pick method. Each text index that is picked will be returned as a batch primitive index.

render_in_screen_space

Get or set whether the primitive is positioned and rendered in screen space coordinates.

set_hint

Get the primitive’s set hint. See the Set Hint Performance Overview for selecting an appropriate value to construct the primitive with.

texture_filter

Get or set the filter used to filter the texture-based font.

Examples#

Draw a new Text Primitive

# Scenario scenario: Scenario object
manager = scenario.scene_manager
font = manager.initializers.graphics_font.initialize_with_name_size_font_style_outline(
    "MS Sans Serif", 24, FontStyle.BOLD, True
)
textBatch = manager.initializers.text_batch_primitive.initialize_with_graphics_font(font)
textBatch.set_cartographic("Earth", [[0], [0], [0]], ["Example Text"])  # Lat, Lon, Alt
manager.primitives.add(textBatch)

Import detail#

from ansys.stk.core.graphics import TextBatchPrimitive

Property detail#

property TextBatchPrimitive.align_to_pixel: bool#

Get or set whether the screen space position of each string is aligned to a pixel.

property TextBatchPrimitive.bounding_sphere_scale: float#

Get or set the scale applied to the radius of this primitive’s bounding sphere.

property TextBatchPrimitive.distance_display_condition_per_string: DistanceDisplayCondition#

Get or set a distance display condition that is evaluated per string in the text batch during rendering. This is different than display condition, which is evaluated once for the entire text batch…

property TextBatchPrimitive.font: GraphicsFont#

Get the font used to render the text batch.

property TextBatchPrimitive.outline_color: Color#

Get or set the text’s outline color.

property TextBatchPrimitive.outline_translucency: float#

Get or set the text’s outline translucency. Translucency is between 0 and 1, where 0 is opaque and 1 is transparent.

property TextBatchPrimitive.per_item_picking_enabled: bool#

Get or set whether individual text indices will be included in the pick results returned from the scene’s Pick method. Each text index that is picked will be returned as a batch primitive index.

property TextBatchPrimitive.render_in_screen_space: bool#

Get or set whether the primitive is positioned and rendered in screen space coordinates.

property TextBatchPrimitive.set_hint: SetHint#

Get the primitive’s set hint. See the Set Hint Performance Overview for selecting an appropriate value to construct the primitive with.

property TextBatchPrimitive.texture_filter: TextureFilter2D#

Get or set the filter used to filter the texture-based font.

Method detail#

TextBatchPrimitive.set(self, positions: list, text: list) None#

Define the positions and text of strings in a text batch. The strings are rendered in the primitive’s reference frame.

Parameters:

positions : list

text : list

Returns:

None

TextBatchPrimitive.set_cartographic(self, central_body: str, positions: list, text: list) None#

For convenience. Defines the positions and text of strings in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling Set.

Parameters:

central_body : str

positions : list

text : list

Returns:

None

TextBatchPrimitive.set_cartographic_with_optional_parameters(self, central_body: str, positions: list, text: list, optional_parameters: TextBatchPrimitiveOptionalParameters) None#

For convenience. Defines the positions, text, and optional parameters of strings in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling Set.

Parameters:

central_body : str

positions : list

text : list

optional_parameters : TextBatchPrimitiveOptionalParameters

Returns:

None

TextBatchPrimitive.set_cartographic_with_optional_parameters_and_render_pass(self, central_body: str, positions: list, text: list, optional_parameters: TextBatchPrimitiveOptionalParameters, render_pass_hint: RenderPassHint) None#

For convenience. Defines the positions, text, and optional parameters of strings in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling Set.

Parameters:

central_body : str

positions : list

text : list

optional_parameters : TextBatchPrimitiveOptionalParameters

render_pass_hint : RenderPassHint

Returns:

None

TextBatchPrimitive.set_partial(self, positions: list, text: list, indices: list) None#

Update a subset of positions and/or text in a text batch.

Parameters:

positions : list

text : list

indices : list

Returns:

None

TextBatchPrimitive.set_partial_cartographic(self, central_body: str, positions: list, text: list, indices: list) None#

For convenience. Updates a subset of positions and/or text in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling SetPartial.

Parameters:

central_body : str

positions : list

text : list

indices : list

Returns:

None

TextBatchPrimitive.set_partial_cartographic_with_indices_order(self, central_body: str, positions: list, text: list, indices: list, indices_order_hint: PrimitiveIndicesOrderHint) None#

For convenience. Updates a subset of positions and/or text in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling SetPartial.

Parameters:

central_body : str

positions : list

text : list

indices : list

indices_order_hint : PrimitiveIndicesOrderHint

Returns:

None

TextBatchPrimitive.set_partial_cartographic_with_optional_parameters(self, central_body: str, positions: list, text: list, optional_parameters: TextBatchPrimitiveOptionalParameters, indices: list) None#

For convenience. Updates a subset of positions, text, and/or per-string parameters in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling SetPartial.

Parameters:

central_body : str

positions : list

text : list

optional_parameters : TextBatchPrimitiveOptionalParameters

indices : list

Returns:

None

TextBatchPrimitive.set_partial_cartographic_with_optional_parameters_indices_order_and_render_pass(self, central_body: str, positions: list, text: list, optional_parameters: TextBatchPrimitiveOptionalParameters, indices: list, indices_order_hint: PrimitiveIndicesOrderHint, render_pass_hint: RenderPassHint) None#

For convenience. Updates a subset of positions, text, and/or per-string parameters in a text batch using cartographic positions. This is equivalent to converting each position in positions to cartesian and calling SetPartial.

Parameters:

central_body : str

positions : list

text : list

optional_parameters : TextBatchPrimitiveOptionalParameters

indices : list

indices_order_hint : PrimitiveIndicesOrderHint

render_pass_hint : RenderPassHint

Returns:

None

TextBatchPrimitive.set_partial_with_indices_order(self, positions: list, text: list, indices: list, indices_order_hint: PrimitiveIndicesOrderHint) None#

Update a subset of positions and/or text in a text batch.

Parameters:

positions : list

text : list

indices : list

indices_order_hint : PrimitiveIndicesOrderHint

Returns:

None

TextBatchPrimitive.set_partial_with_optional_parameters(self, positions: list, text: list, optional_parameters: TextBatchPrimitiveOptionalParameters, indices: list) None#

Update a subset of positions, text, and/or optional per-string parameters in a text batch.

Parameters:

positions : list

text : list

optional_parameters : TextBatchPrimitiveOptionalParameters

indices : list

Returns:

None

TextBatchPrimitive.set_partial_with_optional_parameters_indices_order_and_render_pass(self, positions: list, text: list, optional_parameters: TextBatchPrimitiveOptionalParameters, indices: list, indices_order_hint: PrimitiveIndicesOrderHint, render_pass_hint: RenderPassHint) None#

Update a subset of positions, text, and/or optional per-string parameters in a text batch.

Parameters:

positions : list

text : list

optional_parameters : TextBatchPrimitiveOptionalParameters

indices : list

indices_order_hint : PrimitiveIndicesOrderHint

render_pass_hint : RenderPassHint

Returns:

None

TextBatchPrimitive.set_with_optional_parameters(self, positions: list, text: list, optional_parameters: TextBatchPrimitiveOptionalParameters) None#

Define the positions, text, and optional parameters of strings in a text batch. The strings are rendered in the primitive’s reference frame.

Parameters:

positions : list

text : list

optional_parameters : TextBatchPrimitiveOptionalParameters

Returns:

None

TextBatchPrimitive.set_with_optional_parameters_and_render_pass(self, positions: list, text: list, optional_parameters: TextBatchPrimitiveOptionalParameters, render_pass_hint: RenderPassHint) None#

Define the positions, text, and optional parameters of strings in a text batch. The strings are rendered in the primitive’s reference frame. renderPassHint is provided for efficiency.

Parameters:

positions : list

text : list

optional_parameters : TextBatchPrimitiveOptionalParameters

render_pass_hint : RenderPassHint

Returns:

None