You are on page 1of 31

1

STRING MATHS EXPRESSIONS

NEW REMARKS

_layer_next_slope >>> to place Gradient from 1st pt. to next pt. in D field.

_SEGMENT_3DLEN >>> Length of seg. In D field. 2D OR 3D.

FORMAT(D1,3) Set # of decimal places in D field to 3.


---------------------------------------------------------------------------------------------------------
To reverse sections for viewing in opposite direction.
1. Create files in normal section mode.
2. Use file tools- string maths – nominate files - range and id.
3. In string range box – place “ all”
4. Leave constraint box blank.
5. Field box – place “x” or “y” or”z” depending on sections.
6. Expression = -1 * X or y or z. The minus one turns data to mirror image.
7. Normal plotting can proceed – make note of this in title block for recognition.
8. Negative values will be produced.
------------------------------------------------------------------------------------------------------------
_SEGMENT_AREA @AREA Area of closed segment.

_STRING_AREA

X=X+30 Graphical movement of X or Y

ALL D1 = 2005-12-05 Date stamp on all points in file.

_FILE_POINT_NO Point number in D field

_file_segment_no Segment number in description filed.


2

D4= _SEGMENT_AVE_D1 Average grade of a Polygon


------------------------------------------------------------------------------------------------------------
When a string file already contains point numbers in the d1 field. A way to keep the point
numbers the same, yet add a 1-,2-,3- etc in front of the existing point numbers in the d1
field along a whole segment.
1. d1 = point number
2. d2 = d1+1
3. d3 = “-“
4. strcat(d2,d3,d1)
5. this will solve this problem

D1=_file_segment_no

D1 = ‘ ‘ to clear desc fields.

All >> d1>> = FRANDOM() to place a random number between 0 and 1 in desc
field.

_string_sum_d1 Sum drill metres in a blast design string.


Assign this to another desc field. Can use segment or file
instead of string.

Transform plan to section or long section

String maths

Plan to section

Y=Z
Z=Y

Plan to long section

Y=Z
X=Y
Z=X

To reverse the data in sections use


3

x= -1 * x

put the volume in the ore blocks in the d4 field using the expression below (d5 contains
the thickness of the ore block). The volume in the string file has a large number of
decimal places, up to 17.
I am also plotting the d4 field on a map and if there are more than 12 decimal places it
plots them all, despite the fact that the number of decimal places in the entity is set to
zero
Try this

D4 = format(d5*_segment_area,2)

It will format it to 2 decimal places

nint(d1) gives the nearest integer.

To shrink files -Logo files etc.


Z does not matter.

X= X=X/10
Y= Y=Y/10

Display running chainages along a string/segment.


_clen2d - horizontal distance
D2 = _clen3d - slope distance

Place Dip in desc.field.


_prev_dip

I have imported a set of contours from mapinfo into surpac and would like to assign the z
value to the contours to construct a dtm. The z value is stored in D4 of the first point in
each segment. All the remaining points in each segment have no attributes.
It’s a bit of a trick. Normally when you do things with string maths, you are treating each point
separately. In this case you have something stored in one field of 1 point and you want to apply it
to each point so it’s a bit more difficult. The good news is it can be done.

You have to use two lines in String Maths. See the attached image to see how it is set out. You
must use a temporary field.
4

-----------------------------------------------
New string maths--- text in d fields --- d1 = ‘this is a label’
----------------------------------------
I have a string file with Y, X,Z points with several data fields D1 to D13. Can I create a D14 field
ie a new data field which is the product of D10 and D12 fields without having to reimport a csv file
with the added fields
Yes, you can create a value in the D14 field using string maths in the edit menu.
The question is what is the result you are chasing.
To add the two you would do the following: D14 = D10+D12
To stick the two values together (i.e text) use: D14 = STRCAT(D10,D12)
If you hit the help button on the string maths form and follow the link to expressions you will be
taken to a comprehensive list of mathematical expressions that can be used.

--------------------------------------

Block Maths- (Block Models)

To export each block volume in model-

Create attribute- blk volume>>calculated or real.>> expression>>

_xext*_yext*_zext

-Export these after attribute is created.


5

I have imported a set of contours from mapinfo into surpac and would like to assign the z value to
the contours to construct a dtm. The z value is stored in D4 of the first point in each segment. All
the remaining points in each segment have no attributes.

