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

SclBlockModelSaveConstraint

Overview

You use this command to save a block model constraint, that is in memory, to a .con file.

Synopsis

SclBlockModelSaveConstraint $constraintHandle $constraintFileName

Description

The constraint, referred to by the constraintHandle parameter, is saved to the file named by the constraintFileName parameter.

Arguments

  • constraintHandle
  • Passed by value. This is the handle to the constraint that you want to save.

  • constraintFileName
  • Passed by value. The file name of the constraint file.

Returns

Returns $SCL_OK if the constraint is saved successfully. Returns $SCL_FALSE if an error occurs and the constraint is not saved.

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