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

SclBlockModelCreateConstraint

Overview

You use this command to create a block model constraint that is in memory. This command also provides a handle to reference the constraint object.

Synopsis

SclBlockModelCreateConstraint $bmHandle

Description

You need a handle to the block model of interest. See SclBlockModelGetCurrentModel for more information on block model handles. A constraint is created in memory for the specified block model, and a handle to the constraint is returned.

Arguments

Returns

The handle to the constraint.

Examples

#This script will create a constraint on the specified block model.
#10 blocks are added to the constraint, and the constraint is then 
#saved to a file for re-use.
#After the file is created, the constraint handle is destroyed.

set bm [SclBlockModelGetCurrentModel]
set constraintHandle [SclBlockModelCreateConstraint $bm]
set iterator [SclBlockModelIterateStart $bm]

set count 0

while {$count < 10} {
 set blockIndex [SclBlockModelIterateNext $iterator attributeValues]
 set result [SclBlockModelAddBlockToConstraint $constraintHandle $blockIndex]
 incr count
}

set result [SclBlockModelSaveConstraint $constraintHandle "constraint.con"]
set result [SclBlockModelDestroyConstraint $constraintHandle]
SclBlockModelIterateEnd $iterator