Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Suppress all Rules Rule

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Shag_Bore
164 Views, 1 Reply

Suppress all Rules Rule

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:

rule1.PNG

 

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!

Sean Farr
Product Designer at Teksign Inc.
Inventor 2016 SP1
Dell Precision 3660
i7-12700 @ 2.40GHz-4.90GHz
32GB DDR5 4400MHz RAM
NIVDIA RTX A2000 6GB
1 REPLY 1
Message 2 of 2
WCrihfield
in reply to: Shag_Bore

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

EESignature

(Not an Autodesk Employee)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report