03-07-2019
12:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-07-2019
12:43 AM
Hi, here is an example I hope it is useful, it is a rule that after executing is automatically added to event, in the category of geometry change. For your rule in particular, replace the text box with your rule, or with the subroutine you have. Regards!!!
Sub main() MessageBox.Show("Example", "Title") Events End Sub Sub Events On Error Resume Next Dim EventPropSet As Inventor.PropertySet EventPropSet = GetiLogicEventPropSet(ThisApplication.ActiveDocument) EventPropSet.Add("Inicio", "PartBodyChanged ", 1200) 'After Open Document : AfterDocOpen : 400 'Close(Document) : DocClose : 500 'Before Save Document : BeforeDocSave : 700 'After Save Document : AfterDocSave : 800 'Any Model Parameter Change : AfterAnyParamChange : 1000 'Part Geometry Change** : PartBodyChanged : 1200 'Material Change** : AfterMaterialChange : 1400 'Drawing View Change*** : AfterDrawingViewsUpdate : 1500 'iProperty(Change) : AfterAnyiPropertyChange : 1600 'Feature Suppression Change** : AfterFeatureSuppressionChange : 2000 'Component Suppression Change* : AfterComponentSuppressionChange : 2200 'iPart / iAssembly Change Component* : AfterComponentReplace : 2400 'New Document : AfterDocNew : 2600 InventorVb.DocumentUpdate() End Sub Function GetiLogicEventPropSet(cDocument As Document) As Inventor.PropertySet On Error Resume Next iLogicEventPropSet = cDocument.PropertySets.Item("iLogicEventsRules") If iLogicEventPropSet Is Nothing Then iLogicEventPropSet = cDocument.PropertySets.Item("_iLogicEventsRules") End If If iLogicEventPropSet.InternalName <> "{2C540830-0723-455E-A8E2-891722EB4C3E}" Then Call iLogicEventPropSet.Delete iLogicEventPropSet = cDocument.PropertySets.Add("iLogicEventsRules", "{2C540830-0723-455E-A8E2-891722EB4C3E}") End If If iLogicEventPropSet Is Nothing Then iLogicEventPropSet = cDocument.PropertySets.Add("iLogicEventsRules", "{2C540830-0723-455E-A8E2-891722EB4C3E}") End If If iLogicEventPropSet Is Nothing Then MsgBox ("Unable to create the Event Triggers property for this file!", , "Event Triggers Not Set") Err.Raise(1) Exit Function End If On Error GoTo 0 Return iLogicEventPropSet End Function
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn