Unique ID For Objects

Unique ID For Objects

sanganaksakha
Advocate Advocate
1,135 Views
2 Replies
Message 1 of 3

Unique ID For Objects

sanganaksakha
Advocate
Advocate
When you create an object (even non-graphical object like blockdefinition) in AutoCAD, AutoCAD assigns a unique (in that drawing) ID to it. (As far as I remember, only selection sets do not have handles). AutoCAD retains this handle even when that object is deleted. It is not assigned to any other object in that drawing.

In programming, this handle is available as EntityName in AutoLISP and ObjectID in VB. (These are however different from the handle). This has many advantages, especially in programming.

For example, I can share the same object in multiple languages using conversion like EntityName > Handle > ObjecttID and vice versa. Also storing objects in variables becomes easier.

Most of the Solid Modellers (Inventor, SolidEdge) must be having this concept internally. However, none of them expose anything similar to handle in API. This causes inconvenience in identifying objects and storing them in variables.

They provide other facilities like ReferenceKey or Attributes. But this means extra work for the programmers.

My questions:

1) Why solid Modelling APIs do not provide this facility. What could be the pros and cons.
2) Do you think they should provide this for making the life of Progrmmers a bit more easier?

Your take on this.
0 Likes
1,136 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
I'm pretty sure the Reference Key is precisely what you're describing. It's a series of bytes that uniquely identifies whatever object you took it from. It persists across sessions, and it only becomes invalid if that object is no longer in the document.

If you wanted a quick and dirty way to store it rather than the raw byte array, you can convert the whole key into a string using something like System.Convert.ToBase64String().

Addtionally, I'm pretty sure that if you took the reference key of a geometry proxy, you do get that same proxy back. Which is awfully helpful.
0 Likes
Message 3 of 3

warrentdo
Collaborator
Collaborator

Hello Guys,

 

I know that this is a really old post but is the Reference Key available to view in the vault?

 

Regards

 

warren.

0 Likes