I am not sure of the correct syntax to use for this expression “for each segment, z = D4 of first
point

It’s a bit of a trick. Normally when you do things with string maths, you are treating each point
separately. In this case you have something stored in one field of 1 point and you want to apply it
to each point so it’s a bit more difficult. The good news is it can be done.

You have to use two lines in String Maths. See the attached image to see how it is set out. You
must use a temporary field.
----------------------------------------------------------------
The function to look in the reverse direction is
Database>>sections>>reverse view direction.

To look south on plots that have already been extracted as


string you will need to use the expression

X=-1*x in string maths reassign the corner co-ord to the


negative value of the easting
--------------------------------------------
Attached are two string files
The first, rqd_1pct1515 contains drill traces through a level with lith
details as
string 71 and rqd % details as string 21. The d1 field contains the
range
for
rqd values:
0-25% = 1
25-50% = 2
50-75% = 3
75-90% = 4
90-100% = 5
I am trying to get the d1 value into the d2 feild as a colour for
plotting
purposes
but can't get the string maths right?

I have been trying with if statements such as


string 21, field d2, iif(d1=1, "RED", "")
string 21, field d2, iif(d1=2, "MELON", "")
string 21, field d2, iif(d1=3, "MAIZE", "")
string 21, field d2, iif(d1=4, "GREEN", "")
string 21, field d2, iif(d1=5, "BLUE", "")

Aaron here believes this statement should work, please give this a try.
6

iif(d1=1,"RED",iif(d1=2,"MELON",iif(d1=3,"MAIZE",iif(d1=4,"GREEN",iif(d1
=5,"BLUE","")))))

Probably, the easiest way around this problem is to:


1. Recall the dtm to the screen that you wish to slice
2. go to solids>>edit trisolations>>renumber to object 350
trisol 1 ( no need to save this change)
3. go to solids>>solid tools>>create sections. Set a slicing
axis and the name of the resulting files.

You will note that at the end of the slicing the string files will
have the string numbers the same as the original object …
ie 350.

If you really wish to use the existing string files then:

1. use string maths to assign the string number 350 to a d


field for all of the slices
2. Use the function File>>import>>data from many files
(string) with the field containing the new string number
as the selected value for the new string.

Try the following block maths to convert your attribute values.

1. iif(ore==”highgrade”,1,0) where ore is the attribute you want to source from and
highgrade is the text you want to look at.
2. The same argument can be extended for multiple outcomes :
iif(ore==”highgrade”,1,iif(ore==”lowgrade”,2,0))
7

------------------------------------------------

Attached is a typical survey file - the string concerned is 575. There are 3 different
segments with D1 = xxx. This is to be deleted and everything else remains - or even on
the rest of string 575 is to be placed into a separate file. The string 575 is then used in
running a macro for drive solid modelling minus the 'xxx' segments. I need the 'xxx'
segments to remain as string 575 for processing by others.

Try this idea for size.

Using string maths do the following:

Z = iif(d1==”xxx”,0,d1)

This says if d1 is xxx then make the z value 0. You can then quickly check the result to make sure
that it is correct and delete the information that is not required.
Whenever using string maths you must put all character based entries in double quotes
eg d1 = “Stage 4”

-------------------------------------------------
We have some problems, using Surpac 5.1, with Arc View shape files after
the importation.

The string file created has a lack of data. Only the first points of the
segments have descriptions. It keeps the coordinates but with no
descritions.

You can use layer maths or string maths to set the elevations for each
point. See below

set status [ SclFunction "GRAPHICS LAYER MATHS" {

frm00702={

strrange="Y"

main=table { str_range constraint field expr } {

{ "" "_first_string_point" "_tmp1" "d1" }

{ "" "" "z" "_tmp1" }

{ "" "" "" "" }

{ "" "" "" "" }

{ "" "" "" "" }


8

{ "" "" "" "" }

{ "" "" "" "" }

{ "" "" "" "" }

{ "" "" "" "" }

{ "" "" "" "" }

}]

----------------------------
I'm trying to change some descriptors in a string file, it has a
character descriptor and I want to change in a numeric descriptor...

You could see in the attached file, I have in the 2nd descriptor
geological information as a character and I want to have it like numeric
information to have each string like a different geological unit...ex
Unidad 4----string 1

Another approach is to use STR MATHS to set D2 to have an integer, then


use IMPORT COORDINATES (IMPCOORDS) to import the D2 field as the string
number.

STR MATHS might look something like this:


D2 = iif(d1=="Unidad 4",1,iif(d1=="Unidad 1ab",2,iif(d1=="Unidad
3",3,666)))

Might be a bit messy, depends how many codes you have. There will be a
limit to how many characters can be entered into the STR MATHS field.

I am trying to get dips plotted together with a symbol plotting dip


direction and strike. I am able to get the symbol to plot correctly in
the dip direction (stored in D1 field in data file) but was unable to
get the dip direction (D2 field in string file) plotted at the end of
dip direction marker in symbol.

1. Create D3 = D1-90
2. Create new string file (bodi1.str) from your old string file
(bodi11.str) using string maths: x = x + l*SIN(D1/180*3.14);
y=y+l*COS(D1/180*3.14)
3. Use GEODIP, GEODIP2 entities and GEODIP map for your string
file
-------------------------------
How do you write an expression in block maths to assign a value of
attribute mcost = $11,500 to all blocks east of co-ordinate y=5550 and
above RL= 499?
9

- Create the attribute mcost if you have not already done so.

Envoke the Block Maths Function:


Attribute Name: mcost Expression: 11,500 – if your attribute field
is numeric or “$11,500” if text.Constrain the interpolation by x plane
above 5550 and z plane below 499.

can you create a D1 field entry in every point on a segment , with the
distance along the segment , as in chainage from 0.0 being the start
point chainage ?

Just use the syntax as d1=_next_clen3d


or
Fill out the form as shown below and in the D1 field will be 3d length
of the segment up to that point (using the first point of the segment as
0.0m) and in the D2 field will be the total 3d length of the segment.

Just use Edit >> Segment >> Maths and follow the form below and then
select the segment you want to apply chainages to. Note in the 3rd
expression I have used the format qualifier to format the result to 2
decimal places – you may want to change this.

Calculating ounces in the block model.

Make a calculated attribute in the following manner

Au_OZ = (_xext*_yext*_zext*sg*au)/31.1034

See the detail from the reference manual below:


10

Expression

Enter a free format algebraic expression to define the operation to be


performed so that a new value can be calculated and then assigned to the
named attribute field. The expression may include be any expression
allowed by the generic expression syntax <file:///C:\ssi_V5.0-
M\share\refman\default\start\exp.htm> with the addition of :

* Attribute field names - expressed by using the actual field name,


e.g. gold
* Special attribute names (case sensitive)

_xorg - x coordinate of block origin


_yorg - y coordinate of block origin
_zorg - z coordinate of block origin

_xext - x extent of block


_yext - y extent of block
_zext - z extent of block

_xcen - x coordinate of block


_ycen - y coordinate of block
_zcen - z coordinate of block

The problem i am having is that i have to use two different blockmodels,


but the product numbers are different for each model. I would like to
know how to say for example assign an attribute "lat" to be equal to two
other product numbers, 2 [lp] and 3 [lv], there are no dtms for these lp
and lv values so i cannot assign a value/constraint , i have applied a
iff function; "iffnumproduit=2,3" this works for numproduit 2 but not
3, how do i get it to equal both product numbers, they developed as both
character and integer values.

The syntax that you need in your new calculated attribute or just using
block maths is:

New_attribute=
iif(numproduit=”lp”,2,iif(numproduit=”lv”,3,numproduit))

This translates to if numproduit = lp then assign the value 2 and if


numproduit = lv then assign the value 3, otherwise set the value to
numproduit.

You can use the layer maths function to asssign the x value of the FIRST point in a
segment to the d1 fields.

String>> constraint >> field >> expression


11

blank>> _first_segment_point >> _tmp1 >> x


blank>> blank >> d1 >> _tmp1

To concatenate two fields together you can use the layer maths for that as well. Use the D1 field
and an expression of STRCAT(D1,D2).

As for your suggestion on naming the D1 field something more useful, the file structure
of a string file is the reason why they are called D1,D2,...
This allows the surpac user to have a greater flexiblity to store information. If we were to
have fields like "GRADE" then not all users would use that and the string files would
become too large.

Block Maths- Metal in Block – Grade * _xext*yext*zext*sg

Blast number,hole number,bench number in d1,d2 had hole number orig.


Desc=,107 - original
Desc=33562021129,,,,,112 -after

--------------------------------------------------------------------------------

The file was generated by importing a MapInfo table of ground contours, which had the Z value
stored in a separate field in the table. It appears that the import process has only assigned this Z
value to the D1 field of the first point of every segment. I would like to assign this D1 value to the
Z of every segment/string. Can you suggest a way of achieving this?

Constraint = _first_string_point
Field = tmp1
Expression = D1

This first line puts the value of the d1 field of the first point into a temporary field.
12

on the next line do the following:

field = z
Expression = tmp1

This will assign the value stored in tmp1 to the z of all the points so long as you have the
constraint blank.

Blast number in d field.

I was wondering how to get field and then note. In the file attached I wwould like it to look like
'0.75g/t' not how it is displayed now as G/T0.75 how do I do this? ALso I want to display string
segment 12.1, 12.2 etc how do I do I seem to get 12.0 please look at my entity in the attachment.

Unfortunately the note+field only works by putting the note part first, then the field. As a way
around this, you could use string maths and setup and equation such as:

D2 = STRCAT(d1,”g/t”) - assuming your grade is stored in the D1 field. This will concatenate the
two values together to form one string. Then you just need to plot the field d2.

I think the problem with the segment number is that programmers start counting from 0 so the first
segment is actually segment 0. Again I would probably use string maths to put the value into a
description field and then plot that description field.
13

For example:

D3 = STRCAT(_file_string_no,”.”,_string_segment_no)

---------------------------------------------------------------------------------------------

Does anyone out there have a nice method for creating DTM’s from vertically oriented string
files? I have an Xplorpac client that would like to import vertical sections of IP data into Xplorpac
as text files. The client would then like to build DTM’s and colour these DTM’s by the attribute
that he has stored in the d1 field.

I have considered contouring (since these can be re-transformed into a sectional orientation after
contouring is complete) but would prefer to use DTM’s. I understand why this will not work with
the standard DTM tool and if anyone can offer me a work around I would appreciate it greatly.
Please see the attached image for an example of what I would like to do (except that the
attached image is the sectional data already rotated into plan view).

If you transform the section to plan, then create a DTM, you can
use layer maths on the DTM layer to transform the DTM back to
section in the same way as you suggest for contours and
the triangles will be transformed to be vertical instead of
horizontal.

I am generating a file for uploading to a Survey instrument and wish to place the value 1A, 2A, 3A
etc in the D1 field of each successive point. I thought I would be able to use the STRCAT function
to do this as in: STRCAT(_string_point_no, A) to do this.

The problem here is that Surpac is looking for some kind of field value called A, which of course
does not exist. If you want to use a string of text, you need to enclose it in quotations.

D1 = STRCAT(_string_point_no,”A”)

The file was generated by importing a MapInfo table of ground contours, which had the Z value
stored in a separate field in the table. It appears that the import process has only assigned this Z
value to the D1 field of the first point of every segment. I would like to assign this D1 value to the
Z of every segment/string. Can you suggest a way of achieving this?

Fill in the form in the following way:


14

Constraint = _first_string_point
Field = tmp1
Expression = D1

This first line puts the value of the d1 field of the first point into a temporary field.
on the next line do the following:

field = z
Expression = tmp1

This will assign the value stored in tmp1 to the z of all the points so long as you have the
constraint blank.

Could you please confirm the following is true: “not < 48.5” is the same as “>=48.5”. Testing it
with a block model seems to indicate that it is the same, but am not 100% sure.

Yep. Logic is absolutely correct. In fact thats how Surpac records it when you do it in a macro

------------------------------------------------------------------------------------------------------------

When using string maths to make D1 = point number ('ptno') actual point number changes to ptno not the
point number as help suggest.

The use of 'ptno' is for use with the old string maths function which is still available use, however
does not provide a great deal of functionality. The new string maths uses the following format:

d1 = _string_point_no

@slope is the option you want to use in the create centroids from dtm
> triangles function, with Z as the required field.
>
> This will create a string file with z representing the slope of the
> triangles.
>
> You have several options from here, you could use string maths to copy
> the slope into a dfield and then drape the string file over the dtm.
>
> Another possibility is to do a countour of the raw string file and
> then drape the resultant contour lines.

Is there a way to truncate a string using string maths? For example I have d1 = 16/01/2007 and I
only want it to say 16/01

This should be possible. To give you a head start on figuring it out, you need to use the string
handling functions in the expression toolkit. Something like this should work, or at least go close:
15

d1 = substr(d1, 0, rindex(d1, "/"))

To explain how this works, rindex(d1, "/") returns the offset to the last instance of / in the d1 field

substr gives a substring of the d1 field starting at offset 0, the start of the string, for a length of the
value returned by the rindex() function. In the example you provided rindex() will evaluate to 5 so
the the resultant string will be "16/01" which is what you want.

Now this may not work if the D1 field DOESN'T have / characters. If you need to make it bullet-
proof you should use an iif() expression as well.

Could you please look at this file and suggest any way of automatically
> calculating the dip run North South and East West between each points.

I used String maths and degtodms(_prev_dip).

For getting the values E-W, I sorted your string file in Excel and then
made a string file and then string maths again.

I was wondering whether I could just rotate the blk model data by bearing about a point and then
shift it manually so no scale factor is involved….. have to make sure I get the right matching co-
ords first.

The block maths involved to check is:

The scale factor formula would be: (new cords) Square root((x1-x2)2 + (y1-y2)2) / (old cords)
Square root((x1-x2)2 + (y1-y2)2) = ~1

Please advise if there is an option to CONCATENATE D-fields using string maths: say, d1 is
“CH00” and d2=_string_id. I’d like to get d3=CH001.

You can use STRCAT (d1,d2), which will give you the desired result

This should write the first point values in the d1 field in all of the z values for all strings.
Layer Maths-
16

What we are chasing is to scale the contour plan in the x direction only. Points of reference will be
each end of the most southern contour and approximately 81.5% from the right hand side,

Sorted out the problem with a simple formula (applying string maths)

x = iif(x<10000,0.181*(10000-x)+x,x)

1. To place the accumulated 2d distance along a string in the D1 field, and the complete
distance along the string in the D2 field the following can be used:

String Range Constraint Field Expression

all _first_string_point _tmp1 0

D1 _tmp1

_tmp1 _tmp1 + _next_2dlen

_string_D2 _tmp1
17

1. If string 1 has the grade for each point in D1 with missing values being set to -1 then the
average grade for each segment can be calculated to D2 using the first block of
expressions below. The second block places the grade as a percentage of the average
grade for the segment in D3 with missing values set to nothing. Note that the second
block is started by a non-blank string range value and is not processed until after all the
points have been processed with the first block.

String Range Constraint Field Expression

1 _first_segment_point _tmp1 0

_first_segment_point _tmp2 0

D1 >= 0.0 _tmp1 _tmp1 + D1

D1 >= 0.0 _tmp2 _tmp2 + 1

_segment_D2 IIF(_tmp2 > 0, _tmp1/_tmp2, 0.0)

1 D1 >= 0 D3 IIF(D2 != 0.0, D1/D2*100.0, 0.0)

D1 < 0 D3 ""

2. To swap the x and y fields:

String Range Constraint Field Expression

all X Y

Y X

Note that since the fields for a point are not assigned until after all expressions for the
point are calculate it is not necessary to use a temporary when swapping values.
18

the string number (changed) to equal the z field.

<<File>>import>>data from many files>>


When asked the order of the fields, give the string no as field 4

I would convert the z to an integer first to avoid any errors (NINT(z).

is there a TCL command for rounding numbers to x decimal points? In the old CMD language I
used to use the INT command to round numbers – this doesn’t work for me in the TCL language.

Example of setting decimals

set twoDlength [format "%8.3f" $D2_length]

the command is format

d3 = _segment_ave_x
d4 = _segment_ave_y
d5 = _segment_ave_z

this will give the average x, y, and z of all the segments you select and put the result in the d3 ,
d4 and d5 fields
19

You could get a convex hull of the data by:

1) appending the string data from all solids into one file (let’s just call it alldata.str)
2) create a DTM from alldata.str using all strings as spot heights
3) use DTM boundary to get the convex hull of alldata.dtm
4) set Z value of the resultant string using string maths (if needed)

Placing alpha in desc fields.(incrementing)

String Maths allows you to modify the data in a string file (or a number of string files)
replacing the fields associated with each point (x, y, z, and the description fields D1, …)
with values calculated using generic expressions.

Similarly, the GRAPHICS variants all work on the current active layer, or the selected
portions of the current active layer. All these functions also use generic expressions.

Note: These functions are enhanced versions of the older, redundant functions. The older
functions are still available so that any existing macros which use them will still run
correctly although the menu options will invoke the new function instead of the old ones.
The old functions that relate to these new functions are :
20

 STRING MATHS
 GRAPHICS STRING MATHS
 GRAPHICS SEGMENT MATHS
 GRAPHICS POINT MATHS

Choose String Maths from the File Tools menu to display the STRING MATHS form,
or select one of the Edit->(graphics part type)->Maths functions to display the
GRAPHICS STRING MATHS form.

Define the files to be processed

Specify the range of files to be processed by entering the Location and ID Range. This
field has no bearing on the GRAPHICS functions and so does not exist on the form.

Define the files to be created

Define the Location code for the range of files to be created. This Location can be the
same as the Location given above if you desire the output files to have the same names
as the input files.

This field has no bearing on the GRAPHICS functions and so does not exist on the form.

A scrolling region exists for defining the expressions to be assigned to fields. The
columns in this scrolling region are:

String Range

The range of strings to apply this assignment and the assignments in subsequent rows up
to the next non-blank String Range. The special value of "all" can be used to indicate that
the range applies to all strings in the file.

The string range field only applies to the STR MATHS and GRAPHICS LAYER MATHS
functions, all others do not display this field.

Each block of assignments for a particular string range is completely processed before the
next string range is considered. In this way it is possible to calculate the average grade for
each segment and assign it to a _segment_Dn field and then use that average grade value
in a block of assignments for a later string range.

Inappropriate use of non-blank string ranges, especially all, can cause very different
results to what might be expected. Results of an operation are committed as soon as a the
next non-blank range is encountered, or the last operation is processed. Inappropriate
placing of non-blank string ranges may cause operations to produce unexpected results.

This approach is necessary as it would be impossible to swap the contents of fields


otherwise. This is best demonstrated by example:
21

Example of correct usage to swap fields

This example swaps the contents of the X and Y fields by first assigning the the X field to
the Y field. Recall that this operation is not committed at this time because if it were then
both the X and Y fields would contain the value of the X field. The Y field is then
assigned to X field. As this is the last operation the results are now committed to the
target fields.

String Range Constraint Field


Expression
all y x
x y

Example of incorrect usage to swap fields

This example attempts to swap the contents of the X and Y fields as in the above
example. The result though is not as expected because the presence of a non-blank range
for the second operation causes the first operation to be committed. The outcome is that
the X and Y fields both contain the same value, that of the original X field.

String Range Constraint Field


Expression
all y x
all x y

Constraint

An extra constraint to limit which points will be updated using this assignment. This is a
generic expression which must have a boolean value. As an example the Constraint can
be used to limit the assignment to the first point in each segment, or to only apply the
assignment to closed segments.

Field

The field to be assigned with the result of the following expression. The field can be one
of X, Y, Z, or Dn where n is an integer greater than or equal to one. Dn represents the
nth description field. As well as these values for the fields of a point they can be prefixed
by _segment_ , _string_, or _file_ to update the field for all the points in the segment,
string, or file respectively. When these special prefixed fields are used the expression is
calculated at the end of processing for the respective segment, string or file and then the
22

field in all the associated points is update. That is rows assigning explicit point fields are
completed for each point of the segment, string or file before the expression for segment,
string, or file fields is evaluated. Within the assignments for a given string range it is also
possible to use temporary variables known as _tmp1, _tmp2, … to store intermediate
values.

Expression

The expression whose result will be assigned to the indicated field. The variables which
can be used in an expression are detailed below:
X The value of the X coordinate of the point
Y The value of the Y coordinate of the point
Z The value of the Z coordinate of the point
The value of the nth description field for the
Dn
point
The value of the nth temporary variable for this
_tmpn
string range grouping
An aggregate value of the form:

_<entity>_<aggregate>_<field> Return an aggregate value calculated from the


points in a segment, string or file depending on
where: the first part of the variable name. Only numeric
values are included in the aggregate, so that, for
<entity> is one of file, segment, or example, averages do not included blank values.
string, The second part indicates if the value is the
minimum value, maximum value, sum, the
<aggreate> is one of min, max, sum, average, or the count of numeric values of the
ave, or num and field indicated in the third part of the variable
name. The aggregate value is calculate before
<field> is one of x, y, z, or Dn any points are updated for this string range
block.
For example, the minimum x value in a
string is given by: _string_min_x
Get the position of the string within the file. The
_file_string_no first string in the file is considered to have a
position of one.
Get the position of the segment within the file.
_file_segment_no The first segment in the file is considered to have
a position of one.
_file_point_no Get the position of the point within the file. The
23

first point in the file is considered to have a


position of one.
_string_segment_no Get the position of the segment within the string.
_string_point_no Get the position of the point within the string.
_segment_point_no Get the position of a point within the segment.
_file_location The location of the current input file.
_file_id The ID of the current input file.
_string_id The ID of the current string.
A calculated value of the form:

_<entity>_<value>
Return a calculated value for the current file,
<entity> is one of file, segment, or
string, or segment. The values which can be
string, and
returned are the total area, 2d length, 3d length,
or a true/false value depending on whether or not
<value> is one of area, 2dlen, 3dlen,
all the segments are closed.
or closed.

For example, the area of a segment is


given by: _segment_area
_first_file_string Return true for the first string within a file.
_first_file_segment Return true for the first segment within a file.
_first_file_point Return true for the first point within a file.
_first_string_segment Return true for the first segment within a string.
_last_string_segment Return true for the last segment within a string.
_first_string_point Return true for the first point within a string.
_last_string_point Return true for the last point within a string.
_first_segment_point Return true for the first point within a segment.
_ last_segment_point Return true for the last point within a segment.
_prev_<field> Return the value of the field for the previous
point in the segment. This value is before any
where: assignments to the previous point. If one of these
values is used for the first point of a closed
segment it returns the value for the last point in
24

<field> is one of x, y, z, or Dn. the segment (excluding the final closing point). If
one of these values is used for the first point in
For example, the x coordinate for the an open segment it returns zero.
previous point is given by: _prev_x
_next_<field> Return the value of the field for the next point in
the segment. If one of these values is used for the
where: last point of a closed segment (excluding the
final closing point) it returns the value for the
<field> is one of x, y, z, or Dn. first point in the segment before any assignments
were made to the first point. If one of these
For example, the x coordinate for the values is used for the last point in an open
next point is given by: _next_x segment it returns zero.
A derived value of the form:

_prev_<value> Calculate a value dependent on the previous


point in the segment and the current point. The
where: values which can be returned are the azimuth,
dip, slope, vertical distance, 2d length (or
<value> is one of az, dip, slope, vdist, horizontal distance), and 3d length from the
2dlen, or 3dlen. previous point to the current point. The previous
point behaves as for _prev_<field> above for
For example, the azimuth from the the first point of an open or closed segment.
previous point to this point is given by:
_prev_az
A derived value of the form:

_next_<value> Calculate a value dependent on the current point


and the next point in the segment. The values
where: which can be returned are the azimuth, dip,
slope, vertical distance, 2d length (or horizontal
<value> is one of az, dip, slope, vdist, distance), and 3d length from the current point to
2dlen, or 3dlen. the next point. The next point behaves as for
_next_<field> above for the last point of an
For example, the azimuth from this open or closed segment.
point to the next point is given by:
_next_az
Calculate the 2D distance from the start of the
_clen2d
current segment to the current point.
Calculate the 3D distance from the start of the
_clen3d
current segment to the current point.
25

The last point for closed segments is a repeat of the first point. This point is not processed
like the other points in a segment and is set to have the same x, y, z and description fields
as the first point in the segment. This allows expressions used to accumulate values to
ignore any special processing for the last closing point in a closed segment. Thus it is not
possible to change a closed segment to an open segment or vice-versa using string maths.

Examples

1. To place the accumulated 2d distance along a string in the D1 field, and the
complete distance along the string in the D2 field the following can be used:
String Range Constraint Field Expression
all _first_string_point _tmp1 0
D1 _tmp1
_tmp1 _tmp1 + _next_2dlen
_string_D2 _tmp1
2. If string 1 has the grade for each point in D1 with missing values being set to -1
then the average grade for each segment can be calculated to D2 using the first
block of expressions below. The second block places the grade as a percentage of
the average grade for the segment in D3 with missing values set to nothing. Note
that the second block is started by a non-blank string range value and is not
processed until after all the points have been processed with the first block.
String
Constraint Field Expression
Range
1 _first_segment_point _tmp1 0
_first_segment_point _tmp2 0
D1 >= 0.0 _tmp1 _tmp1 + D1
D1 >= 0.0 _tmp2 _tmp2 + 1
IIF(_tmp2 > 0, _tmp1/_tmp2,
_segment_D2
0.0)
IIF(D2 != 0.0, D1/D2*100.0,
1 D1 >= 0 D3
0.0)
D1 < 0 D3 ""
3. To swap the x and y fields:
String Range Constraint Field Expression
all X Y
26

Y X
4. Note that since the fields for a point are not assigned until after all expressions for
the point are calculate it is not necessary to use a temporary when swapping
values.

Examples comparing of the old STRING MATHS and the new STR MATHS
functions

1. Assign the value 14.5 to the X field

Old String Maths

Opfield Operator Value


X = 14.5

New String Maths

String Range Constraint Field ExpressionField


all Z 14.5
2. Cut any values in the D1 field that are greater than 30 back to 30. Old String
Maths
Opfield Operator Value
D1 C 30
3. New String Maths

String Range Constraint Field Expression


all D1 IIF(D1 > 30, 30,D1)
4. Make the field D1 equal to the value contained in the Z field.

Old String Maths

Opfield Operator Value


D1 = 'Z'

New String Maths

String Range Constraint Field Expression


all D1 Z
5. Calculate the dip from the previous point to the current point of the current string.
27

Old String Maths

Opfield Operator Value


D1 = @DIP

New String Maths

String Range Constraint Field Expression


all D1 _prev_dip
6. Set the field to the 2D length of the segment to which this point belongs. The
length is the sum of the distances between the (X, Y) points in the string.

Old String Maths

Opfield Operator Value


D2 = @LEN2D

New String Maths

String Range Constraint Field Expression


all D2 _segment_2dlen
7. Calculate the average value for each segment of the opfield specified and store the
result in that field.

Old String Maths

Opfield Operator Value


D4 = @AVE

New String Maths

String Range Constraint Field Expression


all D4 _segment_ave_d4
8. Get the string number into the D1 field.

Old String Maths

Opfield Operator Value


D1 = 'STR'
28

New String Maths

String Range Constraint Field Expression


all D1 _file_string_no
9. Calculate the 2D distance from the start of the current segment to the current
point.

Old String Maths

Opfield Operator Value


D1 = @CLEN2D

New String Maths

String Range Constraint Field Expression


all D1 _clen2d
10. Calculate the 3D distance from the start of the current segment to the current
point.

Old String Maths

Opfield Operator Value


D1 = @CLEN3D

New String Maths

String Range Constraint Field Expression


all D1 _clen3d

Using string maths d1=_string_point_no then I would say d2= 308+d1 (as your starting
point number)

Blk maths.

{ "mpull" "(cu*curec)/cucon)" } should be


{ "mpull" "(cu*curec)/cucon" }
29

Azimuth point to point along a string with 2d length formated to 3 dec.

As discussed on the phone. I have a str file (blast pickup) which all the correct holes numbers
that i have picked up in the field for individual holes have been saved into the D1 field. The string
file attached contains the blast boundary and every 5 diagonal line through out the the shot.

I used to be able to use the grade control function in design,hole numbers options, create new
points etc which would insert the right number of holes between the diagonal lines ( 4 holes with
the correct id's). As the function uses only the point id not the D1 field. Is there a way around
this???? Can i make point number = D1! and use the above function.

. You don’t need to do string maths for this. Infact the function wants the hole name in d1.

What you need to do first is go to Design->Grade control->hole numbering options->define hole


numbering format and set it up like this:
30

Now when I go into Design->Grade control->hole numbering options->create new points


between numbered ends it will create a 3 digit number between the d1 fields of the first and
second point I select.

Only problem being that hole numbers less than 100 become 091,034,025 for example. This will
produce a result similar to what you see below. Is this what you were hoping to achieve?

With the d1 field displayed.


31

You can do something like this:

In the example above we are taking the Z value from string one, putting it into a temporary field
and then make the z value on string 2 equal to this temporary field. This is a good way to copy
data between one string and another.

You might also like