Community
Navisworks API
Welcome to Autodesk’s Navisworks API Forums. Share your knowledge, ask questions, and explore popular Navisworks API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Navis works Object ID via API

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
MCameron3d
3232 Views, 4 Replies

Navis works Object ID via API

Hi,

 

I am unsure, although is there a potential way to get each object unique refernece ID that is in navisworks to via the API?

 

E.g I have 3 objects called "Door", I would like to be able to tell the difference from each object.

 

Cheers,

 

Marc C

Tags (3)
4 REPLIES 4
Message 2 of 5
Khez
in reply to: MCameron3d

Objects have certain categories of properties assigned by default in Navisworks, accessible via the properties panel (Shift+F7).

If you look in the Item tab of the properties panel, there's a property called "GUID", witch is a unique identifier.

 

 

Now properties only show in the panel when you have stuff selected, but you can  totally find an item programatically (via the search method), store it in a ModelItem type and get the guid property.

 

this is what you would do for a selected item:

 

 

Document oDoc = Autodesk.Navisworks.Api.Application.ActiveDocument;

//get only the first selected object
ModelItem oSelectedItem = oDoc.CurrentSelection.SelectedItems.ElementAt<ModelItem>(0);


//search for a specific data property(GUID) in a specific property category(Item)

DataProperty elemProp = oSelectedItem.PropertyCategories.FindPropertyByDisplayName("Item","GUID");

// Getting the value it is a variantData type of value, so I convert to displaystring before using ToString(), otherwise it will get something like this : "DisplayString:**********"

string elemGUID = elemProp.Value.ToDisplayString().ToString();

 

That was just for the GUID, but if you want to learn more about  properties, I suggest Reading this arcticle: Navisworks .NET API Properties

Message 3 of 5
MCameron3d
in reply to: Khez

Hi Khez,

 

fantastic answer, thank you. I am just a little unsure were you are refering to GUID. I do not seem to have that property available to see? I may be-able to capture it programitcally, this is I have yet to test.

 

These are the properties I get when I select an item.

 

Capture.PNG

 

I do see a handle within the "Entity Handle" tab although I am not sure this is what you are referring to, could you offer any more information incase I am missing a property option to display this?

 

Cheers,

 

Marc

Message 4 of 5
xiaodong_liang
in reply to: MCameron3d

Hi Marc,

 

The file from different CAD format would have different attribute to identify the entity. Entity Handle is for DWG file. It can be used to identify the object.

http://adndevblog.typepad.com/aec/2012/06/persistent-item-id-of-navisworks-objects.html

 

 

Message 5 of 5
Khez
in reply to: MCameron3d

Yeah, sorry, I'm only working with dwfx files, so I didn't know other type of files don't have a GUID.

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

Post to forums  

Rail Community


Autodesk Design & Make Report