Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Immediate parameter update in iLogic rule

Anonymous

Immediate parameter update in iLogic rule

Anonymous
Not applicable

I've searched and incorporated proposed solutions to this, but not finding it working.  Hashed rule posted below.  Below just a step in developing a more comprehensive approach (form input etc).

I want to input a value for a parameter and then be given the value of a dependent function based parameter, then be prompted to adjust the first parameter if required.  However the dependent parameter returned is the old value; it isn't updating immediately.  Relevant Sub is Format_L.  Anyone who can help?  Thanks!

Sub main
	
	'check that this active document is a part file   
	Dim partDoc As PartDocument
	
	'call subs
	SetProjectProperties
	Format_L
	AppendSBPrefix
	InventorVb.DocumentUpdate()
		
End Sub

Sub Format_L
	'Set the relevant left side run length and squab parameters
	Parameter("Length_A") = InputBox("Please enter overall booth run length 'A' in mm", "Layout length 'A'", Length_A)
	Parameter("Squab_No_A") = InputBox("Please enter number of squabs reguired for run length 'A'", "No. squabs run 'A'", Squab_No_A)
	'Set the relevant right side run length and squab parameters
	Parameter("Length_B") = InputBox("Please enter overall booth run length 'B' in mm", "Layout length 'B'", Length_B)
	Parameter("Squab_No_B") = InputBox("Please enter number of squabs reguired for run length 'B'", "No. squabs run 'B'", Squab_No_B)
	'Update the parameters immediately
	RuleParametersOutput()
	InventorVb.DocumentUpdate()
	'Set the relevant carcass parameters
	Parameter("Carcass_Length_Limit") = InputBox("Please enter maximum carcass length for shipping/handling", "Carcass limit length", Carcass_Length_Limit)
	Parameter("Spine_No_A") = InputBox(Spine_Spacing_IS_A, "Please adjust run 'A' spine quantity if required", Spine_No_A)
	Parameter("Spine_No_B") = InputBox(Spine_Spacing_IS_B, "Please adjust run 'B' spine quantity if required", Spine_No_B)
End Sub

Sub SetProjectProperties
	Dim oProject As String
	Dim oProductNo As String

	oProject = InputBox("Enter the Sales Order number", "Sales Order", iProperties.Value("Project", "Project"))
	oProductNo = InputBox("Enter the Product Number for this layout", "Product Number", iProperties.Value("Project", "Part Number"))
	
	'write input back to custom iProperty
	iProperties.Value("Project", "Project") = oProject
	iProperties.Value("Project", "Part Number") = oProductNo
	oPrefix = oProductNo & "_"
	iProperties.Value("Custom", "Prefix") = oPrefix
End Sub

Sub AppendSBPrefix
	'define the active document
	partDoc = ThisApplication.ActiveDocument
	Dim SB As SurfaceBody
	Dim SBName
	
	'write the prefix
	oPrefix = iProperties.Value("Custom", "Prefix")

	'rename all solid bodies incrementing counter (counter not presently used, left in event required later)
	Dim i As Integer
	i = 1
	For Each SB In partDoc.ComponentDefinition.SurfaceBodies
	SB.Name = oPrefix + SB.Name
	i = i + 1
	Next
End Sub

 

 

 

0 Likes
Reply
449 Views
2 Replies
Replies (2)

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Can you please provide sample model data to test the behavior? please make sure that files are non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes

clutsa
Collaborator
Collaborator

You want the immediate value of "Spine_Spacing_IS_B"? You need to use the Parameter("Spine_Spacing_IS_B") function to get it...

Sub Format_L
	'Set the relevant left side run length and squab parameters
	Parameter("Length_A") = InputBox("Please enter overall booth run length 'A' in mm", "Layout length 'A'", Length_A)
	Parameter("Squab_No_A") = InputBox("Please enter number of squabs reguired for run length 'A'", "No. squabs run 'A'", Squab_No_A)
	'Set the relevant right side run length and squab parameters
	Parameter("Length_B") = InputBox("Please enter overall booth run length 'B' in mm", "Layout length 'B'", Length_B)
	Parameter("Squab_No_B") = InputBox("Please enter number of squabs reguired for run length 'B'", "No. squabs run 'B'", Squab_No_B)
	'Update the parameters immediately
	RuleParametersOutput()
	InventorVb.DocumentUpdate()
	'Set the relevant carcass parameters
	Parameter("Carcass_Length_Limit") = InputBox("Please enter maximum carcass length for shipping/handling", "Carcass limit length", Carcass_Length_Limit)
	Parameter("Spine_No_A") = InputBox(Parameter("Spine_Spacing_IS_A"), "Please adjust run 'A' spine quantity if required", Spine_No_A)
	Parameter("Spine_No_B") = InputBox(Parameter("Spine_Spacing_IS_B"), "Please adjust run 'B' spine quantity if required", Spine_No_B)
End Sub
If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes