Hi. I would like to request my engineers to name all work features as they are created. So, for example, when an engineer creates a new work axis, I will show you a dialog asking axis name. Then I change the name of the property of the work feature to the entered text. I've tried to find an event that tells the program when work feature has been added. I found DocumentEvents onChange event, but it does not give me enough information. I just get the following info from the Context parameter:
Context (0): "Create Work Feature"
Context (1): "Work Feature"
Context (2): 1
This event does not give me a work feature object itself, which I need. How can I get it? Is there another event I missed?
Solved! Go to Solution.
Solved by nmunro. Go to Solution.
Inventor can give you the feature via event. There's a different event to use:
ModelingEvents.OnNewFeature( DocumentObject As Document, Feature As PartFeature, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, HandlingCode As HandlingCodeEnum )
To do it as things are changed use:
ModelingEvents.OnFeatureChange( DocumentObject As Document, Feature As PartFeature, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, HandlingCode As HandlingCodeEnum )
The second parameter is the feature for both. You have to cast it to the feature type.
The OnChange event is the wrong event to watch for new features or feature changes.