Good day,
I'm currently writing a script in iLogic that needs to be able to enable the Don't Run Automatically option within it's code. I was therefore wondering if anyone is aware of how to enable this option using iLogic code. Thanks!
Have a good day,
Jonathan
Solved! Go to Solution.
Good day,
I'm currently writing a script in iLogic that needs to be able to enable the Don't Run Automatically option within it's code. I was therefore wondering if anyone is aware of how to enable this option using iLogic code. Thanks!
Have a good day,
Jonathan
Solved! Go to Solution.
Solved by WCrihfield. Go to Solution.
Try this:
Dim oRule As iLogicRule = iLogicVb.Automation.GetRule(ThisDoc.Document, "MyInternalRuleName")
oRule.AutomaticOnParamChange = False
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield
(Not an Autodesk Employee)
Try this:
Dim oRule As iLogicRule = iLogicVb.Automation.GetRule(ThisDoc.Document, "MyInternalRuleName")
oRule.AutomaticOnParamChange = False
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield
(Not an Autodesk Employee)
Thank you very much!
Thank you very much!
hi!
here a rule that will go over all rules in you current document and all rules in all referenced documents
it changes following settings:
-Fire dependant rules Immediately
-Don't run automatically
-silent operation
because it's quite a big edit in possibly a lot of documents I included a popup so I wouldn't run it accidently (which happend before 🙂 )
Happy coding!
edit: @WCrihfield you beat me to it, with a far simpler answer 🙂
Public Class ThisRule Private iLogicAddinGuid As String = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}" Private iLogicAddin As ApplicationAddIn = Nothing Private iLogicAutomation = Nothing Private ruleAutomaticOnParamChange As Boolean = False Private ruleFireDependentImmediately As Boolean = False Private ruleSilentOperation As Boolean = False Sub Main() 'give a pop-up, so you won't run it on accident controle = MessageBox.Show("this rule will change the settings for ALL rules in ALL parts in your assembly" & vbCrLf & _ "current settings:" & vbCrLf & _ " -run on parameter change = " & ruleAutomaticOnParamChange & vbCrLf & _ " -fire dependent rules immediantly = " & ruleFireDependentImmediately & vbCrLf & _ " -silent operation = " & ruleSilentOperation & vbCrLf & vbCrLf & _ "do you confirm?", "edit all ilogic settings",MessageBoxButtons.YesNo) If controle <> vbYes MsgBox("cancelled") Return End If 'add ilogic addin iLogicAddin = ThisApplication.ApplicationAddIns.ItemById( "{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}") iLogicAutomation = iLogicAddin.Automation Dim doc As Document = ThisDoc.Document 'run sub for current doc searchDoc(doc) 'run sub for all referenced docs If doc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject For Each refDoc As Document In doc.AllReferencedDocuments searchDoc(refDoc) Next End If MsgBox("done") End Sub Private Sub searchDoc(doc As Document) Dim rules = iLogicAutomation.Rules(doc) If (rules Is Nothing) Then Return For Each rule As iLogicRule In rules Try rule.AutomaticOnParamChange = ruleAutomaticOnParamChange Catch End Try Try rule.FireDependentImmediately = ruleFireDependentImmediately Catch End Try Try rule.SilentOperation = ruleSilentOperation Catch End Try Next End Sub End Class
hi!
here a rule that will go over all rules in you current document and all rules in all referenced documents
it changes following settings:
-Fire dependant rules Immediately
-Don't run automatically
-silent operation
because it's quite a big edit in possibly a lot of documents I included a popup so I wouldn't run it accidently (which happend before 🙂 )
Happy coding!
edit: @WCrihfield you beat me to it, with a far simpler answer 🙂
Public Class ThisRule Private iLogicAddinGuid As String = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}" Private iLogicAddin As ApplicationAddIn = Nothing Private iLogicAutomation = Nothing Private ruleAutomaticOnParamChange As Boolean = False Private ruleFireDependentImmediately As Boolean = False Private ruleSilentOperation As Boolean = False Sub Main() 'give a pop-up, so you won't run it on accident controle = MessageBox.Show("this rule will change the settings for ALL rules in ALL parts in your assembly" & vbCrLf & _ "current settings:" & vbCrLf & _ " -run on parameter change = " & ruleAutomaticOnParamChange & vbCrLf & _ " -fire dependent rules immediantly = " & ruleFireDependentImmediately & vbCrLf & _ " -silent operation = " & ruleSilentOperation & vbCrLf & vbCrLf & _ "do you confirm?", "edit all ilogic settings",MessageBoxButtons.YesNo) If controle <> vbYes MsgBox("cancelled") Return End If 'add ilogic addin iLogicAddin = ThisApplication.ApplicationAddIns.ItemById( "{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}") iLogicAutomation = iLogicAddin.Automation Dim doc As Document = ThisDoc.Document 'run sub for current doc searchDoc(doc) 'run sub for all referenced docs If doc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject For Each refDoc As Document In doc.AllReferencedDocuments searchDoc(refDoc) Next End If MsgBox("done") End Sub Private Sub searchDoc(doc As Document) Dim rules = iLogicAutomation.Rules(doc) If (rules Is Nothing) Then Return For Each rule As iLogicRule In rules Try rule.AutomaticOnParamChange = ruleAutomaticOnParamChange Catch End Try Try rule.FireDependentImmediately = ruleFireDependentImmediately Catch End Try Try rule.SilentOperation = ruleSilentOperation Catch End Try Next End Sub End Class
Can't find what you're looking for? Ask the community or share your knowledge.