SolidPrimitive#
- class ansys.stk.core.graphics.SolidPrimitive#
Bases:
IPrimitive
Render filled solid objects and their outlines. Example solids include boxes and ellipsoids. Various effects are supported, such as displaying the solid’s silhouette, and hiding the outline of the backside of the solid…
Overview#
Define the solid using the specified solidTriangulatorResult. The solid is rendered in the primitive’s reference frame. |
|
Define the solid using the specified parameters. The solid is rendered in the primitive’s reference frame. |
Get or set whether the primitive is affected by lighting. |
|
Get or set whether the solid’s fill is displayed. |
|
Get or set whether the solid’s silhouette is displayed. |
|
Get or set the silhouette’s color. |
|
Get or set the silhouette’s translucency. Translucency is between 0 and 1, where 0 is opaque and 1 is transparent. |
|
Get or set the silhouette’ width, in pixels. |
|
Get the minimum silhouette width, in pixels, supported by the video card. |
|
Get the maximum silhouette width, in pixels, supported by the video card. |
|
Get or set whether the solid’s outline is displayed. |
|
Get or set the outline’s color. |
|
Get or set the outline’s translucency. Translucency is between 0 and 1, where 0 is opaque and 1 is transparent. |
|
Get or set the outline’s width, in pixels. |
|
Get or set the outline’s appearance. |
|
Get or set the back line’s color. |
|
Get or set the back line’s translucency. Translucency is between 0 and 1, where 0 is opaque and 1 is transparent. |
|
Get or set the solid’s position. The position is defined in the solid’s reference frame. The array contains the components of the position in the order x, y, z. |
|
Get or set the rotation applied to the solid before rendering. |
|
Get or set a non-uniform scale that is applied to the solid to increase or decrease its rendered size. The array contains the scale for each component of the size in the order x scale, y scale, z scale. |
|
Get or set the back line’s width, in pixels. |
|
Get the primitive’s set hint. See the Set Hint Performance Overview for selecting an appropriate value to construct the primitive with. |
Examples#
Draw a Solid Cylinder Primitive and set properties
# Scenario scenario: Scenario object
manager = scenario.scene_manager
originCylinder = root.conversion_utility.new_position_on_earth()
originCylinder.assign_geodetic(0, 7, 100)
orientCylinder = root.conversion_utility.new_orientation()
orientCylinder.assign_az_el(0, 0, AzElAboutBoresight.ROTATE)
cylinder = manager.initializers.cylinder_triangulator.create_simple(200, 100)
solidCylinder = manager.initializers.solid_primitive.initialize()
solidCylinder.reference_frame = root.central_bodies.earth.analysis_workbench_components.systems.item("Fixed")
solidCylinder.position = originCylinder.query_cartesian_array()
solidCylinder.set_with_result(cylinder)
solidCylinder.color = Colors.Lime
solidCylinder.outline_color = Colors.Blue
solidCylinder.outline_width = 3
solidCylinder.translucency = 0.75
solidCylinder.rotation = orientCylinder
manager.primitives.add(solidCylinder)
manager.render()
Draw a Solid Ellipsoid Primitive and set properties
# Scenario scenario: Scenario object
manager = scenario.scene_manager
originEllipsoid = root.conversion_utility.new_position_on_earth()
originEllipsoid.assign_geodetic(0, 5, 100)
orientEllipsoid = root.conversion_utility.new_orientation()
orientEllipsoid.assign_az_el(0, 0, AzElAboutBoresight.ROTATE)
radii = [[200], [100], [100]]
ellipsoid = manager.initializers.ellipsoid_triangulator.compute_simple(radii)
solidEllipsoid = manager.initializers.solid_primitive.initialize()
solidEllipsoid.reference_frame = root.central_bodies.earth.analysis_workbench_components.systems.item(
"Fixed"
) # vgtSat.Systems.item('Body')
solidEllipsoid.position = originEllipsoid.query_cartesian_array()
solidEllipsoid.set_with_result(ellipsoid)
solidEllipsoid.color = Colors.White
solidEllipsoid.outline_color = Colors.DeepPink
solidEllipsoid.translucency = 0.75
solidEllipsoid.rotation = orientEllipsoid
manager.primitives.add(solidEllipsoid)
manager.render()
Draw a Solid Box Primitive and set properties
# Scenario scenario: Scenario object
manager = scenario.scene_manager
originBox = root.conversion_utility.new_position_on_earth()
originBox.assign_geodetic(0, 3, 100)
orientBox = root.conversion_utility.new_orientation()
orientBox.assign_az_el(0, 0, AzElAboutBoresight.ROTATE)
size = [[100], [100], [200]]
result = manager.initializers.box_triangulator.compute(size)
solidBox = manager.initializers.solid_primitive.initialize()
solidBox.reference_frame = root.central_bodies.earth.analysis_workbench_components.systems.item("Fixed")
solidBox.position = originBox.query_cartesian_array()
solidBox.set_with_result(result)
solidBox.color = Colors.Red
solidBox.outline_color = Colors.Cyan
solidBox.translucency = 0.75
solidBox.rotation = orientBox
manager.primitives.add(solidBox)
manager.render()
Import detail#
from ansys.stk.core.graphics import SolidPrimitive
Property detail#
- property SolidPrimitive.affected_by_lighting: bool#
Get or set whether the primitive is affected by lighting.
- property SolidPrimitive.display_silhouette: bool#
Get or set whether the solid’s silhouette is displayed.
- property SolidPrimitive.silhouette_translucency: float#
Get or set the silhouette’s translucency. Translucency is between 0 and 1, where 0 is opaque and 1 is transparent.
- property SolidPrimitive.minimum_silhouette_width_supported: float#
Get the minimum silhouette width, in pixels, supported by the video card.
- property SolidPrimitive.maximum_silhouette_width_supported: float#
Get the maximum silhouette width, in pixels, supported by the video card.
- property SolidPrimitive.display_outline: bool#
Get or set whether the solid’s outline is displayed.
- property SolidPrimitive.outline_translucency: float#
Get or set the outline’s translucency. Translucency is between 0 and 1, where 0 is opaque and 1 is transparent.
- property SolidPrimitive.outline_appearance: OutlineAppearance#
Get or set the outline’s appearance.
- property SolidPrimitive.back_line_translucency: float#
Get or set the back line’s translucency. Translucency is between 0 and 1, where 0 is opaque and 1 is transparent.
- property SolidPrimitive.position: list#
Get or set the solid’s position. The position is defined in the solid’s reference frame. The array contains the components of the position in the order x, y, z.
- property SolidPrimitive.rotation: IOrientation#
Get or set the rotation applied to the solid before rendering.
Method detail#
- SolidPrimitive.set_with_result(self, solid_triangulator_result: SolidTriangulatorResult) None #
Define the solid using the specified solidTriangulatorResult. The solid is rendered in the primitive’s reference frame.
- Parameters:
solid_triangulator_result :
SolidTriangulatorResult
- Returns:
- SolidPrimitive.set(self, positions: list, normals: list, indices: list, outline_indices: list, winding_order: WindingOrder, bounding_sphere: BoundingSphere, closed: bool) None #
Define the solid using the specified parameters. The solid is rendered in the primitive’s reference frame.