def test_attach_mesh_to_a_node(self):
        lmesh = self.std.load_meshes_from(self.med_fname)[0]
        cmesh = ST.attach_mesh(lmesh.node)
        self.assert_(cmesh.node is lmesh.node)

        node = lmesh.node.get_children()[0]
        self.assertRaises(TypeError, ST.attach_mesh, node)
        node = lmesh.node.parent
        self.assertRaises(TypeError, ST.attach_mesh, node)
Exemplo n.º 2
0
 def load_mesh_from_selection(self):
     """Return a Mesh from the current selection if found or None
     otherwise"""
     mesh = None
     node = self.stracker.give_node()
     if node:
         try:
             mesh = ST.attach_mesh(node)
         except TypeError:
             pass
     return mesh
Exemplo n.º 3
0
 def create_elt(self, parent, compo):
     """Create the element reference in the object browser"""
     std = parent.give_aster_study()
     mesh_node = std.sstd.build_node_from_entry(compo.entry)
     mesh = ST.attach_mesh(mesh_node)
     return self._create_elt(parent, mesh)
Exemplo n.º 4
0
 def load(self, node):
     """Load the element from a given node"""
     mesh = ST.attach_mesh(node.give_source())
     return self._elt_cls(node, self.compo_cls, mesh)