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

SclBlockModelSetValues

Overview

You use this command to set attribute values for blocks in a block model.

Synopsis

SclBlockModelSetValues $bmHandle $blockIndex $attributeNames $attributeValues

Description

You must specify the block index for this command. You can get the block index value using a call to SclBlockModelIterateNext.

Arguments

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

  • blockIndex
  • Passed by value. This is the index of the block to set values for. See SclBlockModelIterateNext.

  • attributeNames
  • Passed by value. This is the list of attribute names to set values for. If any of the specified attributes do not exist in the block model, an error is returned and the script stops. You cannot set the values for intrinsic geometry attributes or calculated attributes; if you try to set values for any of these attributes, an error is returned and the script stops.

  • attributeValues
  • Passed by value. This is the list of values for the specified attributes. An error is returned and the script stopped if any of the following conditions occur:

    • the attribute names or attribute values lists are of 0 length
    • the attribute names and attribute values lists are of different lengths
    • the attribute values list contains any values that do not match the data type of the corresponding attribute name

    If you input a floating point value for an integer attribute, the value is truncated.
    Note: Using this command flags the block model as changed. If you attempt to close the block model without saving, a form is displayed asking you whether or not to save the block model.

Returns

If successful, $SCL_OK is returned.,If an error occurs, $SCL_FALSE is returned.

Examples

#Iterate over every block in the current block model and set a specified set of attributes to specific values.
set bm [SclBlockModelGetCurrentModel]
set attributeNames {"att1" "att2" "att15" "att16" "att30" "att31" "att44" "att45"}
set attributeValues {"13" "131" "1.2345567" "2.34567" "3.45678" "4.56789" "alteration1" "alteration2"}

set iterator [SclBlockModelIterateStart $bm $attributeNames]

set result [SclBlockModelIterateNext $iterator attVals]
while {$result != -1} {
	set result [SclBlockModelSetValues $bm $result $attributeNames $attributeValues]
	set result [SclBlockModelIterateNext $iterator attVals]
}

SclBlockModelIterateEnd $iterator