cadop/fusion360descriptor

Duplicate component names cause problems in mesh files

simjeh opened this issue · 10 comments

When I use the same file for the same robot as a link, stl meshes are just overwritten. so in this case we need to warn about it or make some additional file name.

cadop commented

but is it actually the same file? then it would also be the same mesh right? Otherwise what is the expected result (or why wouldn't it work?)

Problem 1: Duplicate link name. In Fusion, there is an additional number for the component. But we only put the component name for the link name so urdf has two links with the same name. And it doesn't work. Component number or something else should be put as a suffix at link name and mesh name.
Problem 2: we save mesh in global coordinates. so we cannot use same mesh files for the other link. (If we load entire meshes then meshes are at desired position. mesh has coordinate info also so we cannot use the same mesh) It could be solved by saving the mesh files with the additional suffix

for i in range(0, occurrences.count):
occ = occurrences.item(i)
occurrences index(i) could be a suffix.

What is displayed in Fusion 360 is "Instance number".
But I cannot find how to find the instance number.

cadop commented

Okay I think I understand. Will try to fix today

cadop commented

can you post a screenshot of the names in the hierarchy that cause this problem.

we are saving the components name already, with the instance like: 'UL_Shoulder_1 v3:1'

so I don't see where to fix the thing you are saying

self.name = self.name.split(':')[0]

self.parent = self.parent.split(':')[0]
parent.attrib = {'link':self.parent}
child = SubElement(joint, 'child')
self.child = self.child.split(':')[0]

i think we should change the link-name with this way self.name=self.name.split(':')[0]+'_'+self.name.split(':')[1]

file_name = os.path.join(save_dir, oc.component.name)

it also should be changed to file_name = os.path.join(save_dir, oc.name.split(':')[0]+'_'+oc.name.split(':')[1])
Because filesystem doesn't allow the ":" at the name, I put'_'.

cadop commented

okay I see the problem thanks. even though we saved oc.component.name fusion was removing the version number after :. Ill push a fix today

cadop commented

pushed a fix. please check and reopen issue if still is broken

yeah. it is working properly