You are here: Surpac Concepts > Macros > SCL > Block Model Commands > SclBlockModelColumnIterateStart
GEOVIA Surpac

SclBlockModelColumnIterateStart

Overview

You use this command to obtain a column iterator that points to a specified block model in Surpac, and follows a specific direction. You can use this iterator to retrieve values for block attributes. This command is very similar to SclBlockModelIterateStart. The only difference is the addition of the direction parameter.

Synopsis

SclBlockModelColumnIterateStart $bmHandle $direction $attributeNames "constraintFile=$constraintFileName"

SclBlockModelColumnIterateStart $bmHandle $direction $attributeNames "constraintHandle=$constraintHandle"

Description

You need a handle to the block model of interest for this command. For more information about block model handles, see SclBlockModelGetCurrentModel. The parameters $attributesNames and $constraintFileName are optional. However, if you specify a constraint file you must specify the attribute name parameter.

Arguments

  • bmHandle
  • Passed by value. This is the handle to the block model, obtained from the call to SclBlockModelGetCurrentModel.

  • direction
  • Passed by value. This is the direction for the iterator. Allowed values are:

    • +x
    • +y
    • +z
    • -x
    • -y
    • -z

    All values are case insensitive. If the specified direction value is not one of the listed values, an error is returned, and the script stops.

  • attributeNames
  • Passed by value (optional). This is an array of attribute names corresponding to the attributes that exist in the block model. If any of these attributes do not exist, an error is returned and the script stops. If this parameter is not specified, every attribute in the block model is used.

  • constraintFile=$constraintFileName
  • Passed by value (optional). You can use this parameter only if the attributeNames parameter is present. This parameter specifies the path to a constraint file to use when iterating over blocks in the block model. If the constraint file does not exist, or it is invalid for the specified block model, an error is returned, and the script stops.

  • constraintHandle=$constraintHandle
  • Passed by value (optional). You can use this parameter only if the attributeNames parameter is present. This parameter specifies the constraint handle, for a constraint file loaded in memory, to use when iterating over blocks in the block model. If the constraint handle does not exist, or it is invalid for the specified block model, an error is returned, and the script stops.

Returns

If this command is successful, it returns a pointer to the column iterator which you can then use in future commands such as SclBlockModelIterateNext and SclBlockModelIterateEnd. If an error occurs, $ SCL_FALSE is returned.

Example

#Create a column iterator for a specified block model which uses a specific set 
#of attributes and a constraint file.  
#This iterator will use a direction value of “-x” and iterate over all the blocks in 
#the constraint, outputting the values of the attributes for each.
set bm [SclBlockModelGetCurrentModel]

#Example attribute names
set attributeList {"att1" "att2" "att3"}

#Example constraint file name
set constraintFileName "c:\\constraintfile.con"

set direction "-x"
set iterator [SclBlockModelColumnIterateStart $bm $direction $attributeList "constraintFile=$constraintFileName"]
set result [SclBlockModelIterateNext $iterator attributeValues]
while {$result != -1} {
	foreach value $attributeValues {
	puts -nonewline "$value, "
	}
	puts ""
	set result [SclBlockModelIterateNext $iterator attributeValues]
}
SclBlockModelIterateEnd $iterator