Disabling Local Event Triggers En Masse

Disabling Local Event Triggers En Masse

Jacob.PawelskiUVPDL
Contributor Contributor
182 Views
3 Replies
Message 1 of 4

Disabling Local Event Triggers En Masse

Jacob.PawelskiUVPDL
Contributor
Contributor

I am looking to implement some external rules for the workplace for all users. I am concerned about existing parts that I had internal rules and "This Document" event triggers setup for.

Is there a way to remove the "This Document" even triggers from these existing parts so they don't interfere with the new rules? Is there a way to remove the iLogic rule itself from those parts en masse? 

 

Thanks,
Jacob

0 Likes
183 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor

Hi @Jacob.PawelskiUVPDL.  Yes.  Both of those are possible, and fairly easy to do with a single external iLogic rule.  One function of the rule can find the hidden PropertySet object within that document, if it exists, that holds the local Event Triggers settings, then it can delete that whole PropertySet, which will remove those settings.  The other functionality of the rule could delete all of the internal iLogic rules within that document.  The simplest way to set-up that rule would be to have the rule just focus on whichever document is currently visible on your screen at the time.  Would that be OK, or do you want this rule to process a whole directory of files at a time, or do you want it to work some other way?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 4

WCrihfield
Mentor
Mentor

Here is an example single line of iLogic code that can be used to delete all internal rules within a specified document.

iLogicVb.Automation.DeleteAllRulesInDocument(ThisDoc.Document)

If you already have a variable for a specific document, you can put that variable within the () area, instead of 'ThisDoc.Document'.

And below is some iLogic code to delete the local Event Triggers settings of the document.

Dim oSet As PropertySet
If ThisDoc.Document.PropertySets.PropertySetExists("{2C540830-0723-455E-A8E2-891722EB4C3E}", oSet) Then
	oSet.Delete
End If

Again, the 'ThisDoc.Document' is where the document is being specified, but that part can be swapped out for some other variable that is representing a Document object.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor

And here is an example of how to remove just one specific internal iLogic rule, by its name, from within a specified document.

If iLogicVb.Automation.GetRule(ThisDoc.Document, "Internal Rule Name") IsNot Nothing Then
	iLogicVb.Automation.DeleteRule(ThisDoc.Document, "Internal Rule Name")
End If

...or, you could suppress the rule, instead of deleting it, like this:

Dim oRule As iLogicRule = iLogicVb.Automation.GetRule(ThisDoc.Document, "Internal Rule Name")
If oRule IsNot Nothing Then oRule.IsActive = False

...or, you could disable the rule from automatically running when parameter values change, and change other settings of the rule, like this:

Dim oRule As iLogicRule = iLogicVb.Automation.GetRule(ThisDoc.Document, "Internal Rule Name")
If oRule IsNot Nothing Then
	'oRule.IsActive = False
	oRule.AutomaticOnParamChange = False
	oRule.FireDependentImmediately = False
	oRule.SilentOperation = True
	'oRule.Name = "Some Other Rule Name"
	'oRule.Text = "Some other rule contents."
End If

But keep in mind, the code in my previous response only deletes the local settings (the settings that only effect this one specific document), not the other Event Triggers settings that will effect all documents of a certain type.  And the setting in this last code for disabling this rule from running when parameter values change is not talking about the setting in the Event Triggers dialog box, because a setting there would override this setting.  The setting in this code above, would only effect if you included any blue, unquoted parameter names within this rule, then when the values of those blue parameters change, that would normally cause this rule to be triggered to run.  This setting can disable that specific functionality.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes