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: 

iLogic code to enale Don't Run Automatically

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
planetoid127
260 Views, 3 Replies

iLogic code to enale Don't Run Automatically

planetoid127
Explorer
Explorer

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

 

Screenshot 2023-10-23 082540.png

 

0 Likes

iLogic code to enale Don't Run Automatically

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

 

Screenshot 2023-10-23 082540.png

 

Labels (4)
3 REPLIES 3
Message 2 of 4
WCrihfield
in reply to: planetoid127

WCrihfield
Mentor
Mentor
Accepted 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

EESignature

(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

EESignature

(Not an Autodesk Employee)

Message 3 of 4
planetoid127
in reply to: WCrihfield

planetoid127
Explorer
Explorer

Thank you very much!

0 Likes

Thank you very much!

Message 4 of 4

Jacob__with__a__k
Enthusiast
Enthusiast

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.

Post to forums  

Autodesk Design & Make Report