Issues with Parts not updating when changed by ilogic in the Assembly (Inventor 2020)

Issues with Parts not updating when changed by ilogic in the Assembly (Inventor 2020)

rluttrell
Observer Observer
406 Views
4 Replies
Message 1 of 5

Issues with Parts not updating when changed by ilogic in the Assembly (Inventor 2020)

rluttrell
Observer
Observer

I am attempting to make a part that changes the dimensions it uses to determine its sized based on options in the assembly.  Basically it is a curved part that i want to be able to have its length set by either its Angle, long point to long point dimension, or arc length.

 

This is currently my Assembly iLogic.

Parameter("BOT_D_PLT", "METHOD") = Wall_Length_Method

If Wall_Length_Method = "ARC LENGTH" Then
	Parameter("BOT_D_PLT", "Wall_Arc_Length") = Wall_Arc_Length
End If
If Wall_Length_Method = "P2P" Then
	Parameter("BOT_D_PLT", "Wall_P2P") = Wall_Length_Point_To_Poiint
End If
If Wall_Length_Method = "ANGLE" Then
	Parameter("BOT_D_PLT", "Wall_Angle") = Wall_Angle
End If

Parameter("BOT_D_PLT", "Radius") = Outside_Radius
Parameter("BOT_D_PLT", "Width") = Wall_Thickness
Parameter("BOT_D_PLT", "Thickness") = 1.0 in

 

And this is currently my Part iLogic

Dim oDoc As PartDocument = ThisDoc.Document
Dim oCD As ComponentDefinition = oDoc.ComponentDefinition
Dim oSketch As PlanarSketch = oCD.Sketches.Item(1)
Dim oDim As DimensionConstraint

	For Each oDim In oSketch.DimensionConstraints
		If oDim.Parameter.Name = "P2P" Then oDim.Driven = True
		If oDim.Parameter.Name = "ANGLE" Then oDim.Driven = True
		If oDim.Parameter.Name = "ARC_LENGTH" Then oDim.Driven = True
	Next

If Not METHOD = "" Then
	If METHOD = "ARC LENGTH" Then
	For Each oDim In oSketch.DimensionConstraints
		If oDim.Parameter.Name = "P2P" Then oDim.Driven = True
		If oDim.Parameter.Name = "ANGLE" Then oDim.Driven = True
		If oDim.Parameter.Name = "ARC_LENGTH" Then oDim.Driven = False
	Next
	ARC_LENGTH = Wall_Arc_Length
End If
If METHOD = "P2P" Then
	For Each oDim In oSketch.DimensionConstraints
		If oDim.Parameter.Name = "ARC_LENGTH" Then oDim.Driven = True
		If oDim.Parameter.Name = "ANGLE" Then oDim.Driven = True
			If oDim.Parameter.Name = "P2P" Then oDim.Driven = False
	Next
	P2P = Wall_P2P
End If
If METHOD = "ANGLE" Then
	For Each oDim In oSketch.DimensionConstraints
		If oDim.Parameter.Name = "P2P" Then oDim.Driven = True
		If oDim.Parameter.Name = "ARC_LENGTH" Then oDim.Driven = True
		If oDim.Parameter.Name = "ANGLE" Then oDim.Driven = False
	Next
	End If
	ANGLE = Wall_Angle
End If

InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True

 

Both of these seem to work.  But when i change the options in the assembly, the dimensions update their DRIVEN status, but do not update to new values.  If i step into the part and run its rule everything updates as it should.

 

Any advice on how i can make this behave?

0 Likes
407 Views
4 Replies
Replies (4)
Message 2 of 5

A.Acheson
Mentor
Mentor

Hi @rluttrell 

Can you share an image of the browser where the parameter is acting on? 

 

Can you share an image of what is updating and what isn't?

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 5

TKey_Luttrell
Advocate
Advocate

TKey_Luttrell_0-1704721482870.png

here is a part with the sketch

TKey_Luttrell_1-1704721551230.png

current assembly parameters

 

now lets change to the Arc Length method

 

TKey_Luttrell_2-1704721605244.png

note the Wall_Arc_Length parameter is 60 in.

 

TKey_Luttrell_3-1704721645217.png


but the arc length dimension on the sketch is 62.832 in.

 

despite the PART parameters

TKey_Luttrell_4-1704721689575.png

showing 60 as the Wall_Arc_Length

 

now if i run the rule manually in the part (which we know has already been run because the driven dimensions have changed.)

 

TKey_Luttrell_5-1704721745740.png

 

NOW everything is correct

now lets step back into the assembly and change the arc length, just to see if it updates without a change to the driven dimensions

 

TKey_Luttrell_6-1704721923420.png


changed it to 120 in, and it updated immediately.

 

changed the method to Angle.

TKey_Luttrell_7-1704721971400.png

 

As you see the Angle is now the undriven dimension, but it is not 60deg like it should be.

 

TKey_Luttrell_8-1704722018286.png

 

My current theory as to what is happening here.  is that when the rule is called the parameter ANGLE is a Referenced Parameter, and thus cannot be changed, and despite the fact that it IS NOT a referenced parameter when it gets to the point where i tell it to change it still thinks it is, so it doesnt change it.  But when i rerun the rule it is a Model Parameter and can be changed.

0 Likes
Message 4 of 5

A.Acheson
Mentor
Mentor

My assumption is that the parameter isn't updating as the rule is running but after it has ran. This could be due to ilogic API controlling the part parameter at the assembly level. The part parameters at the part level are controlled by the inventor API. 

 

See parameter update method here

  • Parameter.UpdateAfterChange = True

    True will cause the model (document) to Update after a parameter value is changed by the Parameter function. This only takes effect when you change parameters using the Parameter function. For example:

 

See updating the document method here

RuleParametersOutput

If your rule has changed any parameter values, this function applies new rule values to the Inventor model. If this function is not used, the values are not applied until the rule has finished running. Use this function if you must perform an Update using DocumentUpdate. Also use this function if you are using the iLogicVb.RunRule function, so that the other rule gets the new values of the parameters.

Syntax

RuleParametersOutput()

DocumentUpdate

Performs an immediate update in the current document (the document that the rule is in) and updates the display. Use this function if you require that the geometry be rebuilt (for example, you are calculating mass using iProperties.Mass). If the rule fires other rules (by changing parameters), enable the Fire dependent rules immediately option for the rule in the Edit Rule dialog box. This option ensures that the other rules have finished running when you perform the update.

Syntax

InventorVb.DocumentUpdate()

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 5 of 5

TKey_Luttrell
Advocate
Advocate

After more testing i am pretty sure it is the fact that the rules cannot SEE the change from Driven Dimension to Normal Dimension.  ie if i am in Arc_Length mode, and i change the arc length, it will update the arc_length and regenerate the part.  But if i change modes, it will not regenerate the part.  I have tried seperating things out so i am only doing one task at a time, to no avail.  I tried splitting things out into subroutines called by its own rule, with updates called for between each call, to no avail.  And i am out of time to fight with this thing for now, so i am going to have to just accept that things have to be manually regenerated.  But if anyone can come up with a method, please, let me know.

0 Likes