Package mbdyn :: Package interface :: Module groups
[hide private]

Source Code for Module mbdyn.interface.groups

  1  #!/usr/bin/env python 
  2  # -*- coding: utf-8 -*- 
  3  # 
  4  # This file is part of MBDyn sim suite. 
  5  # Copyright (C) 2007 André ESPAZE, as part of a Master thesis supervised by 
  6  # Martin O.L.Hansen (DTU) and Nicolas Chauvat (Logilab) 
  7   
  8  # MBDyn sim suite is free software; you can redistribute it and/or modify 
  9  # it under the terms of the GNU General Public License as published by 
 10  # the Free Software Foundation; either version 2 of the License, or 
 11  # (at your option) any later version. 
 12  # 
 13  # This program is distributed in the hope that it will be useful, 
 14  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
 15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 16  # GNU General Public License for more details. 
 17  # 
 18  # You should have received a copy of the GNU General Public License 
 19  # along with this program; if not, write to the Free Software 
 20  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
 21  # 
 22  """The references frames, nodes and elements manipulated inside  
 23  groups as VTK objects""" 
 24  from mbdyn.groups import ReferenceList as ReferenceListBase 
 25  from mbdyn.groups import Nodes as NodesBase 
 26   
 27  from mbdyn.interface.common import BaseMenu 
 28  from mbdyn.interface.references import ReferenceFrame 
 29   
 30  DESC = {} 
 31  DESC["vtk"] = [\ 
 32  ("visibility", "_Show _all") 
 33  ] 
 34   
35 -class NodesMenu(BaseMenu):
36 """The menu for the list of nodes""" 37
38 - def __init__(self):
39 BaseMenu.__init__(self) 40 for key in DESC.keys(): 41 self.add_items(key, DESC[key]) 42 self.build()
43 44
45 -class Nodes(NodesBase):
46 """The list of nodes""" 47
48 - def __init__(self):
49 NodesBase.__init__(self)
50 51 52 DESC = {} 53 DESC["vtk"] = [\ 54 ("visibility", "_Show _all") 55 ] 56
57 -class ReferenceListMenu(BaseMenu):
58 """The menu for the reference frames""" 59
60 - def __init__(self):
61 BaseMenu.__init__(self, DESC, True)
62 63
64 -class ReferenceList(ReferenceListBase):
65 """The reference frames list""" 66
67 - def __init__(self):
68 ReferenceListBase.__init__(self) 69 self.menu_type = "reference_list" 70 self.boolean = {} 71 self.boolean["visibility"] = False
72
73 - def set_unit_arrow(self, unit_arrow):
74 """Set the arrow mapper representing the unit vector""" 75 for ref in self: 76 ref.set_unit_arrow(unit_arrow)
77
78 - def activate(self, key_feature, current_frame_id, vtk_area):
79 """Activate a feature according to the current simulation frame""" 80 for ref in self: 81 ref.activate(key_feature, current_frame_id, vtk_area) 82 self.boolean["visibility"] = True 83 return "Show all the references"
84
85 - def desactivate(self, key_feature, vtk_area):
86 """Deactivate a feature""" 87 for ref in self: 88 ref.desactivate(key_feature, vtk_area) 89 self.boolean["visibility"] = False 90 return "Hide all the references"
91
92 - def set_parameters(self, para):
93 """Create reference frames with VTK attributes instead of 94 reference frames from the L{mbdyn.references} module.""" 95 self.set_own_parameters(para) 96 for ref_para in self.ref_paras: 97 ref = ReferenceFrame() 98 ref.set_parameters(ref_para) 99 self.add(ref)
100