Hello,
my drawing template has a dozen or so rules, all time savers for me except that I don't need them to run every time I save. I save quite often (spacemouse macro setup to zoom all and save), but after doing this, all my rules run. I found this rule here:
'iLogic code by @ClintBrown3D, originally posted at https://clintbrown.co.uk/ilogic-suppress-unsuppress-and-delete-rules
On Error GoTo ClintsErrorTrap
doc = ThisApplication.ActiveDocument
Logic = iLogicVb.Automation
Dim ListOrules As System.Collections.IEnumerable = Logic.Rules(doc)
UnofficialInventor = InputListBox("What would you like to do?", {"Suppress ALL Rules","Unsuppress ALL Rules"}, UnofficialInventor, Title := "@ClintBrown3D", ListName := "This Utility lets you Suppress/Unsuppress iLogic Rules")
If UnofficialInventor = "Suppress ALL Rules" Then : GoTo Suppress : End If
If UnofficialInventor = "Unsuppress ALL Rules" Then : GoTo Unsuppress : End If
If UnofficialInventor = "" Then : GoTo ClintsErrorTrap : End If
Suppress:
For Each oRule As iLogicRule In ListOrules
iLogicVb.Automation.GetRule(doc, oRule.Name).IsActive = False
Next
Return
Unsuppress:
For Each oRule As iLogicRule In ListOrules
iLogicVb.Automation.GetRule(doc, oRule.Name).IsActive = True
Next
Return
ClintsErrorTrap :
I get this error when trying to run it:
I would like to set this rule up to run when I press save, then I can decide if I want all my rules to run or to suppress them to avoid the delay after saving. I would like to modify the input list box also to just a yes or no box,
But I am getting this rule when it is a direct copy from the owner website. I assume it is because he tested it on 2020 and I am using 2016. Any ideas?
Thanks!
Solved! Go to Solution.
Solved by WCrihfield. Go to Solution.
Hi @Shag_Bore. You could try something a bit simpler like this. It just uses an InputRadioBox with two buttons. You would have to put this rule under the 'before save' event in the Event Triggers dialog box, not in the ' after save'.
Dim bSuppress As Boolean = InputRadioBox("Suppress / Unsuppress All Rules", "Suppress", "Unsuppress", True, "Suppress or Unsuppress All Rules")
Dim oDoc As Document = ThisDoc.Document
Dim oRules As IEnumerable = iLogicVb.Automation.Rules(oDoc)
If oRules Is Nothing Then Exit Sub
For Each oRule As iLogicRule In oRules
oRule.IsActive = Not bSuppress
Next
Wesley Crihfield
(Not an Autodesk Employee)
Can't find what you're looking for? Ask the community or share your knowledge.