Variable update bug

Variable update bug

S7RM7RPR
Advocate Advocate
344 Views
3 Replies
Message 1 of 4

Variable update bug

S7RM7RPR
Advocate
Advocate

First, I apologise if I'm not clear so if you need clarification just ask and I'll probably reply pretty quick. (assuming it isn't 3 years later)

 

I have a program set up where I am importing some 400 unique values from a database file via a .dll (probably irrelevant) based on specific design criteria. What I need, is to "null" (0, blank, or false respectively) all the parameters in Inventor (Mechanical 2015) whenever I import a new design so that I don't accidentally carry over incorrect data.

 

1. Ideally when I import, if the value is 'nothing' it should set the parameter to null but it appears that it just skips the parameter when it is 'nothing'. When I set the parameters as "parameter("example")" it sees 'nothing' as Boolean and won't update the parameter. I've considered creating a temporary array to convert 'nothing' values, but then I don't know if the value is supposed to be an integer, Boolean or text. 

 

2. When I run the "reset" code and the "import" code separately (as two different buttons), it works cleanly every time. When I run them sequentially, either combined into one rule or as two separate rules, it will reset all values but then it won't update the new imported values - and the values seem to update differently for different designs. For one design it would import every value except for 3 specific values, and then for a different design it would only update 1 value. Then, when you run the logic twice in a row, it will flip-flop between the updated values and null values. I've even added a delay between running import and reset, but it will only work if you run the rules totally separately.

 

At this point my conclusion is that it just seems to be a bug in the way Inventor updates it's values and I have to leave it as two separate functions

0 Likes
345 Views
3 Replies
Replies (3)
Message 2 of 4

S7RM7RPR
Advocate
Advocate

Some example code. I've left out a couple things for reasons so assume that the import function works as is (aside from the whole 'nothing' issue)

 

SyntaxEditor Code Snippet

Sub Main()
    
    IMPORTED = False
    ResetValues()
    InventorVb.DocumentUpdate()
    System.Threading.Thread.Sleep(10000)
    ImportValues()
    InventorVb.DocumentUpdate()
    MessageBox.Show("New design imported.", "Fini.",MessageBoxButtons.OK)
    IMPORTED = True
    
End Sub

Sub ResetValues()
    Parameter("ABC1") = ""
    Parameter("EFG2") = 0
    Parameter("RTU3") = False
End Sub

Sub ImportValues()
    'OUTPUT VARIABLE SETUP IS REMOVED BUT FUNCTIONS CORRECTLY
    output = '.DLL CONNECTION'
    
    ABC1 = output(1)
    EFG2 = output(2)
    RTU3 = output(3)
    
End Sub
0 Likes
Message 3 of 4

bshbsh
Collaborator
Collaborator

In your stripped down ImportValues code, did you define ABC1, EFG2, RTU3 as Parameter("ABC1"), Parameter("EFG2") and Parameter("RTU3")?

0 Likes
Message 4 of 4

S7RM7RPR
Advocate
Advocate
The ABC EFG and RTU variables are the straight Inventor parameters
0 Likes