Пример #1
0
 def RunScript(self, scene, mesh, identifier, link_name, touch_links, add, remove):
     attached_collision_mesh = None
     if scene and mesh and identifier and link_name:
         compas_mesh = RhinoMesh.from_geometry(mesh).to_compas()
         collision_mesh = CollisionMesh(compas_mesh, identifier)
         attached_collision_mesh = AttachedCollisionMesh(collision_mesh, link_name, touch_links)
         if add:
             scene.add_attached_collision_mesh(attached_collision_mesh)
         if remove:
             scene.remove_attached_collision_mesh(identifier)
             scene.remove_collision_mesh(identifier)
     return attached_collision_mesh
Пример #2
0
 def RunScript(self, scene, M, name, add, remove):
     ok = False
     if scene and M and name:
         mesh = RhinoMesh.from_geometry(M).to_compas()
         collision_mesh = CollisionMesh(mesh, name)
         if add:
             scene.add_collision_mesh(collision_mesh)
             ok = True
         if remove:
             scene.remove_collision_mesh(name)
             ok = True
     return ok
def rgmesh_to_cgmesh(mesh, cls=None):
    return RhinoMesh.from_geometry(mesh).to_compas(cls=cls)