GuidoScript scripts/dtmutilities.tcl
global dtmFile
global object_id
global obj_name
global trisolation_id
global tri_name
proc isDTMFile { dtmFile } {
set location [ string tolower [$dtmFile getCurrentValue] ]
return [string first ".dtm" $location ]
}
proc constraintTypeReady {constraint_type constraintfilename } {
set constraint_text "[$constraint_type getCurrentValue]"
set return_val 1
if { "$constraint_text" == "CONSTRAINT" } {
set constraintfilename_value "[ $constraintfilename getCurrentValue ]"
if { [string length $constraintfilename_value] == 0 } {
set return_val 0
}
}
return $return_val
}
proc threedmTypeReady {constraint_type threedmlocation threedmidrange } {
set constraint_text "[$constraint_type getCurrentValue]"
set return_val 1
if { "$constraint_text" == "3DM" } {
set threedmlocation_value "[ $threedmlocation getCurrentValue ]"
if { [string length $threedmlocation_value] == 0 } {
set return_val 0
}
}
return $return_val
}
proc dtmTypeReady {constraint_type dtmfilename } {
set constraint_text "[$constraint_type getCurrentValue]"
set return_val 1
if { "$constraint_text" == "DTM" } {
set dtmfilename_value "[ $dtmfilename getCurrentValue ]"
if { [string length $dtmfilename_value] == 0 } {
set return_val 0
} elseif { [string match *.DTM $dtmfilename_value] == 0 } {
set return_val 0
}
}
return $return_val
}
proc stringTypeReady {constraint_type stringlocation stringidrange } {
set constraint_text "[$constraint_type getCurrentValue]"
set return_val 1
if { "$constraint_text" == "STRING" } {
set stringlocation_value "[ $stringlocation getCurrentValue ]"
if { [string length $stringlocation_value] == 0 } {
set return_val 0
}
}
return $return_val
}
proc planeTypeReady {constraint_type x y z equals } {
set constraint_text "[$constraint_type getCurrentValue]"
set return_val 1
if { "$constraint_text" == "PLANE" } {
set x_value "[ $x getCurrentValue ]"
if { [string length $x_value] == 0 } {
set return_val 0
}
set y_value "[ $y getCurrentValue ]"
if { [string length $y_value] == 0 } {
set return_val 0
}
set z_value "[ $z getCurrentValue ]"
if { [string length $z_value] == 0 } {
set return_val 0
}
set equals_value "[ $equals getCurrentValue ]"
if { [string length $equals_value] == 0 } {
set return_val 0
}
}
return $return_val
}
proc xplaneTypeReady {constraint_type x_value }  {
set constraint_text "[$constraint_type getCurrentValue]"
set return_val 1
if { "$constraint_text" == "X PLANE" } {
set x "[ $x_value getCurrentValue ]"
if { [string length $x] == 0 } {
set return_val 0
}
}
return $return_val
}
proc yplaneTypeReady {constraint_type y_value }  {
set constraint_text "[$constraint_type getCurrentValue]"
set return_val 1
if { "$constraint_text" == "Y PLANE" } {
set y "[ $y_value getCurrentValue ]"
if { [string length $y] == 0 } {
set return_val 0
}
}
return $return_val
}
proc zplaneTypeReady {constraint_type z_value }  {
set constraint_text "[$constraint_type getCurrentValue]"
set return_val 1
if { "$constraint_text" == "Z PLANE" } {
set z "[ $z_value getCurrentValue ]"
if { [string length $z] == 0 } {
set return_val 0
}
}
return $return_val
}
proc blockReady {constraint_type attributeValue } {
set constraint_text "[$constraint_type getCurrentValue]"
set return_val 1
if { "$constraint_text" == "BLOCK" } {
set block_attribute_value "[ $attributeValue getCurrentValue ]"
if { [string length $block_attribute_value] == 0 } {
set return_val 0
}
}
return $return_val
}
proc transfer_values { constraintTypeValue location id operation not rnga rngb ext index lbound ubound } {
global constraintValue
set temp_text ""
if { "$constraintTypeValue" == "STRING" } {
set FileExt [string last "." $location ]
set chk [string last "/" $location ]
set spaceChk [string last " " $location ]
if {$spaceChk > 0} {
set location "\"$location\""
}
if { $FileExt == -1 || [expr $FileExt > $chk] == 0 } {
set temp_text "String Constraint: $not$operation $location $id .STR in direction $ext"
} else {
set temp_text "String Constraint: $not$operation $location in direction $ext"
}
if { "$lbound" != "" && "$ubound" != "" } {
append temp_text " with bounds $lbound to $ubound"
}
if { "$lbound" == "" && "$ubound" != "" } {
append temp_text " with bounds min to $ubound"
}
if { "$lbound" != "" && "$ubound" == "" } {
append temp_text " with bounds $lbound to max"
}
if { $rnga != "" } {
append temp_text " String Range: $rnga"
}
if { $rngb != "" } {
append temp_text " Segment Range: $rngb"
}
} elseif {"$constraintTypeValue" == "DTM"} {
set spaceChk [string last " " $location ]
if {$spaceChk > 0} {
set location "\"$location\""
}
set temp_text "DTM Constraint: $not$operation $location"
if { $rnga != "" } {
append temp_text " Object range: $rnga"
}
if { $rngb != "" } {
append temp_text " Trisolation range: $rngb"
}
} elseif {"$constraintTypeValue" == "3DM"} {
set FileExt [string last "." $location ]
set chk [string last "/" $location ]
set spaceChk [string last " " $location ]
if {$spaceChk > 0} {
set location "\"$location\""
}
if { $FileExt == -1 || [expr $FileExt > $chk] == 0 } {
set temp_text "3DM Constraint: $not$operation $location $id .DTM"
} else {
set temp_text "3DM Constraint: $not$operation $location"
}
if { $rnga != "" } {
append temp_text " Object Range: $rnga"
}
if { $rngb != "" } {
append temp_text " Trisolation Range: $rngb"
}
} elseif {"$constraintTypeValue" == "Y PLANE" } {
set temp_text "Y Value Constraint: $not$operation Y=$location"
} elseif {"$constraintTypeValue" == "X PLANE" } {
set temp_text "X Value Constraint: $not$operation X=$location"
} elseif {"$constraintTypeValue" == "Z PLANE" } {
set temp_text "Z Value Constraint: $not$operation Z=$location"
} elseif {"$constraintTypeValue" == "PLANE" } {
set temp_text "Plane Constraint: $not$operation $location\X + $id\Y + $rnga\Z - $rngb = 0"
} elseif {"$constraintTypeValue" == "BLOCK" } {
if {"$not" == "Not "} {
switch -exact $operation {
< {set operation >= }
> {set operation <= }
= {set operation != }
}
}
set temp_text "Block Constraint: $location $operation $id"
} elseif {"$constraintTypeValue" == "CONSTRAINT" } {
set temp_text "Constraint File: $not$operation $location"
} else {
return
}
$constraintValue setCurrentValue $index $temp_text
return
}
proc transfer_current { } {
global stringFile
global stringID
global x
global y
global z
global equals
global x_value
global y_value
global z_value
global constraintLetter
global constraintType
global abovedtm
global above_plane
global above_x
global above_y
global above_z
global inside
global extentDirection
global extentLowerbound
global extentUpperbound
global stringRange
global segmentRange
global dtmFile
global object_id
global trisolation_id
global inside3DM
global threeDMLocation
global threeDMid
global objectRange
global trisolationRange
global operators
global block_attribute
global attributeValue
global constraintFile
global insideConstraint
scan "[$constraintLetter getCurrentValue]" "%c" number1
scan a "%c" number2
set index [expr $number1 - $number2]
set ext ""
set lbound ""
set ubound ""
set constraintTypeValue [$constraintType getCurrentValue]
if { "$constraintTypeValue" == "STRING" } {
set operation inside
set notValue [$inside getCurrentValue]
set location [$stringFile getCurrentValue]
set id [$stringID getCurrentValue]
set rnga [$stringRange getCurrentValue]
set rngb [$segmentRange getCurrentValue]
set ext [$extentDirection getCurrentValue]
set lbound [$extentLowerbound getCurrentValue]
set ubound [$extentUpperbound getCurrentValue]
} elseif { "$constraintTypeValue" == "DTM" } {
set operation above
set notValue [$abovedtm getCurrentValue]
set dtmFileName [$dtmFile getCurrentValue]
set id ""
set tempDTMFileName [string tolower "$dtmFileName"]
if { [string first ".dtm" $tempDTMFileName ] != -1} {
set rnga [$object_id getCurrentValue]
set rngb [$trisolation_id getCurrentValue]
} else {
set rnga ""
set rngb ""
set rngat [$object_id getCurrentValue]
set rngbt [$trisolation_id getCurrentValue]
if {[string length $rngat] > 0 || [string length $rngbt] > 0} {
GuidoMessage warning BM_NON_SURPAC_TRISOL_RANGES
}
}
set location $dtmFileName
} elseif { "$constraintTypeValue" == "3DM" } {
set operation inside
set notValue [$inside3DM getCurrentValue]
set location [$threeDMLocation getCurrentValue]
set id [$threeDMid getCurrentValue]
set rnga [$objectRange getCurrentValue]
set rngb [$trisolationRange getCurrentValue]
} elseif {"$constraintTypeValue" == "PLANE"} {
set operation above
set notValue [$above_plane getCurrentValue]
set location [$x getCurrentValue]
set id [$y getCurrentValue]
set rnga [$z getCurrentValue]
set rngb [$equals getCurrentValue]
} elseif {"$constraintTypeValue" == "X PLANE"} {
set operation above
set notValue [$above_x getCurrentValue]
set location [$x_value getCurrentValue]
set id ""
set rnga ""
set rngb ""
} elseif {"$constraintTypeValue" == "Y PLANE"} {
set operation above
set notValue [$above_y getCurrentValue]
set location [$y_value getCurrentValue]
set id ""
set rnga ""
set rngb ""
} elseif {"$constraintTypeValue" == "Z PLANE"} {
set operation above
set notValue [$above_z getCurrentValue]
set location [$z_value getCurrentValue]
set id ""
set rnga ""
set rngb ""
} elseif {"$constraintTypeValue" == "BLOCK"} {
set operation [$operators getCurrentValue]
set location [$block_attribute getCurrentValue]
set notValue ""
set id [$attributeValue getCurrentValue]
set rnga ""
set rngb ""
} elseif {"$constraintTypeValue" == "CONSTRAINT"} {
set operation inside
set notValue [$insideConstraint getCurrentValue]
set location [$constraintFile getCurrentValue]
set id ""
set rnga ""
set rngb ""
} else {
}
if {$notValue == "N"} {
set notValue "Not "
} else {
set notValue ""
}
transfer_values $constraintTypeValue $location $id $operation $notValue $rnga $rngb $ext $index $lbound $ubound
scan z "%c" number2
if {$number1 == $number2 } {
$constraintLetter setCurrentValue "a"
} else {
$constraintLetter setCurrentValue [format %c [incr number1]]
}
}
proc get_file_name { completename } {
set lowerfile [string tolower $completename]
set extpos [string last "." $lowerfile]
set slashpos [string last "/" $lowerfile]
if { $slashpos == -1 } {
set slashpos [string last "\\" $lowerfile]
}
if { ($extpos == -1) || ($extpos < $slashpos) } {
set filename $completename
} else {
set filename [string range $completename 0 [expr $extpos - 1]]
}
return $filename
}
proc clear_edit_template { } {
global abovedtm
global above_plane
global above_x
global above_y
global above_z
global inside
global inside3DM
global insideConstraint
global stringFile
global stringID
global x
global y
global z
global equals
global x_value
global y_value
global z_value
global stringRange
global segmentRange
global extentLowerbound
global extentUpperbound
global segmentRange
global objectRange
global trisolationRange
global object_id
global trisolation_id
global dtmFile
global threeDMLocation
global threeDMid
global attributeValue
global constraintFile
$abovedtm setCurrentValue false
$above_plane setCurrentValue false
$above_x setCurrentValue false
$above_y setCurrentValue false
$above_z setCurrentValue false
$inside setCurrentValue false
$inside3DM setCurrentValue false
$insideConstraint setCurrentValue false
$stringFile setCurrentValue ""
$stringID setCurrentValue ""
$x setCurrentValue ""
$y setCurrentValue ""
$z setCurrentValue ""
$equals setCurrentValue ""
$x_value setCurrentValue ""
$y_value setCurrentValue ""
$z_value setCurrentValue ""
$stringRange setCurrentValue ""
$segmentRange setCurrentValue ""
$extentLowerbound setCurrentValue ""
$extentUpperbound setCurrentValue ""
$segmentRange setCurrentValue ""
$objectRange setCurrentValue ""
$trisolationRange setCurrentValue ""
$object_id setCurrentValue ""
$trisolation_id setCurrentValue ""
$dtmFile setCurrentValue ""
$threeDMLocation setCurrentValue ""
$threeDMid setCurrentValue ""
$attributeValue setCurrentValue ""
$constraintFile setCurrentValue ""
}
proc clear_edit_template_and_row { } {
global constraintLetter
global constraintValue
scan "[$constraintLetter getCurrentValue]" "%c" number1
scan a "%c" number2
set index [expr $number1 - $number2]
$constraintValue setCurrentValue $index ""
clear_edit_template
}
proc start_again { table field} {
global constraintLetter
set numberOfRows [$table getRowCount]
for { set i 0} {$i < $numberOfRows} {incr i} {
$field setCurrentValue $i ""
}
$constraintLetter setCurrentValue "a"
}
proc parseTableString { constraint_string constraintTypeValue location id operation not rnga rngb ext lbound ubound } {
if {$constraint_string == "" } {
return
}
upvar $constraintTypeValue constraintTypeValue_ref
upvar $location location_ref
upvar $id id_ref
upvar $operation operation_ref
upvar $not not_ref
upvar $rnga rnga_ref
upvar $rngb rngb_ref
upvar $ext ext_ref
upvar $lbound lower_ref
upvar $ubound upper_ref
scan $constraint_string {%s} constraint_name
if { "$constraint_name" == "String" } {
set constraintTypeValue_ref STRING
set constraintList $constraint_string
if { "[lindex $constraintList 2]" == "Not"} {
set not_ref NOT
set currentListIndex 4
} else {
set not_ref ""
set currentListIndex 3
}
set operation_ref INSIDE
set location_start $currentListIndex
set surpac true
incr currentListIndex
incr currentListIndex
set currentString [lindex $constraintList $currentListIndex]
if { [string first ".STR" $currentString ] != -1 } {
while { [string match .STR $currentString] == 0 } {
incr currentListIndex
set currentString [lindex $constraintList $currentListIndex]
}
set surpac true
} else {
set surpac false
}
set location_end $currentListIndex
if { $surpac } {
set id_ref [lindex $constraintList [expr $location_end - 1] ]
} else {
set id_ref 0
}
set currentString [lindex $constraintList $location_start]
while { $location_start < [expr $location_end - 1] } {
append location_ref $currentString " "
incr location_start
set currentString [lindex $constraintList $location_start]
}
set location_ref [string trimright $location_ref]
if { $surpac } {
incr currentListIndex 3
} else {
incr currentListIndex
}
set ext_ref [lindex $constraintList $currentListIndex]
set rnga_ref ""
set rngb_ref ""
set totalListLength [llength $constraintList]
incr currentListIndex
set currentString [lindex $constraintList $currentListIndex]
if { "$currentString" == "with" } {
incr currentListIndex 2
set lower_ref [lindex $constraintList $currentListIndex]
incr currentListIndex 2
set upper_ref [lindex $constraintList $currentListIndex]
incr currentListIndex
}
if { $totalListLength > $currentListIndex } {
set currentString [lindex $constraintList $currentListIndex]
if { "$currentString" == "String" } {
incr currentListIndex 2
set currentString [lindex $constraintList $currentListIndex]
while { [expr $totalListLength > $currentListIndex] &&
![string match Segment $currentString] } {
append rnga_ref $currentString " "
incr currentListIndex
set currentString [lindex $constraintList $currentListIndex]
}
set rnga_ref [string trimright $rnga_ref]
}
if { "$currentString" == "Segment" } {
incr currentListIndex 2
set currentString [lindex $constraintList $currentListIndex]
while { [expr $totalListLength > $currentListIndex]} {
append rngb_ref $currentString " "
incr currentListIndex
set currentString [lindex $constraintList $currentListIndex]
}
set rngb_ref [string trimright $rngb_ref]
}
}
} elseif { "$constraint_name" == "3DM" } {
set constraintTypeValue_ref 3DM
set constraintList $constraint_string
if { "[lindex $constraintList 2]" == "Not"} {
set not_ref NOT
set currentListIndex 4
} else {
set not_ref ""
set currentListIndex 3
}
set operation_ref INSIDE
set location_start $currentListIndex
set currentString [lindex $constraintList $currentListIndex]
set lowerString [string tolower $currentString]
if { [string first ".dtm" $lowerString ] == -1} {
while { [string first .dtm $lowerString] == -1 } {
incr currentListIndex
set currentString [lindex $constraintList $currentListIndex]
set lowerString [string tolower $currentString]
}
set location_end $currentListIndex
set id_ref [lindex $constraintList [expr $location_end - 1] ]
set currentString [lindex $constraintList $location_start]
while { $location_start < [expr $location_end - 1] } {
append location_ref $currentString " "
incr location_start
set currentString [lindex $constraintList $location_start]
}
set location_ref [string trimright $location_ref]
} else {
set location_ref $currentString
set id_ref ""
}
set rnga_ref ""
set rngb_ref ""
set totalListLength [llength $constraintList]
incr currentListIndex
if { $totalListLength > $currentListIndex } {
set currentString [lindex $constraintList $currentListIndex]
if { "$currentString" == "Object" } {
incr currentListIndex 2
set currentString [lindex $constraintList $currentListIndex]
while { [expr $totalListLength > $currentListIndex] &&
![string match Trisolation $currentString] } {
append rnga_ref $currentString " "
incr currentListIndex
set currentString [lindex $constraintList $currentListIndex]
}
set rnga_ref [string trimright $rnga_ref]
}
if { "$currentString" == "Trisolation" } {
incr currentListIndex 2
set currentString [lindex $constraintList $currentListIndex]
while { [expr $totalListLength > $currentListIndex]} {
append rngb_ref $currentString " "
incr currentListIndex
set currentString [lindex $constraintList $currentListIndex]
}
set rngb_ref [string trimright $rngb_ref]
}
}
} elseif { "$constraint_name" == "DTM" } {
set constraintTypeValue_ref DTM
set constraintList $constraint_string
if { "[lindex $constraintList 2]" == "Not"} {
set not_ref NOT
set currentListIndex 4
} else {
set not_ref ""
set currentListIndex 3
}
set operation_ref ABOVE
set location_ref [lindex $constraintList $currentListIndex]
set id_ref ""
set location_ref [string trimright $location_ref]
set rnga_ref ""
set rngb_ref ""
set totalListLength [llength $constraintList]
incr currentListIndex
if { $totalListLength > $currentListIndex } {
set currentString [lindex $constraintList $currentListIndex]
if { "$currentString" == "Object" } {
incr currentListIndex 2
set rnga_ref [lindex $constraintList $currentListIndex]
if { $totalListLength > $currentListIndex } {
incr currentListIndex
set currentString [lindex $constraintList $currentListIndex]
}
}
if { "$currentString" == "Trisolation" } {
incr currentListIndex 2
set rngb_ref [lindex $constraintList $currentListIndex]
}
}
} elseif { "$constraint_name" == "Constraint" } {
set constraintTypeValue_ref "CONSTRAINT"
set insideAndRest [string range $constraint_string 17 [string length $constraint_string]]
set operation_ref INSIDE
if { "[string wordend $insideAndRest 1]" == "3"} {
set not_ref NOT
set fileAndRest [string range $constraint_string 28 [string length $constraint_string]]
} else {
set not_ref ""
set fileAndRest [string range $constraint_string 24 [string length $constraint_string]]
}
set location_ref [ get_file_name $fileAndRest ]
} elseif { "$constraint_name" == "Plane"} {
set constraintTypeValue_ref PLANE
set aboveAndRest [string range $constraint_string 17 [string length $constraint_string]]
set operation_ref ABOVE
if { "[string wordend $aboveAndRest 1]" == 4} {
set not_ref "NOT"
set values [string range $constraint_string 28 [string length $constraint_string]]
} else {
set not_ref ""
set values [string range $constraint_string 24 [string length $constraint_string]]
}
scan $values {%[0123456789.-]X + %[0123456789.-]Y + %[0123456789.-]Z - %[0123456789.-]} location_ref id_ref rnga_ref rngb_ref
} elseif { "$constraint_name" == "Y"} {
set constraintTypeValue_ref "Y PLANE"
set aboveAndRest [string range $constraint_string 20 [string length $constraint_string]]
set operation_ref ABOVE
if { "[string wordend $aboveAndRest 0]" == "3"} {
set not_ref "NOT"
set location_ref [string range $aboveAndRest 12 [string length $aboveAndRest]]
} else {
set not_ref ""
set location_ref [string range $aboveAndRest 8 [string length $aboveAndRest]]
}
} elseif { "$constraint_name" == "X"} {
set constraintTypeValue_ref "X PLANE"
set aboveAndRest [string range $constraint_string 20 [string length $constraint_string]]
set operation_ref ABOVE
if { "[string wordend $aboveAndRest 0]" == "3"} {
set not_ref "NOT"
set location_ref [string range $aboveAndRest 12 [string length $aboveAndRest]]
} else {
set not_ref ""
set location_ref [string range $aboveAndRest 8 [string length $aboveAndRest]]
}
} elseif { "$constraint_name" == "Z"} {
set constraintTypeValue_ref "Z PLANE"
set aboveAndRest [string range $constraint_string 20 [string length $constraint_string]]
set operation_ref ABOVE
if { "[string wordend $aboveAndRest 0]" == "3"} {
set not_ref "NOT"
set location_ref [string range $aboveAndRest 12 [string length $aboveAndRest]]
} else {
set not_ref ""
set location_ref [string range $aboveAndRest 8 [string length $aboveAndRest]]
}
} elseif { "$constraint_name" == "Block"} {
set constraintTypeValue_ref BLOCK
set stringValue [string range $constraint_string 18 [string length $constraint_string]]
set stringList [split $stringValue]
set locationMax [lsearch $stringList {[<>=!]*} ]
set locationLength 0
for { set i 0} {$i < $locationMax} {incr i} {
incr locationLength  [string length [lindex $stringList $i]]
incr locationLength
}
incr locationLength -2
set location_ref [string range $stringValue 0 $locationLength]
set operation_ref [lindex $stringList $locationMax]
if {[string length $operation_ref] > 1} {
set not_ref "NOT"
switch -exact $operation_ref {
>= {set operation_ref < }
<= {set operation_ref > }
!= {set operation_ref = }
}
}
set valueStart [expr $locationLength + [string length [lindex $stringList $locationMax]]+3]
set id_ref [string range $stringValue $valueStart [string length $stringValue]]
}
return
}
proc load_template { table field } {
global stringFile
global stringID
global x
global y
global z
global equals
global x_value
global y_value
global z_value
global constraintLetter
global constraintType
global abovedtm
global above_plane
global above_x
global above_y
global above_z
global inside
global insideConstraint
global stringRange
global segmentRange
global extentDirection
global dtmFile
global object_id
global trisolation_id
global inside3DM
global threeDMLocation
global threeDMid
global objectRange
global trisolationRange
global operators
global block_attribute
global attributeValue
global constraintFile
global extentLowerbound
global extentUpperbound
set rowCount [$table getRowCount]
if { $rowCount < 1} {
return
}
set tableRow [$table getEditingRow]
if { $tableRow == -1 } {
set tableRow 0
}
set letter [format "%c" [expr $tableRow + 97] ]
$constraintLetter setCurrentValue $letter
set constraint_string [$field getCurrentValue $tableRow]
set constraint_name ""
set location ""
set id ""
set operation ""
set not ""
set rnga ""
set rngb ""
set ext ""
set lbound ""
set ubound ""
parseTableString $constraint_string constraint_name location id operation not rnga rngb ext lbound ubound
$constraintType setCurrentValue $constraint_name
if { $constraint_string == ""} {
$abovedtm setCurrentValue true
$above_plane setCurrentValue true
$above_x setCurrentValue true
$above_y setCurrentValue true
$above_z setCurrentValue true
$inside setCurrentValue true
$inside3DM setCurrentValue true
$insideConstraint setCurrentValue true
return
}
clear_edit_template
if { "$constraint_name" == "STRING" } {
if { "$not" == "NOT"} {
$inside setCurrentValue "N"
} else {
$inside setCurrentValue "Y"
}
$stringRange setCurrentValue $rnga
$segmentRange setCurrentValue $rngb
$extentLowerbound setCurrentValue $lbound
$extentUpperbound setCurrentValue $ubound
$stringFile setCurrentValue $location
$stringID setCurrentValue $id
$extentDirection setCurrentValue $ext
} elseif { "$constraint_name" == "3DM" } {
if { "$not" == "NOT"} {
$inside3DM setCurrentValue "N"
} else {
$inside3DM setCurrentValue "Y"
}
$objectRange setCurrentValue $rnga
$trisolationRange setCurrentValue $rngb
$threeDMLocation setCurrentValue $location
$threeDMid setCurrentValue $id
} elseif { "$constraint_name" == "DTM" } {
if { "$not" == "NOT"} {
$abovedtm setCurrentValue "N"
} else {
$abovedtm setCurrentValue "Y"
}
$object_id setCurrentValue $rnga
$trisolation_id setCurrentValue $rngb
$dtmFile setCurrentValue "$location$id"
} elseif { "$constraint_name" == "CONSTRAINT" } {
if { "$not" == "NOT"} {
$insideConstraint setCurrentValue "N"
} else {
$insideConstraint setCurrentValue "Y"
}
$constraintFile setCurrentValue "$location\.CON"
} elseif { "$constraint_name" == "PLANE"} {
if { "$not" == "NOT"} {
$above_plane setCurrentValue "N"
} else {
$above_plane setCurrentValue "Y"
}
$x setCurrentValue $location
$y setCurrentValue $id
$z setCurrentValue $rnga
$equals setCurrentValue $rngb
} elseif { "$constraint_name" == "Y PLANE"} {
if { "$not" == "NOT"} {
$above_y setCurrentValue "N"
} else {
$above_y setCurrentValue "Y"
}
$y_value setCurrentValue $location
} elseif { "$constraint_name" == "X PLANE"} {
if { "$not" == "NOT"} {
$above_x setCurrentValue "N"
} else {
$above_x setCurrentValue "Y"
}
$x_value setCurrentValue $location
} elseif { "$constraint_name" == "Z PLANE"} {
if { "$not" == "NOT"} {
$above_z setCurrentValue "N"
} else {
$above_z setCurrentValue "Y"
}
$z_value setCurrentValue $location
} elseif { "$constraint_name" == "BLOCK" } {
$block_attribute setCurrentValue $location
if {"$not" == "NOT"} {
switch -exact $operation {
< {set operation >= }
> {set operation <= }
= {set operation != }
}
}
$operators setCurrentValue $operation
$attributeValue setCurrentValue $id
}
}
proc blockAttributeList { } {
global block_attribute
set buffer [ GuidoExecServer GetAttributeValueList {} ]
if {[ GuidoGetParamBufferValue $buffer attributeNumber ] > 0} {
set attributeList [ GuidoGetParamBufferValue $buffer attribute ]
set attributeFormatList [ GuidoGetParamBufferValue $buffer attributeFormat ]
eval [concat {$block_attribute} {setValues} $attributeList ]
}
}
proc loadValues { formHandle } {
global conexp
global confile
global keep_blocks
blockAttributeList
set temp_confile "[$formHandle readInputField confile]"
if {"[string index $temp_confile 0]" == "!"} {
$confile setNullAllowed false
set temp_confile [string range $temp_confile 1 [string length $temp_confile]]
}
$confile setCurrentValue $temp_confile
$keep_blocks setCurrentValue "[$formHandle readInputField keep_blocks]"
$conexp setCurrentValue "[$formHandle readInputField conexp]"
for {set index 0} {$index < 26} {incr index} {
set constraintTypeValue "[$formHandle readInputField constraints($index).contype]"
set location "[$formHandle readInputField constraints($index).location]"
set id "[$formHandle readInputField constraints($index).id]"
set operation [string tolower [string trim "[$formHandle readInputField constraints($index).op]"]]
set not [string tolower [string trim "[$formHandle readInputField constraints($index).not]"]]
set rnga "[$formHandle readInputField constraints($index).rnga]"
set rngb "[$formHandle readInputField constraints($index).rngb]"
set ext "[$formHandle readInputField constraints($index).ext]"
set lbound "[$formHandle readInputField constraints($index).lbound]"
set ubound "[$formHandle readInputField constraints($index).ubound]"
if {$not == "not"} {
set not "Not "
} else {
set not ""
}
if {$constraintTypeValue != ""} {
transfer_values $constraintTypeValue $location $id $operation $not $rnga $rngb $ext $index $lbound $ubound
}
}
}
proc writeValues { formHandle } {
global constraintValue
global conexp
global confile
global keep_blocks
if { [string compare [$formHandle getStatus] "legacy preprocess apply"] ==  0 } {
for {set index 0} {$index < 26} {incr index} {
set constraintTypeValue ""
set location ""
set id ""
set operation ""
set not ""
set rnga ""
set rngb ""
set ext ""
set lbound ""
set ubound ""
parseTableString "[$constraintValue getCurrentValue $index]" constraintTypeValue location id operation not rnga rngb ext lbound ubound
$formHandle writeOutputField "constraints($index).contype" $constraintTypeValue
$formHandle writeOutputField "constraints($index).location" $location
$formHandle writeOutputField "constraints($index).id" $id
$formHandle writeOutputField "constraints($index).op" $operation
$formHandle writeOutputField "constraints($index).not" $not
$formHandle writeOutputField "constraints($index).rnga" $rnga
$formHandle writeOutputField "constraints($index).rngb" $rngb
$formHandle writeOutputField "constraints($index).ext" $ext
$formHandle writeOutputField "constraints($index).lbound" $lbound
$formHandle writeOutputField "constraints($index).ubound" $ubound
}
$formHandle writeOutputField conexp [$conexp getCurrentValue]
$formHandle writeOutputField confile [$confile getCurrentValue]
$formHandle writeOutputField keep_blocks [$keep_blocks getCurrentValue]
$formHandle finishedWritingFields
}
}
GuidoForm frm20111 {
-action initial {[loadValues $frm20111]}
-action stateChanged {[writeValues $frm20111]}
-action initial {[load_template $constraintsTable $constraintValue ]}
-default_buttons
-label "Enter constraints"
-layout BoxLayout Y_AXIS
-tip "00674_TIP_001"
GuidoPanel main_panel {
-layout BoxLayout X_AXIS
GuidoPanel new_panel {
-border etched true
-layout BoxLayout Y_AXIS
GuidoPanel constraintTypePanel {
-layout CentreLineLayout
GuidoComboBox constraintLetter {
-display_length 1
-format none
-label "Constraint name"
-max_length 1
-null false
-no_mlt
-value_in a b c d e f g h i j k l m n o p q r s t u v w x y z
}
GuidoComboBox constraintType {
-max_rows 10
-display_length 8
-format none
-label "Constraint type"
-max_length 10
-null false
-value_in CONSTRAINT 3DM BLOCK DTM PLANE STRING "X PLANE" "Y PLANE" "Z PLANE"
}
}
GuidoFiller filler_height_1 {
-height 1
}
GuidoPanel overlay_panel {
-layout OverlayLayout
GuidoPanel dtm_panel {
-dependency { "[$constraintType getCurrentValue]" == "DTM" }
-layout CentreLineLayout vertical left
GuidoFileBrowserField dtmFile {
-display_length 16
-label "DTM file"
-format none
-max_length 256
-file_mask *.dtm
-translate upper
}
GuidoFiller filler4 {
-height 0.05
}
GuidoFiller filler5 {
-height 0.05
}
GuidoFiller filler1 {
-height 0.05
}
GuidoPanel checkBox_panel {
-layout CentreLineLayout VERTICAL LEFT
GuidoCheckBox abovedtm {
-default true
-selected_value Y
-unselected_value N
}
GuidoLabel abovedtm_label {
-label Above
}
}
GuidoLabel option_fields_label1 {
-font_style bold
-label "Optional fields"
}
GuidoFiller filler {
}
GuidoFiller filler2 {
-height 0.05
}
GuidoFiller filler3 {
-height 0.05
}
GuidoLabel obj_id_label {
-dependency { [isDTMFile $dtmFile] != -1 }
-label "Object range"
}
GuidoPanel frm01127_26 {
-layout CentreLineLayout VERTICAL LEFT
GuidoField object_id {
-dependency { [isDTMFile $dtmFile] != -1 }
-display_length 16
-format range
-max_length 32
-translate upper
-tip "Select the object range to process"
}
GuidoLabel obj_name {
-height	1
}
}
GuidoFiller frm20111_301 {
-height 0.05
}
GuidoFiller frm20111_241 {
-height 0.05
}
GuidoLabel trisolation_id_label {
-dependency { [isDTMFile $dtmFile] != -1 }
-label "Trisolation range"
}
GuidoPanel frm01127_31 {
-layout CentreLineLayout VERTICAL LEFT
GuidoField trisolation_id {
-dependency { [isDTMFile $dtmFile] != -1 }
-display_length 16
-format range
-max_length 32
-translate upper
-tip "Select the trisolation range to process"
}
GuidoLabel tri_name {
-height 1
}
}
}
GuidoPanel threeDM_panel {
-dependency { "[$constraintType getCurrentValue]" == "3DM" }
-layout CentreLineLayout
GuidoFileBrowserField threeDMLocation {
-display_length 16
-label "3DM file"
-format none
-max_length 256
-translate upper
-file_mask *.dtm
-link threeDMid
}
GuidoField threeDMid {
-display_length 16
-label "Id range"
-format range
-max_length 256
-translate upper
}
GuidoLabel inside3DM_label {
-label Inside
}
GuidoCheckBox inside3DM {
-default true
-selected_value Y
-unselected_value N
}
GuidoLabel option_fields_label2 {
-font_style bold
-label "Optional fields"
}
GuidoFiller filler {
}
GuidoField objectRange {
-display_length 16
-format range
-label "Object range"
-max_length 32
-translate upper
}
GuidoField trisolationRange {
-display_length 16
-format range
-label "Trisolation range"
-max_length 32
-translate upper
}
}
GuidoPanel string_panel {
-dependency { "[$constraintType getCurrentValue]" == "STRING" }
-layout CentreLineLayout
GuidoFileBrowserField stringFile {
-display_length 16
-label "String file"
-format none
-max_length 256
-translate upper
-file_mask *.str
-link stringID
}
GuidoField stringID {
-display_length 16
-label "ID range"
-format none
-max_length 32
-translate mixed
}
GuidoLabel inside_label {
-label Inside
}
GuidoCheckBox inside {
-default true
-selected_value Y
-unselected_value N
}
GuidoComboBox extentDirection {
-display_length 1
-format none
-label "Extent"
-null false
-default "Z"
-value_in X Y Z
}
GuidoLabel option_fields_label {
-font_style bold
-label "Optional fields"
}
GuidoFiller filler {
}
GuidoField extentLowerbound {
-display_length 7
-label "Lower bound"
-format double
-max_length 10
}
GuidoField extentUpperbound {
-display_length 7
-label "Upper bound"
-format double
-max_length 10
}
GuidoField stringRange {
-display_length 16
-format none
-label "String range"
-max_length 32
-translate upper
}
GuidoField segmentRange {
-display_length 16
-format none
-label "Segment range"
-max_length 32
-translate upper
}
}
GuidoPanel plane_panel {
-dependency { "[$constraintType getCurrentValue]" == "PLANE"}
-layout BoxLayout Y_AXIS
GuidoLabel equation_label {
-label "Equation of plane:"
}
GuidoFiller filler_height_1 {
-height 1
}
GuidoPanel equation_panel {
-layout BoxLayout X_AXIS
GuidoField x {
-display_length 5
-format none
-max_length 16
-translate upper
}
GuidoLabel x_plus_label {
-label "X +"
}
GuidoField y {
-display_length 5
-format none
-max_length 32
-translate upper
}
GuidoLabel y_plus_label {
-label "Y + "
}
GuidoField z {
-display_length 5
-format none
-max_length 32
-translate upper
}
GuidoLabel z_minus_label {
-label "Z - "
}
GuidoField equals {
-display_length 5
-format none
-max_length 32
-translate upper
}
GuidoLabel equalsLabel {
-label " = 0"
}
}
GuidoFiller filler_height_1 {
-height 1
}
GuidoPanel  above_panel {
-layout CentreLineLayout
GuidoLabel above_label1 {
-label "Above"
}
GuidoCheckBox above_plane {
-default true
-selected_value Y
-unselected_value N
}
}
}
GuidoPanel y_value_panel {
-dependency { "[$constraintType getCurrentValue]" == "Y PLANE"}
-layout CentreLineLayout
GuidoField y_value {
-display_length 5
-format none
-label "Y ="
-max_length 16
-translate upper
}
GuidoFiller filler_height_1 {
-height 1
}
GuidoFiller filler_height_1 {
-height 1
}
GuidoLabel above_label2 {
-label "Above"
}
GuidoCheckBox above_y {
-default true
-selected_value Y
-unselected_value N
}
}
GuidoPanel x_value_panel {
-dependency { "[$constraintType getCurrentValue]" == "X PLANE" }
-layout CentreLineLayout
GuidoField x_value {
-display_length 5
-format none
-label "X ="
-max_length 16
-translate upper
}
GuidoFiller filler_height_1 {
-height 1
}
GuidoFiller filler_height_1 {
-height 1
}
GuidoLabel above_label3 {
-label "Above"
}
GuidoCheckBox above_x {
-default true
-selected_value Y
-unselected_value N
}
}
GuidoPanel z_value_panel {
-dependency { "[$constraintType getCurrentValue]" == "Z PLANE" }
-layout CentreLineLayout
GuidoField z_value {
-display_length 5
-format none
-label "Z ="
-max_length 16
-translate upper
}
GuidoFiller filler_height_1 {
-height 1
}
GuidoFiller filler_height_1 {
-height 1
}
GuidoLabel above_label4 {
-label "Above"
}
GuidoCheckBox above_z {
-default true
-selected_value Y
-unselected_value N
}
}
GuidoPanel block_panel {
-dependency { "[$constraintType getCurrentValue]" == "BLOCK" }
-layout BoxLayout X_AXIS
GuidoComboBox block_attribute {
-display_length 11
-format none
-max_length BM_MAX_ATT_NAME_LEN
-null false
-no_mlt
}
GuidoFiller filler_width_1 {
-width 1
}
GuidoComboBox operators {
-display_length 2
-format none
-max_length 6
-null false
-value_in "<" ">" "=" "<=" ">=" "!="
}
GuidoFiller filler_width_1 {
-width 1
}
GuidoField attributeValue {
-display_length 5
-format none
-max_length 32
-translate mixed
}
GuidoFiller filler_width_1 {
-width 1
}
}
GuidoPanel constraint_panel {
-dependency { "[$constraintType getCurrentValue]" == "CONSTRAINT" }
-layout CentreLineLayout
GuidoFileBrowserField constraintFile {
-display_length 16
-label "Constraints file"
-format none
-max_length 256
-translate upper
-file_mask *.con
}
GuidoLabel insideConstraint_label {
-label Inside
}
GuidoCheckBox insideConstraint {
-default true
-selected_value Y
-unselected_value N
}
}
}
}
GuidoFiller filler_width_1 {
-width 1
}
GuidoPanel button_panel {
-layout BoxLayout Y_AXIS
GuidoFiller filler_height_2 {
-height 2
}
GuidoButton transferOutButton {
-action valueChanged { [transfer_current ]}
-dependency { [dtmTypeReady $constraintType $dtmFile ] && [threedmTypeReady $constraintType $threeDMLocation $threeDMid ] && [planeTypeReady $constraintType $x $y $z $equals ] && [xplaneTypeReady $constraintType $x_value ] && [yplaneTypeReady $constraintType $y_value ] && [zplaneTypeReady $constraintType $z_value ] && [stringTypeReady $constraintType $stringFile $stringID] && [blockReady $constraintType $attributeValue ] && [constraintTypeReady $constraintType $constraintFile ] }
-caption  "Add"
-width 9
}
GuidoFiller filler_height_1 {
-height 1
}
GuidoButton clear_button {
-action valueChanged { [ clear_edit_template_and_row ] }
-caption "Clear"
-width 9
}
GuidoFiller filler_height7 {
-height 1
}
GuidoButton start_again_button {
-caption "Start Again"
-width 9
}
}
GuidoFiller filler_width_1 {
-width 1
}
GuidoPanel table_panel {
-layout BoxLayout Y_AXIS
GuidoLabel Constraint_values_label {
-label "Constraint values"
}
GuidoScrollPane scrollconstraints {
-scroll_size 30 30
-height 16
-width 45
GuidoTable constraintsTable {
-instances 26 1 26
-no_mlt
-row_headings a b c d e f g h i j k l m n o p q r s t u v w x y z
GuidoField constraintValue {
-action focusGained { [load_template $constraintsTable $constraintValue] }
-display_length 300
-format none
-input false
-max_length 320
-translate mixed
}
}
$start_again_button setActionCallback valueChanged { [ start_again $constraintsTable $constraintValue ]}
}
}
}
set databuf [ GuidoExecServer GetBMGFXEdit {} ]
set status [GuidoGetParamBufferValue $databuf Edit_Mode]
if { $status == "TRUE" } {
GuidoFiller frm00910_123 {
-height 1
}
GuidoLabel frm20111_Gfx_Warn {
-label "BM_EDIT_GFX_CAUTION"
}
}
GuidoFiller frm00910_123 {
-height 1
}
GuidoPanel frm20111_124 {
-layout CentreLineLayout
GuidoCheckBox keep_blocks {
-default false
-label "Keep blocks partially in the constraint"
-selected_value Y
-tip "This is used for filling percentage attributes to create more accurate reports"
-unselected_value N
}
GuidoField conexp {
-display_length 60
-format none
-label "Constraint combination"
-max_length 512
-tip "00910_TIP_002"
-translate lower
}
GuidoFileBrowserField confile {
-label "Save constraint to"
-display_length 32
-input allowed
-translate lower
-null true
-file_access write
-file_mask *.con
-max_length 256
}
}
$frm20111 legacyProcessValues false
}
