Hi,
I've found this code that should disable all event triggers, but i cant get i to work.
Set iLogicVb = ThisApplication.ApplicationAddIns.ItemById("{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}") Set a = iLogicVb.Automation a.RulesOnEventsEnabled = False ' your original code here a.RulesOnEventsEnabled = True
I want to switch between the settings marked in the picture below:
Can anyone help?
Solved! Go to Solution.
Solved by WCrihfield. Go to Solution.
Solved by MjDeck. Go to Solution.
Interesting observation @LarsBJepsen.
I have tried toggling both the IiLogicAutomation.RulesEnabled Property and the IiLogicAutomation.RulesOnEventsEnabled Property by iLogic and VBA, but neither of them toggles any of those visible check boxes within the 'iLogic Security' dialog. It's almost like they aren't the same settings, even though the descriptions sound almost identical. Within the code, after toggling the iLogic automation settings, they are definitely being changed (from the iLogic code's perspective), because you can easily check the results in some following lines of the code with a MsgBox.
So, I also tried the reverse process...changing these settings within in the dialog, then checking these settings within the code, to see if maybe they only work in one direction. That seemed to have no effect either.
Maybe someone at Autodesk could shed some light on this subject? @MjDeck , @chandra.shekar.g , @Scott_Parker
Wesley Crihfield
(Not an Autodesk Employee)
@WCrihfield , that's right. Those are two separate (but related) things.
We don't want it to be possible to disable the security settings by using the API. That would be a vulnerability.
So *both* the API property RulesOnEventsEnabled *and* the security setting in the dialog must be enabled if you want rules to run on events. (There is no separate API property for the Open and Close event.)
But if you want to disable rules on events, it's sufficient to set either the API property to False *or* to disable the option in the dialog.
Hi Mike,
Disable rules on events is exactly what i want to do, but I can't get the code right for it. Can you help with some code that disables rules on events?
/Lars
@LarsBJepsen , the code you posted above should work.
a.RulesOnEventsEnabled = False
As I noted above, it will not affect the setting in the dialog. But it should disable rules on events.
Are you testing with code that raises an event after you set RulesOnEventsEnabled to False, and before you set it to True again?
Which version of Inventor are you testing on?
Thanks a lot @MjDeck !
Here is a version of the code that is designed to 'toggle' this setting, and informs you of the before and after state of that setting, when you run it:
Sub ToggleEventTriggersEnabled()
Dim oiLogic As Inventor.ApplicationAddIn
Set oiLogic = ThisApplication.ApplicationAddIns.ItemById("{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}")
Dim oAuto As Object
Set oAuto = oiLogic.Automation
'capture its current state, before changing it
Dim oEnabled As Boolean
oEnabled = oAuto.RulesOnEventsEnabled
'toggle the setting
oAuto.RulesOnEventsEnabled = Not oAuto.RulesOnEventsEnabled
'inform user of the changed status
Call MsgBox("RulesOnEventsEnabled was set to: " & oEnabled & vbCrLf & _
"But it is now set to: " & oAuto.RulesOnEventsEnabled, , "")
End Sub
Wesley Crihfield
(Not an Autodesk Employee)
Can't find what you're looking for? Ask the community or share your knowledge.