ReferenceKey -> Finding Objects?

ReferenceKey -> Finding Objects?

SafetyLok
Participant Participant
366 Views
3 Replies
Message 1 of 4

ReferenceKey -> Finding Objects?

SafetyLok
Participant
Participant
I have a reference key and context value that was previously saved in an attribute.

I'm working on a VB.NET adding for V11Pro.
I would like to know if it is possible to just take the reference key, pass it into a API function and find the source object for that key?

Is this the correct use for a reference key? or am I way off.
Thanks.
0 Likes
367 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Yes, that is the correct usage. Note that you need both the reference key
and the 'Key Context' for BRep entities (faces, edges, vertices, etc.). For
all other entities, you just need the reference key to bind back to the
entity.

Sanjay-
0 Likes
Message 3 of 4

SafetyLok
Participant
Participant
Thanks Sanjay,

I use pAssyDoc.ReferenceManager.CanBindKeyToObject(..)
which returns true.
I then bind the key to a variable of type object. (system.__comobject)

Do you know how I can then determine what type of object has been returned so as I can do a type cast?

The keys were saved and did not contain any information about the type of object. The could be sketch entities, work points, etc.

Thanks again..
0 Likes
Message 4 of 4

Anonymous
Not applicable
You can use the Type property available on almost all objects exposed via
the API.

If obj.Type = kSketchLineObject Then

Also, note that the CanBindKeyToObject method returns the object in the 3rd
argument if it was able to bind the key. i.e. no need to make another call
to bind the key.

Sanjay-
0 Likes