USER DEFINED VARIABLE

USER DEFINED VARIABLE

Anonymous
Not applicable
957 Views
3 Replies
Message 1 of 4

USER DEFINED VARIABLE

Anonymous
Not applicable

Dear All,

 

I need to convert a VBA Code in I-Logic rule. In the VBA Code, I've used several user defined variable:

type name

 par1 as double

 par2 as double

 par3 as double

end type

 

Is it possible to use user defined variable in I-logic? Which is the correct syntax?

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

WCrihfield
Mentor
Mentor

Yes. You can use user defined variables.

However, if you mean custom Class objects, that's a little different.

You would either have to define it within the iLogic rule, or define it within another external iLogic rule, then reference it in the header of the rule.

In iLogic, you don't need to use the keyword "Set" to assign a value to a variable, like you do in VBA.  You also don't need to set the Value of the variable on the next line.  You can directly set its value on the same line, right after declaring the variable's type.

By default you don't even have to declare a variable's type, but it is highly recommended, and enables the "intellisense" like ability within the Rule Editor dialog.

Just simply do like this:

Dim par1 As Double = 3.5

Dim par2 As Double = 8.9

Dim par3 As Double

par3 = 10.85

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 4

Anonymous
Not applicable
Many thanks. I try to better explain my question. In original VBA you can define special variable using the "type" instruction. For example:

Type man
Name as string
Surname as string
Age as double
Height as double
Married as boolean
End type

In the routine you define
Dim worker as man
I would like to know if the same possibility is in I-Logic.
0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor

Sorry. I'm not familiar with that.  Looks very similar to defining the Properties of a Class object, though.  Perhaps if you posted the whole source code, we could translate it for you (as long as nothing is Proprietary or personal).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes