Expression Handling

General Information

A line beginning with * is ignored.
The return value id the last line that gives a value without assigning it to a variable, for example:
* Not the return value  myVar = Min (1, 2)
* Not the return value  anotherVAR = "someString"
* The return value  substring (anotherVAR, 1, 4)
Can create and use variables by doing the following:
myVAR = 5
Min (3, myVar)
Note that variables are not case sensitive.
If/else if/else flow control is available, for example:

myVar = 4.5

if (myVar 1t 4) then
"myVar is 4"
elseif (myVar gt 5) then
"myVar is greater than 5"
else
"myVar is between 4 and 5"
endif
TRUE is signified by the value 1, FALSE is signified by the value 0.

Expression Functions

Arithmetic Operators

Operator

Example

Result

Comments

=

5 = 3

8

-

5 - 3

2

*

5 * 3

15

/

5 / 3

1.666666

^

5 ` 3

125

Exponent

Logical Operators

Operator

Example

Result

Comments

and

3 eq 3 and 3 eq 4

0

or

3 eq 3 or 3 eq 4

1

xor

3 eq 3 xor 4 eq 4

0

not

not (3 eq 3)

0

eq

3 eq 3

1

Numeric "is equal"

ne

3 ne 3

0

Numeric "is not equal"

gt

4 gt 3

1

Numeric "is greater than"

lt

4 lt 4

0

Numeric "is less than"

ge

4 ge 3

1

Numeric "is greater than or equal to"

le

4 le 4

1

Numeric "is less than or equal to"

eqs

"au" eqa "au"

1

String "is equal"

nes

"au" nes "au"

0

String "is not equal"

gts

"10" gts "09"

1

String "is greater than"

lts

"au" lts "au"

0

String "is less than"

ges

"10" ges "09"

1

String "is greater than or equal to"

les

"au" les "br"

1

String "is less than or equal to"

Numeric Functions

Function

Example

Result

Comments

ln

ln(2)

0.693147

Natural log

exp

exp(2)

7.389056

Power of Euler's number

log

log(2)

0.30103

Log base 10

sin

sin(3.141593)

0

Sine in radians

cos

cos(3.141593)

-1

Cosine in radians

tan

tan(0.785398)

1

Tangent in radians

asin

asin(0)

0

acos

acos(0)

1.5708

atan

atan(1)

0.785398

sqrt

sqrt(16)

4

int

int(1.9)

1

Remove decimals

frac

frac(1.9)

0.9

Only decimals

abs

abs(-5)

5

Absolute value

sgn

sgn(-8)

01

Sign (positive, negative, neither)

mod

mod(1.1, 0.2)

.01

Modulus

Mac

mac(1.1, 0.2)

1.1

min

min(1.1, 0.2)

0.2

String Functions

Function

Example

Result

Comments

match

match("a*1%34", "aBcD1234")

1

* for any series of characters, % for any single character

upcase

upcase("aBcD1234")

"ABCD1234"

lowcase

lowcase("aBcD1234")

"abcd1234"

ljust

ljust("  aBcD1234  ")

"aBcD1234 "

Removes any spaces on the left

rjust

rjust("  aBcD1234  ")

" aBcD1234"

Removes any spaced on the right

pack

pack("  aBc  D1 234  ")

"aBcD1234"

Removes all spaces

substring

substring("aBcD1234", 2, 5)

"aBc"

subleft

subleft("aBcD1234", 3)

"aBc"

subright

subright("aBcD1234", 5)

"D1234"

format

format(32, "I3")

" 32"

See Fortran format documentation. Note that the result is a string, not a number.

Polyline Functions

Function

Example

Result

Comments

NumPoints

NumPoints()

Number of points on the polyline

GetX

GetX(2)

The X coordinate of the second point of the polyline

GetY

GetY(2)

The Y coordinate of the second point of the polyline

GetZ

GetZ(2)

The Z coordinate of the second point of the polyline

DeltaX

DeltaX(1, NumPoints())

The difference in X between the first and last points of the polyline

DeltaY

DeltaY(2, 5)

The difference in Y between the second and fifth points of the polyline

DeltaZ

DeltaZ(1, 2)

The difference in Z between the first and second points of th epolyline

Bearing

Gradient(1, 3, "deg")

The bearing in radians from the first point to the second point of the polyline

"rad" for radians, "dd" for decimal degrees, "dms" for degrees,minutes,seconds

Gradient

|                   |                   |

The gradient in degrees from the first point to the third point of the polyline

"per" for percentage, "deg" for degrees, "grd" for gradians, "rto" for ratio

PolyLength

PolyLength()

The length of the polyline

PolyLength("km")

The length of the polyline converted to kilometres

Distance unit options: "cm", "m", "km", "ft", "yd", "mi"

PolyArea

PolyArea()

The area of the polyline

PolyArea("ac")

The area of the polyline converted to acres

Area unit options: "cm", "m", "km", "ha", "ft", "yd", "mi", "ac"

PolyVolume

PolyVolume(20)

The volume of the polyline given a thickness of 20

PolyVolume(20, "acft")

The volume of the polyline given a thickness of 20 converted to acre-feet

Volume unit options: "cm", "m", "km", "ft", "yd", "acft"

PolyTons

PolyTons("bmodel.bmf", "-X -bm 0 500 0 500 0 500", "density", 1.8, 20, "top")

The mass of material in the polyline given thickness 20 and alignment "top"

"First, a triangulation is created from the polyline, the given thickness, and the given alignment

Next, reserves is run with the specified block model, block selection flags, density variable,

and default density

The result is the total mass

Alignment options: ""top"", ""mid"", ""bot"""

PolyGrade

PolyGrade("bmodel.bmf", "", "au", 0, "wbm", "density", 1.8, 20, "bot")

"The grade of selected material in the polyline given thickness 20

and alignment ""bot"""

"First, a triangulation is created from the polyline, the given thickness, and the given alignment

Next, reserves is run with the specified block model, block selection flags, grade variable, default grade,

accumulation method, density variable, and default density

The result is the grade

Alignment options: ""top"", ""mid"", ""bot""

Accumulation options: ""wbm"", ""wbv"", ""sum"""

PrimHeight

PrimHeight()

The height of the primitive attached to the polyline

PrimWidth

PrimWidth()

The width of the primitive attached to the polyline

PrimArea

PrimArea()

The area of the primitive attached to the polyline

PrimArea("ha")

The area of the primitive attached to the polyline converted to hectares

Area unit options: "cm", "m", "km", "ha", "ft", "yd", "mi", "ac"

PrimVolume

PrimVolume()

The volume of the primitive attached to the polyline

This is the volume of the triangulation resulting from the chosen primitive and the polyline

PrimVolume("ft")

The volume of the primitive attached to the polyline converted to cubic feet

Volume unit options: "cm", "m", "km", "ft", "yd", "acft"

PrimTons

PrimTons("bmodel.bmf", "-X", "density", 1.8)

The mass of material in the primitive attached to the polyline

"First, a triangulation is created from the polyline and either:

1. The attached primitive

2. The named primitive with specified vertical alignment, height, and width

Next, reserves is run with the specified block model, block selection flags, density variable,

and default density

The result is the total mass

Primitive vertical alignment options: ""top"", ""mid"", ""bot"""

PrimTons("bmodel.bmf", "", "density", 1.8, "MTKPRIM11", "mid", 10, 10)

"The mass of material in the described primitive

as if it were attached to the polyline"

PrimGrade

PrimGrade("bmodel.bmf", "-X", "au", 0, "wbv", "density", 1.8)

The mass of material in the primitive attached to the polyline

"First, a triangulation is created from the polyline and either:

1. The attached primitive

2. The named primitive with specified vertical alignment, height, and width

Next, reserves is run with the specified block model, block selection flags, grade variable, default grade,

accumulation method, density variable, and default density

The result is the grade

Primitive vertical alignment options: ""top"", ""mid"", ""bot""

Accumulation options: ""wbm"", ""wbv"", ""sum"""

PrimGrade("bm.bmf", "", "au", 0, "wbm", "dens", 1.8, "MTKPRIM1", "mid", 10, 10)

"The mass of material in the described primitive

as if it were attached to the polyline"