variable

variable

Anonymous
Not applicable
426 Views
3 Replies
Message 1 of 4

variable

Anonymous
Not applicable

Is it possible to make variables in ilogic Vb.net programming code?

0 Likes
Accepted solutions (1)
427 Views
3 Replies
Replies (3)
Message 2 of 4

Owner2229
Advisor
Advisor

What kind of variables? For example, these are variables:

Dim a As Integer
Dim b As String
Dim c As String()
Dim d As Double
Dim e As Object
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes
Message 3 of 4

Anonymous
Not applicable

I mean variables that i can use in other rules and calculations 

0 Likes
Message 4 of 4

Owner2229
Advisor
Advisor
Accepted solution

Well, no. You can't share variables between rules. At least not in iLogic.

Here are some other options you could use:

1) Use VBA or an AddIn

2) Store your "variables" somewhere in the open Inventor file (Parameter, iProperty, Attribute)

3) Re-work your code to work with Sub-Functions:

 

Sub Main()
    'This Sub will execute when your rule starts
    A = 10
    ShowValue(A)
    A = GetNewValue(A, 10)
    ShowValue(A)
End Sub

Private A As Integer

Private Sub ShowValue(B As Integer)
    MsgBox(CStr(B))
End Sub

Private Function GetNewValue(B As Integer, Addition As Integer) As Integer
    Return (B + Addition)
End Funtion

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes