proc getMinMaxExtents { } {
global location
global rid
global extentsType
global xorg
global yorg
global zorg
global xext
global yext
global zext
if { [$location getCurrentValue] != "" } {
set locValue [$location getCurrentValue]
set idValue [$rid getCurrentValue]
set buffer [ GuidoExecServer "GetSwaMinMax" [subst {location = "$locValue" id = "$idValue"} ]]
set orgList [ GuidoGetParamBufferValue $buffer min ]
set extList [ GuidoGetParamBufferValue $buffer max ]
$location setCurrentValue ""
$rid setCurrentValue ""
$extentsType setCurrentValue "N"
$xorg setCurrentValue [lindex $orgList 0]
$yorg setCurrentValue [lindex $orgList 1]
$zorg setCurrentValue [lindex $orgList 2]
$xext setCurrentValue [lindex $extList 0]
$yext setCurrentValue [lindex $extList 1]
$zext setCurrentValue [lindex $extList 2]
}
}
proc resetAdvMin { advBlock advPos numVals} {
set res [$advBlock getCurrentValue]
set numVals [expr $numVals + [$advPos getItemCount]-1]
set varList {}
for {set i 0} {$i < $numVals } {incr i} {
lappend varList $res
set res [expr $res / 2.0]
}
if { $numVals < 10 } {
lappend varList "..."
}
eval [concat {$advPos} {setValues} $varList ]
$advPos setCurrentValue [$advBlock getCurrentValue]
}
proc resetStdMin { xblk yblk zblk maxres numVals } {
set xres [$xblk getCurrentValue]
set yres [$yblk getCurrentValue]
set zres [$zblk getCurrentValue]
set stdList {}
set numVals [expr $numVals + [$maxres getItemCount]-1]
for {set i 0} {$i < $numVals } {incr i} {
set val "$yres,$xres,$zres"
lappend stdList $val
set xres [expr $xres / 2.0]
set yres [expr $yres / 2.0]
set zres [expr $zres / 2.0]
}
if { $numVals < 10 } {
lappend stdList "..."
}
eval [concat {$maxres} {setValues} $stdList ]
$maxres setCurrentValue [lindex $stdList 0]
}
proc levelCallback { fieldType field userField xblk yblk zblk maxres } {
set currSize [$field getCurrentValue]
if { [string match "...*" $currSize] } {
if { [string match "adv" $fieldType] } {
resetAdvMin $userField $field 3
} else {
resetStdMin $xblk $yblk $zblk $maxres 3
}
}
}
proc initHeadings { } {
global method
global lblMaxCoords
global lblMinCoords
global freeWarning
if { [$method getCurrentValue] == "extents" } {
$lblMaxCoords setLabel "Extents"
$lblMinCoords setLabel "Origin"
} else {
$lblMaxCoords setLabel "Maximum coordinates"
$lblMinCoords setLabel "Minimum coordinates"
}
set translated_val [GuidoMessage translate BM_FREE_SUBBLOCK_WARNING]
$freeWarning setCurrentValue $translated_val
}
proc changeHeadings { } {
global method
global lblMaxCoords
global lblMinCoords
global xext
global yext
global zext
global xorg
global yorg
global zorg
if { [$method getCurrentValue] == "extents" } {
$lblMaxCoords setLabel "Extents"
$lblMinCoords setLabel "Origin"
$xext setCurrentValue [expr [$xext getCurrentValue]-[$xorg getCurrentValue]]
$yext setCurrentValue [expr [$yext getCurrentValue]-[$yorg getCurrentValue]]
$zext setCurrentValue [expr [$zext getCurrentValue]-[$zorg getCurrentValue]]
} else {
$lblMaxCoords setLabel "Maximum coordinates"
$lblMinCoords setLabel "Minimum coordinates"
$xext setCurrentValue [expr [$xext getCurrentValue]+[$xorg getCurrentValue]]
$yext setCurrentValue [expr [$yext getCurrentValue]+[$yorg getCurrentValue]]
$zext setCurrentValue [expr [$zext getCurrentValue]+[$zorg getCurrentValue]]
}
}
proc checkBlocks { xblk yblk zblk maxres maxresX maxresY maxresZ } {
if { [$xblk getCurrentValue] != "" &&
[$yblk getCurrentValue] != "" &&
[$zblk getCurrentValue] != "" } {
if { [$xblk getCurrentValue] < 0 } {
$xblk requestFocus
GuidoMessage error BM_INV_REAL_PARAMS
return
}
if { [$yblk getCurrentValue] < 0 } {
$yblk requestFocus
GuidoMessage error BM_INV_REAL_PARAMS
return
}
if { [$zblk getCurrentValue] < 0 } {
$zblk requestFocus
GuidoMessage error BM_INV_REAL_PARAMS
return
}
updateBlockingMethod $xblk $yblk $zblk $maxres $maxresX $maxresY $maxresZ
} else {
GuidoMessage error BM_INV_REAL_PARAMS
}
}
proc updateBlockingMethod { xblk yblk zblk maxres maxresX maxresY maxresZ } {
if { [$xblk getCurrentValue] != "" &&
[$yblk getCurrentValue] != "" &&
[$zblk getCurrentValue] != "" } {
$maxres removeAllItems
$maxresX removeAllItems
$maxresY removeAllItems
$maxresZ removeAllItems
resetAdvMin $xblk $maxresX 4
resetAdvMin $yblk $maxresY 4
resetAdvMin $zblk $maxresZ 4
resetStdMin $xblk $yblk $zblk $maxres 4
}
}
proc checkExtents { } {
global xext
global yext
global zext
global xorg
global yorg
global zorg
global xblk
global yblk
global zblk
global useExtents
global invoke_mode
if { [$invoke_mode getCurrentValue] == "MACRO"} {
return true
}
if { [$useExtents getCurrentValue] == "extents" } {
if { [$xext getCurrentValue] < 0 } {
$xext requestFocus
GuidoMessage error BM_NEGATIVE_X_EXTENTS
return false
}
if { [$yext getCurrentValue] < 0 } {
$yext requestFocus
GuidoMessage error BM_NEGATIVE_Y_EXTENTS
return false
}
if { [$zext getCurrentValue] < 0 } {
$zext requestFocus
GuidoMessage error BM_NEGATIVE_Z_EXTENTS
return false
}
if { [expr [$xext getCurrentValue]-[$xblk getCurrentValue]] < 0 } {
$xblk requestFocus
GuidoMessage error BM_OVERSIZE_BLOCKS_X
return false
}
if { [expr [$yext getCurrentValue]-[$yblk getCurrentValue]] < 0 } {
$yblk requestFocus
GuidoMessage error BM_OVERSIZE_BLOCKS_Y
return false
}
if { [expr [$zext getCurrentValue]-[$zblk getCurrentValue]] < 0 } {
$zblk requestFocus
GuidoMessage error BM_OVERSIZE_BLOCKS_Z
return false
}
} else {
if { [$xext getCurrentValue] != "0" ||
[$xorg getCurrentValue] != "0" } {
if { [$xext getCurrentValue] != "" &&
[$xorg getCurrentValue] != "" } {
if {[expr [$xext getCurrentValue] - [$xorg getCurrentValue] ] <= 0 } {
$xext requestFocus
GuidoMessage error BM_NEGATIVE_X_EXTENTS
return false
}
}
}
if { [expr [$xext getCurrentValue]-[$xorg getCurrentValue]-[$xblk getCurrentValue]] < 0 } {
$xblk requestFocus
GuidoMessage error BM_OVERSIZE_BLOCKS_X
return false
}
if { [$yext getCurrentValue] != "0" ||
[$yorg getCurrentValue] != "0" } {
if { [$yext getCurrentValue] != "" &&
[$yorg getCurrentValue] != "" } {
if { [expr [$yext getCurrentValue] - [$yorg getCurrentValue] ] <= 0 } {
$yext requestFocus
GuidoMessage error BM_NEGATIVE_Y_EXTENTS
return false
}
}
}
if { [expr [$yext getCurrentValue]-[$yorg getCurrentValue]-[$yblk getCurrentValue]] < 0 } {
$yblk requestFocus
GuidoMessage error BM_OVERSIZE_BLOCKS_Y
return false
}
if { [$zext getCurrentValue] != "0" ||
[$zorg getCurrentValue] != "0" } {
if { [$zext getCurrentValue] != "" &&
[$zorg getCurrentValue] != "" } {
if {[expr [$zext getCurrentValue] - [$zorg getCurrentValue] ] <= 0 } {
$zext requestFocus
GuidoMessage error BM_NEGATIVE_Z_EXTENTS
return false
}
}
}
if { [expr [$zext getCurrentValue]-[$zorg getCurrentValue]-[$zblk getCurrentValue]] < 0 } {
$zblk requestFocus
GuidoMessage error BM_OVERSIZE_BLOCKS_Z
return false
}
}
return true
}
GuidoForm frm20025 {
-default_buttons
-help_id 1155
-label "Creating new block model definition"
-layout BoxLayout Y_AXIS
-tip "20025_TIP_001"
-action initial {[initHeadings]}
GuidoPanel frm20025_24 {
-layout CentreLineLayout Vertical Left
GuidoLabel frm20025_2 {
-label "Model name"
}
GuidoLabel modname {}
GuidoFiller frm20025_22 {
-height 1
}
GuidoFiller frm20025_23 {
-height 1
}
GuidoScrollPane desc_panel {
-label "Description"
-height 3
-width 28
GuidoTextArea description {
-linewrap true
-wrap_style_word true
-tip "20025_TIP_002"
}
}
GuidoField invoke_mode {
-label ""
-max_length 16
-visible false
}
}
GuidoPanel method1 {
-layout CentrelineLayout Vertical Left
GuidoLabel abc {
-label "Define model using"
}
GuidoButtonGroupPanel method {
-layout BoxLayout Y_AXIS
GuidoRadioButton useMinMax {
-action mouseClicked {[changeHeadings]}
-caption "Min/Max coords"
-default true
-selected_value minMax
}
GuidoRadioButton useExtents {
-action mouseClicked {[changeHeadings]}
-caption "Origin coords/extents"
-default false
-selected_value extents
}
}
}
GuidoFiller frm20025_25 {
-height 0.5
}
GuidoTabbedPane tabPane {
GuidoPanel p1 {
-label Extents
-layout BoxLayout Y_AXIS
GuidoFiller space {
-height 0.2
}
GuidoPanel extType {
-layout CentrelineLayout Vertical Left
GuidoCheckBox extentsType {
-default false
-selected_value "Y"
-unselected_value "N"
}
GuidoLabel yyy {
-label "Get extents from string file ?"
}
}
GuidoFiller space {
-height 0.2
}
GuidoPanel allPanel {
-layout BoxLayout X_AXIS
GuidoPanel overallExtentsPanel {
-layout BoxLayout Y_AXIS
GuidoPanel extentsOverlay {
-layout OverlayLayout
GuidoPanel stringPanel {
-layout CentrelineLayout Vertical Left
-border etched true
-label "Extents string"
-dependency {"[ $extentsType getCurrentValue]" == "Y"}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoFileBrowserField location {
-action valueChanged {[getMinMaxExtents]}
-display_length 15
-font_style bold
-format none
-label Location
-max_length "FIO_MAX_LOCATION_LENGTH"
-file_mask *.str
-link rid
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoField rid {
-action valueChanged {[getMinMaxExtents]}
-display_length 15
-font_style bold
-format double
-label "ID"
-max_length 16
-null false
}
GuidoFiller frm10105_9 {
-height 1
}
}
GuidoPanel userEntered {
-border etched true
-layout BoxLayout X_AXIS
-label "Coordinate extents"
-dependency {"[ $extentsType getCurrentValue]" == "N"}
GuidoPanel pMinCoords {
-layout CentreLineLayout Vertical Left
GuidoFiller space {
-width 1
}
GuidoLabel lblMinCoords {
-label "Minimum coordinates"
}
GuidoField yorg {
-display_length 12
-validation {[checkExtents]}
-format double
-decimals 3
-label Y
-max_length 16
-next_focus xorg
-null false
-tip BM_CREATE_ORIGIN_TIP
-translate upper
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoField xorg {
-display_length 12
-decimals 3
-format double
-label X
-max_length 16
-next_focus zorg
-null false
-tip BM_CREATE_ORIGIN_TIP
-translate upper
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoField zorg {
-display_length 12
-format double
-decimals 3
-label Z
-max_length 16
-next_focus yext
-null false
-tip BM_CREATE_ORIGIN_TIP
-translate upper
}
}
GuidoPanel pMaxCoords {
-layout CentreLineLayout Vertical Left
GuidoFiller space {
-width 1
}
GuidoLabel lblMaxCoords {
-label "Maximum Coordinates"
}
GuidoField yext {
-display_length 12
-format double
-decimals 3
-label Y
-max_length 16
-next_focus xext
-null false
-tip BM_CREATE_EXTENTS_TIP
-translate upper
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoField xext {
-display_length 12
-format double
-decimals 3
-label X
-max_length 16
-next_focus zext
-null false
-tip BM_CREATE_EXTENTS_TIP
-translate upper
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoField zext {
-display_length 12
-format double
-decimals 3
-label Z
-max_length 16
-null false
-tip BM_CREATE_EXTENTS_TIP
-translate upper
}
}
}
}
}
GuidoPanel p3 {
-border etched true
-layout CentreLineLayout Vertical Left
-label "User block size"
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoField yblk {
-display_length 10
-format double
-label Y
-low_bound .001
-max_length 16
-next_focus xblk
-null false
-tip BM_CREATE_USER_SIZE_TIP
-translate upper
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoField xblk {
-display_length 10
-format double
-label X
-low_bound .001
-max_length 16
-next_focus zblk
-null false
-tip BM_CREATE_USER_SIZE_TIP
-translate upper
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoField zblk {
-display_length 10
-format double
-label Z
-low_bound .001
-max_length 16
-null false
-tip BM_CREATE_USER_SIZE_TIP
-translate upper
}
}
}
GuidoFiller space {
-height 0.2
}
}
GuidoPanel p4 {
-label Rotation
-layout BoxLayout Y_AXIS
GuidoFiller space {
-height 0.3
}
GuidoPanel spacerPanel {
-layout BoxLayout X_AXIS
GuidoFiller space {
-width 0.3
}
GuidoPanel rot_param_panel {
-layout CentrelineLayout Vertical Left
GuidoField bearing {
-display_length 5
-format double
-label "Bearing (rotation around Z)"
-max_length 16
-next_focus dip
-tip "Enter the rotation angle (in degrees) for the bearing of the model"
-translate upper
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoField dip {
-display_length 5
-format double
-label "Dip (rotation around Y)"
-max_length 16
-next_focus plunge
-tip "Enter the rotation angle (in degrees) for the dip of the model"
-translate upper
}
GuidoFiller frm10105_8 {
-height 0.05
}
GuidoFiller frm10105_9 {
-height 0.05
}
GuidoField plunge {
-display_length 5
-format double
-label "Plunge (rotation around X)"
-max_length 16
-tip "Enter the rotation angle (in degrees) for the plunge of the model"
-translate upper
}
}
}
}
}
GuidoFiller space {
-height 0.5
}
GuidoPanel typePanel {
-layout CentrelineLayout Vertical Left
GuidoComboBox subBlockingType {
-label "Sub blocking"
-value_in "Standard" "Variable" "Free" "None"
-exclusive true
-null false
-display_length 13
-max_length 10
-default "None"
-tip BM_CREATE_SUBBLOCKING_TIP
}
GuidoFiller filler {
-height 0.05
}
}
GuidoPanel subblock {
-layout OverlayLayout
GuidoPanel warn_panel {
-layout BoxLayout Y_AXIS
-border etched true
-dependency {"[ $subBlockingType getCurrentValue]" == "Free"}
GuidoTextArea freeWarning {
-label "Free sub blocking"
-height 9
-width 40
-linewrap true
-wrap_style_word true
-format none
-input false
-font_highlight 0 0 255
-default BM_FREE_SUBBLOCK_WARNING
}
}
GuidoPanel frm20025_44 {
-layout BoxLayout X_AXIS
-dependency {"[ $subBlockingType getCurrentValue]" == "Variable"}
GuidoPanel maxresY1_panel {
-layout CentrelineLayout Vertical Left
GuidoLabel mbkSize {
-label "Minimum block size"
}
GuidoPanel maxresY2_panel  {
-layout CentrelineLayout Vertical Left
GuidoComboBox maxresY {
-display_length 9
-label "Y"
-max_length 50
-null false
-tip BM_CREATE_VARIABLE_SUBBLOCKING_TIP
-no_mlt
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoComboBox maxresX {
-display_length 9
-label "X"
-max_length 50
-null false
-tip BM_CREATE_VARIABLE_SUBBLOCKING_TIP
-no_mlt
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoComboBox maxresZ {
-display_length 9
-label "Z"
-max_length 50
-null false
-tip BM_CREATE_VARIABLE_SUBBLOCKING_TIP
-no_mlt
}
}
}
}
GuidoPanel frm20025_45 {
-layout CentrelineLayout Vertical Left
-dependency {"[ $subBlockingType getCurrentValue]" == "Standard"}
GuidoComboBox maxres {
-display_length 10.4
-label "Minimum block size"
-max_length 50
-null false
-no_mlt
}
}
}
GuidoPanel save_panel {
-layout CentrelineLayout Vertical Left
GuidoCheckBox save_audit {
-selected_value Y
-unselected_value N
-default Y
}
GuidoLabel xxx {
-label "Maintain audit trail"
}
}
$maxresY setActionCallback focusGained {[levelCallback "adv" $maxresY $yblk $xblk $yblk $zblk $maxres]}
$maxresX setActionCallback focusGained {[levelCallback "adv" $maxresX $xblk $xblk $yblk $zblk $maxres]}
$maxresZ setActionCallback focusGained {[levelCallback "adv" $maxresZ $zblk $xblk $yblk $zblk $maxres]}
$maxres setActionCallback focusGained {[levelCallback "std" $maxres $xblk $xblk $yblk $zblk $maxres]}
$yblk setActionCallback valueChanged {[checkBlocks $xblk $yblk $zblk $maxres $maxresX $maxresY $maxresZ ]}
$xblk setActionCallback valueChanged {[checkBlocks $xblk $yblk $zblk $maxres $maxresX $maxresY $maxresZ ]}
$zblk setActionCallback valueChanged {[checkBlocks $xblk $yblk $zblk $maxres $maxresX $maxresY $maxresZ ]}
$subBlockingType setActionCallback focusGained {[checkBlocks $xblk $yblk $zblk $maxres $maxresX $maxresY $maxresZ ]}
}
