1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 """The reference frames described for VTK."""
23 from mbdyn.references import ReferenceFrame as ReferenceFrameBase
24
25 from mbdyn.interface.common import BaseMenu
26 from mbdyn.interface.vectors import ReferenceFrame as VtkReferenceFrame
27
28 DESC = {}
29
30 DESC["vtk"] = [\
31 ("visibility", "_Show")
32 ]
33
35 """The reference frame menu
36 """
37
42
43
45 """A reference frame based in a VTK environment
46 """
47
49 ReferenceFrameBase.__init__(self)
50 self.vtk_ref = VtkReferenceFrame()
51
52 self.menu_type = "reference_frame"
53
54 self.feature_keys = ["visibility"]
55 self.boolean = {}
56 self.boolean["visibility"] = False
57
59 """Set the arrow mapper representing a unit vector"""
60 for axe in self.vtk_ref.axes:
61 axe.set_arrow(unit_arrow)
62
63 - def activate(self, key_feature, current_frame_id, vtk_area):
64 """Show the reference frame"""
65 res = self.results
66 self.vtk_ref.set_position(res.position[0])
67 self.vtk_ref.set_orientation_matrix(res.orientation_matrix[0])
68
69 for axe in self.vtk_ref.axes:
70 vtk_area.add_actor(axe.actor)
71 self.boolean["visibility"] = True
72 return "Show %s reference" % self.name
73
75 """Hide the reference frame"""
76 for axe in self.vtk_ref.axes:
77 vtk_area.remove_actor(axe.actor)
78 self.boolean["visibility"] = False
79 return "Hide %s reference" % self.name
80