Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unique id for bRepBody

10 REPLIES 10
Reply
Message 1 of 11
grakoczy
498 Views, 10 Replies

Unique id for bRepBody

Hi,

 

I wonder if there is a way to get unique id for bRepBody objects?

I have design with bodies with the same name, but one is mirrored so they give different meshes in output.

Swig objects are not hashable so this method won't work.

10 REPLIES 10
Message 2 of 11
ekinsb
in reply to: grakoczy

Unfortunately, there isn't anything currently available like this.  This is a recognized issue and something we're working on but I don't know yet when it will be available.  Currently, the names are the best thing to identify a body but as you've found, they're not guaranteed to be unique.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 11
grakoczy
in reply to: ekinsb

OK, so we have to live with this. I'll try to handle such cases somehow.

Thanks.

Message 4 of 11
tamas.turcsanyi
in reply to: ekinsb

Hi Brian,

 

Is there anything new with unique id for fusion API objects? In my current project I am creating script based on information in Fusion 360 and I need to reference fusion objects with a unique identifier. 

 

I have come up with a half solution to include "ID" attributes on objects that support attributes, but that does not cover all the objects I am working with.

 

Could you please give me info about the status of unique Ids? Is there a plan to implement it?

 

Thank you for your answer in advance!

Message 5 of 11
ekinsb
in reply to: tamas.turcsanyi

The thing we were working on was attributes, which is now supported.  The API does not support ID's for entities.  It's been discussed but is not currently on the road map.

 

I'm curious about your statement that attributes doesn't provide cover for all of the objects you're interested in.  What objects do you want that aren't supported?


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 6 of 11
tamas.turcsanyi
in reply to: ekinsb

During my investigation I have found, that for example adsk::core::Profile does not have attributes. 2 days ago I managed to figure out that I am supposed to retrieve the parent objects in case of Profile, SketchLine, SketchPoint, etc. in order to get the actual object that has the name text displayed on the UI. I have not found missing attributes in case of "Parent" objects. 

 

If I understand you correctly, than you support adding IDs to attributes manually by developers. Am I correct?

As a connected question: Is there any built-in or "best practice" way to force objects into ID creation upon object creation? 

 

Thank you for your answer in advance!

 

 

Message 7 of 11
ekinsb
in reply to: tamas.turcsanyi

My understanding is that Profiles aren't remembered by Fusion either and are recalculated as-needed. Because they're not something that's saved, they don't support attributes.

 

Your understanding of what I said is correct.  You're essentially using attributes to "name" the entities you care about so you can find them later.  There isn't any way to automatically do this.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 8 of 11
tamas.turcsanyi
in reply to: ekinsb

 

I have bumped into an object type that are remembered by fusion, but does not have attributes: Material.

During my development I need to handle materials by ID as well.

 

Could you please help me how could I solve the missing ID issue in case of materials?

 

 

Message 9 of 11
ekinsb
in reply to: tamas.turcsanyi

Materials are a bit of an oddball.  They aren't actually a Fusion object because they're stored externally in .adsk files.  You're right that it isn't possible to add attributes to materials.  The best you can do with materials is to store the id and then use the id to find the material again.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 10 of 11
Rahul.Khande
in reply to: grakoczy

Hello All,

 

Just wondering if there's way to get ID for bodies. Thank you.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report