cadop / fusion360descriptor

A URDF Exporter for Fusion 360
12 stars 3 forks source link

Duplicate component names cause problems in mesh files #10

Closed simjeh closed 2 years ago

simjeh commented 2 years ago

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 2 years ago

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?)

simjeh commented 2 years ago

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

simjeh commented 2 years ago

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 2 years ago

Okay I think I understand. Will try to fix today

cadop commented 2 years ago

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

simjeh commented 2 years ago

https://github.com/cadop/fusion360descriptor/blob/052d1ffe7965ef67ffebce8c7b545beec91fa387/Descriptor/core/parts.py#L163 https://github.com/cadop/fusion360descriptor/blob/052d1ffe7965ef67ffebce8c7b545beec91fa387/Descriptor/core/parts.py#L64-L68

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

simjeh commented 2 years ago

https://github.com/cadop/fusion360descriptor/blob/052d1ffe7965ef67ffebce8c7b545beec91fa387/Descriptor/core/io.py#L49

it also should be changed tofile_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 2 years ago

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 2 years ago

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

simjeh commented 2 years ago

yeah. it is working properly