Skip to content

Commit b920112

Browse files
committed
Ensure frame id is rebuilt if tool name changes
1 parent e011ef2 commit b920112

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/compas_fab/robots/tool.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ def from_tool_model(cls, tool_model):
4949
def get_attached_collision_meshes(self):
5050
tool_attached_collision_meshes = []
5151
for link in self.tool_model.iter_links():
52-
for item in link.collision:
52+
for i, item in enumerate(link.collision):
5353
meshes = Geometry._get_item_meshes(item)
5454
for mesh in meshes:
55-
collision_mesh = CollisionMesh(item, mesh)
55+
collision_mesh_name = '{}_collision_{}'.format(link.name, i)
56+
collision_mesh = CollisionMesh(mesh, collision_mesh_name)
5657
attached_collision_mesh = AttachedCollisionMesh(collision_mesh, self.link_name, [self.link_name])
5758
tool_attached_collision_meshes.append(attached_collision_mesh)
5859
return tool_attached_collision_meshes
@@ -64,6 +65,7 @@ def link_name(self):
6465
@link_name.setter
6566
def link_name(self, link_name):
6667
self.tool_model.link_name = link_name
68+
self.attached_collision_meshes = self.get_attached_collision_meshes() # rebuild ACMs
6769

6870
@property
6971
def frame(self):

0 commit comments

Comments
 (0)