Identifying Features

Identifying Features

Anonymous
Not applicable
1,974 Views
4 Replies
Message 1 of 5

Identifying Features

Anonymous
Not applicable

Hi,

 

I was just wondering if there was a way to identify features, even after they have been renamed.

 

I noticed in the API there's a method called `GetReferenceKey()`. Is this what I'm looking for?

 

Thanks

0 Likes
Accepted solutions (1)
1,975 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor
Accepted solution

That PartFeature.GetReferenceKey method is definitely one way of doing it.  If going that route, you would also need to use the Document.ReferenceKeyManager object and its methods to complete the identification routine.  You might also use the PartFeature.AttributeSets, and add a unique Attribute to it.  Attributes also have a similar document level tool to help you find stuff with attributes attached to them (Document.AttributeManager) with a set of methods.  But I'm not sure if the 'reference key' route would get broken if the feature gets changed somehow or not.  I know that when working with faces, if the face gets changed by a feature or something, it can be really hard to find it again afterwards.  Features may be a lot more forgiving, I'm not sure.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 5

Anonymous
Not applicable
Thanks for mentioning about attributes.
What I was trying to do was associate parameters with features, and so I'm storing (a modified version of) the feature reference key in an attribute set on each relevant parameter, so that one can find the other, which allows either/both to be renamed without losing this connection.
Message 4 of 5

WCrihfield
Mentor
Mentor

Nice thought.  It would be nice if something like this (but much simpler for us to use) would be an option that we could turn on/off as built-in functionality.  We can sometimes find parameters that are associated with features from the feature end, but not from the parameter end.  The parameters dialog shows that one column named 'Consumed By', but I don't know where they are pulling that data from.  When I inspect the Parameter.Dependents & Parameter.DrivenBy property collections, they are usually empty, even when something is showing in that column.  I'm pretty sure I've seen 'ideas' in the Inventor Ideas forum about others asking for there to be a more dynamically useful 'connection' there, for one purpose or another.  Attributes are great when setting things up for automation, but they do tend to 'dirty' the document, since they are stored in the document, so they are not always a great option to attempt to implement later in the process, or when old files and/or library/cc type files may be involved.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 5

Anonymous
Not applicable
yeah absolutely. I'm still maintaining legacy versions of these parameters, which it's unclear if I'll ever finally be able to retire these, but at least going forward the list shouldn't ever grow.
0 Likes