@@ -73,22 +73,34 @@ def _convert_tri_tessellation_node(
73
73
return mesh_prim
74
74
75
75
76
- def _convert_transform_node (
77
- node : "Ansys.Mechanical.Scenegraph.TransformNode" ,
76
+ def _create_prim_with_transform (
78
77
stage : Usd .Stage ,
79
78
path : str ,
80
- rgb : typing . Tuple [ int , int , int ],
79
+ node : "Ansys.Mechanical.Scenegraph.TransformNode"
81
80
) -> Usd .Prim :
82
- """Convert a mechanical transform node into a Usd Xform prim ."""
81
+ """Create an empty Usd Xform prim based on a mechanical transform node ."""
83
82
prim = UsdGeom .Xform .Define (stage , path )
84
83
rotation , translation = _transform_to_rotation_translation (node .Transform )
85
84
prim .AddOrientOp ().Set (rotation )
86
85
prim .AddTranslateOp ().Set (translation )
86
+ return prim
87
+
88
+
89
+ def _convert_transform_node (
90
+ node : "Ansys.Mechanical.Scenegraph.TransformNode" ,
91
+ stage : Usd .Stage ,
92
+ path : str ,
93
+ rgb : typing .Tuple [int , int , int ],
94
+ ) -> None :
95
+ """Add a Usd prim to the stage based on the given mechanical transform node.
96
+
97
+ Currently only supports transforms that contain a single tri tessellation node.
98
+ """
87
99
child_node = node .Child
88
- child_path = prim .GetPath ().AppendPath ("TriTessellation" )
89
100
if isinstance (child_node , Ansys .Mechanical .Scenegraph .TriTessellationNode ):
101
+ prim = _create_prim_with_transform (stage , path , node )
102
+ child_path = prim .GetPath ().AppendPath ("TriTessellation" )
90
103
_convert_tri_tessellation_node (child_node , stage , child_path , rgb )
91
- return prim
92
104
93
105
94
106
def to_usd_stage (app : "ansys.mechanical.core.embedding.App" , name : str ) -> None :
0 commit comments