I have a code as shown below that changes the value of 2 angular constraints and then prints out 2 parameters. These 2 parameters are driven parameters and are the length of lines between two parts so I can measure the distance between the two parts as the angles change. However, when I run the code, the original parameter is printed and not the updated ones. Is there any way to solve this?
Dim A As Integer = 3 Dim X As Integer = 225 Dim Y As Integer = 0 For A = 1 To 10 Step 1 X = 225 - (A*5) Y = 0 + (A*5) Constraints.AddAngle("Angle:7", {"253439-L:1", "253394-L:1"}, "Face0", "253392:1", "Face0", X) Constraints.AddAngle("50", "Standard:3", "Face0", "253392:2", "Face1", Y) InventorVb.DocumentUpdate() Parameter.UpdateAfterChange = True i = MessageBox.Show(d242 & " " & d243) Next A
Solved! Go to Solution.
I have a code as shown below that changes the value of 2 angular constraints and then prints out 2 parameters. These 2 parameters are driven parameters and are the length of lines between two parts so I can measure the distance between the two parts as the angles change. However, when I run the code, the original parameter is printed and not the updated ones. Is there any way to solve this?
Dim A As Integer = 3 Dim X As Integer = 225 Dim Y As Integer = 0 For A = 1 To 10 Step 1 X = 225 - (A*5) Y = 0 + (A*5) Constraints.AddAngle("Angle:7", {"253439-L:1", "253394-L:1"}, "Face0", "253392:1", "Face0", X) Constraints.AddAngle("50", "Standard:3", "Face0", "253392:2", "Face1", Y) InventorVb.DocumentUpdate() Parameter.UpdateAfterChange = True i = MessageBox.Show(d242 & " " & d243) Next A
Solved! Go to Solution.
Solved by george0621. Go to Solution.
Glad you solved it.
Just be careful with reusing variables. You use 'I' for iterating, but also for the messagebox. Also you don't need to fill the variables with a value if you refill them in the code. Just declaring them is enough:
Dim A As Integer Dim X As Integer Dim Y As Integer Dim A1 As Double Dim A2 As Double
But at least it works.
Glad you solved it.
Just be careful with reusing variables. You use 'I' for iterating, but also for the messagebox. Also you don't need to fill the variables with a value if you refill them in the code. Just declaring them is enough:
Dim A As Integer Dim X As Integer Dim Y As Integer Dim A1 As Double Dim A2 As Double
But at least it works.
Can't find what you're looking for? Ask the community or share your knowledge.