25
25
from OCP .TopTools import TopTools_ListOfShape
26
26
from OCP .BOPAlgo import BOPAlgo_GlueEnum , BOPAlgo_MakeConnected
27
27
from OCP .TopoDS import TopoDS_Shape
28
+ from OCP .gp import gp_EulerSequence
28
29
29
30
from vtkmodules .vtkRenderingCore import (
30
31
vtkActor ,
@@ -259,7 +260,14 @@ def toVTK(
259
260
for shape , _ , loc , col_ in assy :
260
261
261
262
col = col_ .toTuple () if col_ else color
262
- trans , rot = loc .toTuple ()
263
+ T = loc .wrapped .Transformation ()
264
+ trans = T .TranslationPart ().Coord ()
265
+ rot = tuple (
266
+ map (
267
+ degrees ,
268
+ T .GetRotation ().GetEulerAngles (gp_EulerSequence .gp_Intrinsic_ZXY ),
269
+ )
270
+ )
263
271
264
272
data = shape .toVtkPolyData (tolerance , angularTolerance )
265
273
@@ -290,7 +298,7 @@ def toVTK(
290
298
actor = vtkActor ()
291
299
actor .SetMapper (mapper )
292
300
actor .SetPosition (* trans )
293
- actor .SetOrientation (* map ( degrees , rot ) )
301
+ actor .SetOrientation (rot [ 1 ] , rot [ 2 ], rot [ 0 ] )
294
302
actor .GetProperty ().SetColor (* col [:3 ])
295
303
actor .GetProperty ().SetOpacity (col [3 ])
296
304
@@ -302,7 +310,7 @@ def toVTK(
302
310
actor = vtkActor ()
303
311
actor .SetMapper (mapper )
304
312
actor .SetPosition (* trans )
305
- actor .SetOrientation (* map ( degrees , rot ) )
313
+ actor .SetOrientation (rot [ 1 ] , rot [ 2 ], rot [ 0 ] )
306
314
actor .GetProperty ().SetColor (0 , 0 , 0 )
307
315
actor .GetProperty ().SetLineWidth (2 )
308
316
0 commit comments