Message 1 of 4
Get item "ilogic event rules"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there.
I have created an ilogic script that allows me to add a rule and activate the trigger necessary to update the rule when a parameter changes.
This script works very well on my recent projects (inventor 2020).
However, I have a problem with parts (.ipt) from the inventor 2013 version.
I have an error when retrieving "ilogiceventrules".
the error :
"
Error in rule: test, in document: XXX.ipt
Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))
"
However, it seems to me that my code is correct and that it foresees each case and that since I have "catch/try" I should not have any error.
(here is only the part that interests us)
Thank you in advance to take time to answer me and understand my error.
Regards.
' Add the rule in event trigger
'variable declaration
Dim customPropSets As PropertySets
Dim customPropSet As PropertySet
doc = ThisApplication.ActiveDocument
customPropSets = oDoc.PropertySets
'Get the item (depending of internal name)
Try
customPropSet = oDoc.PropertySets.Item("iLogicEventsRules")
Catch
If customPropSet Is Nothing Then
customPropSet = oDoc.PropertySets.Item("_iLogicEventsRules")
End If
Catch
If customPropSet.InternalName <> "{2C540830-0723-455E-A8E2-891722EB4C3E}" Then
Call customPropSet.Delete
customPropSet = oDoc.PropertySets.Add("iLogicEventsRules", "{2C540830-0723-455E-A8E2-891722EB4C3E}")
End If
Catch
If customPropSet Is Nothing Then
customPropSet = oDoc.PropertySets.Add("iLogicEventsRules", "{2C540830-0723-455E-A8E2-891722EB4C3E}")
End If
Catch
If customPropSet Is Nothing Then
MessageBox.Show("Unable to create the Event Triggers property for this file!","Event Triggers Not Set")
Err.Raise(1)
Exit Sub
End If
End Try