proc indexfromSlider {fromSlider counts} {
set maxCounts [expr {[llength $counts] - 1}]
return [expr {$maxCounts * [$fromSlider getCurrentValue] / 100}]
}
proc updateSmallLabel { small_triangles_sensitivity num_small_triangles area_small_triangles} {
global small_triangles_counts
global small_triangles_areas
set countIndex [indexfromSlider $small_triangles_sensitivity $small_triangles_counts]
$num_small_triangles setCurrentValue [lindex $small_triangles_counts $countIndex]
$area_small_triangles setCurrentValue [format "<= %.3f" [lindex $small_triangles_areas $countIndex]]
}
proc updateThinLabel { thin_triangles_sensitivity num_thin_triangles ratio_thin_triangles} {
global thin_triangles_counts
global thin_triangles_ratios
set countIndex [indexfromSlider $thin_triangles_sensitivity $thin_triangles_counts]
$num_thin_triangles setCurrentValue [lindex $thin_triangles_counts $countIndex]
$ratio_thin_triangles setCurrentValue [format "<= %.3f" [lindex $thin_triangles_ratios $countIndex]]
}
proc updateLargeLabel { large_triangles_sensitivity num_large_triangles area_large_triangles } {
global large_triangles_counts
global large_triangles_areas
set countIndex [indexfromSlider $large_triangles_sensitivity $large_triangles_counts]
$num_large_triangles setCurrentValue [lindex $large_triangles_counts $countIndex]
$area_large_triangles setCurrentValue [format ">= %.3f" [lindex $large_triangles_areas $countIndex]]
}
proc initSmallLabel { condition_small_triangles small_triangles_sensitivity num_small_triangles area_small_triangles } {
global small_triangles_counts
global small_triangles_areas
if {[llength $small_triangles_counts]==0} {
$num_small_triangles setCurrentValue "None"
$condition_small_triangles setInputAllowed false
$area_small_triangles setCurrentValue ""
} else {
$condition_small_triangles setInputAllowed true
updateSmallLabel $small_triangles_sensitivity $num_small_triangles $area_small_triangles
}
}
proc initThinLabel {condition_thin_triangles thin_triangles_sensitivity num_thin_triangles ratio_thin_triangles} {
global thin_triangles_counts
if {[llength $thin_triangles_counts]==0} {
$num_thin_triangles setCurrentValue "None"
$condition_thin_triangles setInputAllowed false
$ratio_thin_triangles setCurrentValue ""
} else {
$condition_thin_triangles setInputAllowed true
updateThinLabel $thin_triangles_sensitivity $num_thin_triangles $ratio_thin_triangles
}
}
proc initLargeLabel { condition_large_triangles large_triangles_sensitivity num_large_triangles area_large_triangles } {
global large_triangles_counts
if {[llength $large_triangles_counts]==0} {
$num_large_triangles setCurrentValue "None"
$condition_large_triangles setInputAllowed false
$area_large_triangles setCurrentValue ""
} else {
$condition_large_triangles setInputAllowed true
updateLargeLabel $large_triangles_sensitivity $num_large_triangles $area_large_triangles
}
}
proc RequireRefresh { SolidsRefreshWarningPanel SolidsConditioningPanel Refresh_Needed_Comment} {
$Refresh_Needed_Comment setCurrentValue SOLIDSCONDITIONING_1
$SolidsRefreshWarningPanel setVisible true
$SolidsConditioningPanel setVisible false
}
proc loadConditioningControls { obj_range trisol_range Refresh_Needed_Comment SolidsRefreshWarningPanel SolidsConditioningPanel condition_small_triangles small_triangles_sensitivity num_small_triangles area_small_triangles condition_thin_triangles thin_triangles_sensitivity num_thin_triangles ratio_thin_triangles condition_large_triangles large_triangles_sensitivity num_large_triangles area_large_triangles } {
global small_triangles_counts
global thin_triangles_counts
global thin_triangles_ratios
global large_triangles_counts
global small_triangles_areas
global large_triangles_areas
set buffer [GuidoExecServer getSolidsConditioningParameters [
subst {objRange = "[$obj_range getCurrentValue]"
trisolRange = "[$trisol_range getCurrentValue]"
maxPercentileToBucket = "10"
numBuckets = "20"}
]
]
set numTrisols [GuidoGetParamBufferValue $buffer numTrisols]
if { $numTrisols != "0" } {
if {"[GuidoGetParamBufferValue $buffer countsChanged]" == "Y"} {
set small_triangles_counts [GuidoGetParamBufferValue $buffer smallCounts]
set small_triangles_areas [GuidoGetParamBufferValue $buffer smallAreas]
set thin_triangles_counts [GuidoGetParamBufferValue $buffer thinCounts]
set thin_triangles_ratios [GuidoGetParamBufferValue $buffer thinRatios]
set large_triangles_counts [GuidoGetParamBufferValue $buffer largeCounts]
set large_triangles_areas [GuidoGetParamBufferValue $buffer largeAreas]
initSmallLabel $condition_small_triangles $small_triangles_sensitivity $num_small_triangles $area_small_triangles
initThinLabel $condition_thin_triangles $thin_triangles_sensitivity $num_thin_triangles $ratio_thin_triangles
initLargeLabel $condition_large_triangles $large_triangles_sensitivity $num_large_triangles $area_large_triangles
}
$SolidsRefreshWarningPanel setVisible false
$SolidsConditioningPanel setVisible true
} else {
$Refresh_Needed_Comment setCurrentValue SOLIDSCONDITIONING_5
$SolidsRefreshWarningPanel setVisible true
$SolidsConditioningPanel setVisible false
}
}
proc clearPreviewStats { trisol_count triangle_count small_proc thin_proc large_proc small_skip thin_skip large_skip added_count disconnected_count deleted_count area_change volume_change area_comment volume_comment } {
$trisol_count setCurrentValue ""
$triangle_count setCurrentValue ""
$small_proc setCurrentValue ""
$thin_proc setCurrentValue ""
$large_proc setCurrentValue ""
$small_skip setCurrentValue ""
$thin_skip setCurrentValue ""
$large_skip setCurrentValue ""
$added_count setCurrentValue ""
$disconnected_count setCurrentValue ""
$deleted_count setCurrentValue ""
$area_change setCurrentValue ""
$volume_change setCurrentValue ""
$area_comment setCurrentValue ""
$volume_comment setCurrentValue ""
}
GuidoForm SolidsConditioning {
-default_buttons "Apply" "Cancel"
-label "Solids Conditioning"
-layout BoxLayout Y_AXIS
-help_id 1628
GuidoPanel topPanel {
-layout BoxLayout X_AXIS
GuidoPanel SolidsCond_100 {
-layout CentreLineLayout
GuidoLabel labelLayer {
-label "Active layer:"
-height 1
}
GuidoLabel layer {
-font_style bold
-height 1
}
GuidoPanel labelPanel {
-layout BoxLayout Y_AXIS
GuidoLabel obj_label {
-label "Object Range"
-alignmentX right
-height 1
}
GuidoLabel trisol_label {
-label "Trisolation Range"
-alignmentX right
-height 1
}
}
GuidoPanel rangePanel {
-layout BoxLayout X_AXIS
GuidoPanel rangeFieldPanel {
-layout BoxLayout Y_AXIS
-alignmentY middle
GuidoField obj_range {
-format range
-display_length 16
-max_length MAX_RNG_LENGTH
-tip "Enter the object range for processing"
}
GuidoField trisol_range {
-format range
-display_length 16
-max_length MAX_RNG_LENGTH
-tip "Enter the trisolation range for processing"
}
}
GuidoPanel buttonPanel {
-alignmentY middle
GuidoButton Refresh_Dependendents_on_trisol_range {
-icon "icons/24/refresh.png"
-tip TRISOLSTATS_3
}
}
}
GuidoField added_string_id {
-label "String ID for added points"
-display_length 6
-null true
-input true
-format integer
-display_length 16
-max_length 40
-tip SOLIDSCONDITIONING_2
}
}
}
GuidoFiller Between_identifiers_and_parameters {
-height 0.5
}
GuidoPanel Solids_Options_Overlay {
-layout OverlayLayout
GuidoPanel SolidsRefreshWarningPanel {
-visible false
GuidoLabel Refresh_Needed_Comment {
-font_style bold
-label SOLIDSCONDITIONING_1
}
}
GuidoPanel SolidsConditioningPanel {
-label "Conditioning Parameters"
-border etched true
-layout FlowLayout Left
GuidoPanel SolidsCond_210 {
-layout BoxLayout Y_AXIS
GuidoCheckBox condition_small_triangles {
-default true
-caption "Small triangles"
-selected_value Y
-tip "Conditioning will consider small triangles"
-unselected_value N
}
GuidoCheckBox condition_thin_triangles {
-default true
-caption "Thin triangles"
-selected_value Y
-tip "Conditioning will consider thin triangles"
-unselected_value N
}
GuidoCheckBox condition_large_triangles {
-default false
-caption "Large triangles"
-selected_value Y
-tip "Conditioning will consider large triangles"
-unselected_value N
}
}
GuidoFiller space {
-width 2
}
GuidoPanel SolidsCond_220_prefixes {
-layout BoxLayout Y_AXIS
GuidoPanel SolidsCond_221 {
-layout FlowLayout Right
GuidoLabel num_small_triangles_precursor {
-label "Targeting"
}
}
GuidoPanel SolidsCond_222a {
-layout FlowLayout Right
GuidoLabel num_thin_triangles_precursor {
-label "Targeting"
}
}
GuidoPanel SolidsCond_223a {
-layout FlowLayout Right
GuidoLabel num_large_triangles_precursor {
-label "Splitting"
}
}
}
GuidoPanel SolidsCond_220 {
-layout BoxLayout Y_AXIS
GuidoPanel SolidsCond_221 {
-layout FlowLayout Right
-width 3
GuidoLabel num_small_triangles {}
}
GuidoPanel SolidsCond_222 {
-layout FlowLayout Right
GuidoLabel num_thin_triangles {}
}
GuidoPanel SolidsCond_223 {
-layout FlowLayout Right
GuidoLabel num_large_triangles {}
}
}
GuidoPanel SolidsCond_230 {
-layout BoxLayout Y_AXIS
GuidoSlider small_triangles_sensitivity {
-orientation Horizontal
-paint_ticks false
-dependency {[$condition_small_triangles isSelected]}
-default 0
-width 20
-tip SOLIDSCONDITIONING_3
}
GuidoSlider thin_triangles_sensitivity {
-orientation Horizontal
-paint_ticks false
-dependency {[$condition_thin_triangles isSelected]}
-default 0
-tip SOLIDSCONDITIONING_3
}
GuidoSlider large_triangles_sensitivity {
-orientation Horizontal
-paint_ticks false
-dependency {[$condition_large_triangles isSelected]}
-default 0
-tip SOLIDSCONDITIONING_3
}
}
GuidoPanel SolidsCond_220_suffixes {
-layout BoxLayout Y_AXIS
GuidoPanel SolidsCond_221 {
-layout FlowLayout Left
GuidoLabel area_small_triangles_lbl {
-label Area
}
}
GuidoPanel SolidsCond_222 {
-layout FlowLayout Left
GuidoLabel ratio_thin_triangles_lbl {
-label Ratio
}
}
GuidoPanel SolidsCond_223 {
-layout FlowLayout Left
GuidoLabel area_large_triangles_lbl {
-label Area
}
}
}
GuidoPanel SolidsCond_220_suffixes {
-layout BoxLayout Y_AXIS
GuidoPanel SolidsCond_221 {
-layout FlowLayout Left
-width 8
GuidoLabel area_small_triangles {}
}
GuidoPanel SolidsCond_222 {
-layout FlowLayout Left
GuidoLabel ratio_thin_triangles {}
}
GuidoPanel SolidsCond_223 {
-layout FlowLayout Left
GuidoLabel area_large_triangles {}
}
}
GuidoPanel SolidsCond_240 {
-layout BoxLayout Y_AXIS
GuidoFiller blank_r1c4 {
-height 1
}
GuidoButton preview_button {
-caption "Preview"
-legacy_button
-selected_value preview
-tip SOLIDSCONDITIONING_4
-dependency {[$condition_small_triangles getCurrentValue] == "Y" || [$condition_thin_triangles getCurrentValue] == "Y" || [$condition_large_triangles getCurrentValue] == "Y"}
}
GuidoFiller blank_r3c4 {
-height 1
}
}
}
}
GuidoFiller Between_identifiers_and_parameters {
-height 0.5
}
GuidoPanel previewResultsPanel {
-border etched true
-label "Preview Statistics"
-layout BoxLayout X_AXIS
GuidoPanel LeftPanel {
-layout BoxLayout Y_AXIS
GuidoPanel topStats {
-layout BoxLayout X_AXIS
GuidoPanel left {
-layout BoxLayout Y_AXIS
GuidoLabel trisol_count_lbl {
-label "Trisolations"
-height 0.7
}
GuidoLabel trisol_count_lbl {
-label "Triangles"
-height 0.7
}
}
GuidoFiller space {
-width 1
}
GuidoPanel right {
-layout BoxLayout Y_AXIS
GuidoLabel trisol_count {
-text_alignmentX right
-alignmentX right
-height 0.7
-font_style bold
}
GuidoLabel triangle_count {
-text_alignmentX right
-alignmentX right
-height 0.7
-font_style bold
}
}
}
GuidoFiller space {
-height 0.5
}
GuidoPanel resultsStats {
-layout BoxLayout X_AXIS
GuidoPanel leftPanel {
-layout BoxLayout Y_AXIS
GuidoLabel lbl {
-label ""
-height 0.7
}
GuidoLabel lbl {
-label "Small triangles"
-height 0.7
}
GuidoLabel lbl {
-label "Thin triangles"
-height 0.7
}
GuidoLabel lbl {
-label "Large triangles"
-height 0.7
}
}
GuidoFiller space {
-width 1
}
GuidoPanel middlePanel {
-layout BoxLayout Y_AXIS
GuidoLabel lbl {
-label "Processed"
-text_alignmentX right
-alignmentX right
-height 0.7
}
GuidoLabel small_proc {
-text_alignmentX right
-alignmentX right
-height 0.7
-font_style bold
}
GuidoLabel thin_proc {
-text_alignmentX right
-alignmentX right
-height 0.7
-font_style bold
}
GuidoLabel large_proc {
-text_alignmentX right
-alignmentX right
-height 0.7
-font_style bold
}
}
GuidoFiller space {
-width 1
}
GuidoPanel rightPanel {
-layout BoxLayout Y_AXIS
GuidoLabel lbl {
-label "Skipped"
-text_alignmentX right
-alignmentX right
-height 0.7
}
GuidoLabel small_skip {
-text_alignmentX right
-alignmentX right
-height 0.7
-font_style bold
}
GuidoLabel thin_skip {
-text_alignmentX right
-alignmentX right
-height 0.7
-font_style bold
}
GuidoLabel large_skip {
-text_alignmentX right
-alignmentX right
-height 0.7
-font_style bold
}
}
}
}
GuidoFiller space {
-width 5
}
GuidoPanel rightPanel {
-layout BoxLayout Y_AXIS
GuidoPanel stats {
-layout BoxLayout X_AXIS
GuidoPanel left {
-layout BoxLayout Y_AXIS
GuidoLabel lbl {
-label "Points added"
-height 0.7
}
GuidoLabel lbl {
-label "Points disconnected"
-height 0.7
}
GuidoLabel lbl {
-label "Neighbouring triangles deleted"
-height 0.7
}
GuidoFiller space {
-height 1
}
GuidoLabel lbl {
-label "Surface area change"
-height 0.7
}
GuidoLabel lbl {
-label "Revalidate to calculate volume"
-height 1
}
GuidoLabel lbl_vol {
-label "Volume change"
-height 0.7
-dependency {"[$revalidate_check getCurrentValue]" == "Y"}
}
}
GuidoFiller space {
-width 1
}
GuidoPanel middle {
-layout BoxLayout Y_AXIS
GuidoLabel added_count {
-text_alignmentX right
-alignmentX right
-height 0.7
-font_style bold
}
GuidoLabel disconnected_count {
-text_alignmentX right
-alignmentX right
-height 0.7
-font_style bold
}
GuidoLabel deleted_count {
-text_alignmentX right
-alignmentX right
-height 0.7
-font_style bold
}
GuidoFiller space {
-height 1
}
GuidoLabel area_change {
-text_alignmentX right
-alignmentX right
-height 0.7
-font_style bold
}
GuidoCheckBox revalidate_check {
-selected_value "Y"
-unselected_value "N"
-height 1
-alignmentX right
-default true
-tip SOLIDSCONDITIONING_6
}
GuidoLabel volume_change {
-text_alignmentX right
-alignmentX right
-font_style bold
-dependency {"[$revalidate_check getCurrentValue]" == "Y"}
-height 0.7
}
}
GuidoFiller space {
-width 1
}
GuidoPanel right {
-layout BoxLayout Y_AXIS
GuidoFiller space {
-height 0.7
}
GuidoFiller space {
-height 0.7
}
GuidoFiller space {
-height 0.7
}
GuidoFiller space {
-height 1
}
GuidoLabel area_comment {
-text_alignmentX left
-alignmentX left
-height 0.7
-font_style bold
}
GuidoFiller space {
-height 1
}
GuidoLabel volume_comment {
-text_alignmentX left
-alignmentX left
-font_style bold
-dependency {"[$revalidate_check getCurrentValue]" == "Y"}
-height 0.7
}
}
}
}
}
$SolidsConditioning setActionCallback initial {[loadConditioningControls $obj_range $trisol_range $Refresh_Needed_Comment $SolidsRefreshWarningPanel $SolidsConditioningPanel $condition_small_triangles $small_triangles_sensitivity $num_small_triangles $area_small_triangles $condition_thin_triangles $thin_triangles_sensitivity $num_thin_triangles $ratio_thin_triangles $condition_large_triangles $large_triangles_sensitivity $num_large_triangles $area_large_triangles]}
$Refresh_Dependendents_on_trisol_range setActionCallback valueChanged {[loadConditioningControls $obj_range $trisol_range $Refresh_Needed_Comment $SolidsRefreshWarningPanel $SolidsConditioningPanel $condition_small_triangles $small_triangles_sensitivity $num_small_triangles $area_small_triangles $condition_thin_triangles $thin_triangles_sensitivity $num_thin_triangles $ratio_thin_triangles $condition_large_triangles $large_triangles_sensitivity $num_large_triangles $area_large_triangles]}
$Refresh_Dependendents_on_trisol_range setActionCallback valueChanged {[clearPreviewStats $trisol_count $triangle_count $small_proc $thin_proc $large_proc $small_skip $thin_skip $large_skip $added_count $disconnected_count $deleted_count $area_change $volume_change $area_comment $volume_comment]}
$small_triangles_sensitivity setActionCallback mouseDragged {[updateSmallLabel $small_triangles_sensitivity $num_small_triangles $area_small_triangles]}
$small_triangles_sensitivity setActionCallback mouseReleased {[updateSmallLabel $small_triangles_sensitivity $num_small_triangles $area_small_triangles]}
$small_triangles_sensitivity setActionCallback keyReleased {[updateSmallLabel $small_triangles_sensitivity $num_small_triangles $area_small_triangles]}
$thin_triangles_sensitivity setActionCallback mouseDragged {[updateThinLabel $thin_triangles_sensitivity $num_thin_triangles $ratio_thin_triangles]}
$thin_triangles_sensitivity setActionCallback mouseReleased {[updateThinLabel $thin_triangles_sensitivity $num_thin_triangles $ratio_thin_triangles]}
$thin_triangles_sensitivity setActionCallback keyReleased {[updateThinLabel $thin_triangles_sensitivity $num_thin_triangles $ratio_thin_triangles]}
$large_triangles_sensitivity setActionCallback mouseDragged {[updateLargeLabel $large_triangles_sensitivity $num_large_triangles $area_large_triangles]}
$large_triangles_sensitivity setActionCallback mouseReleased {[updateLargeLabel $large_triangles_sensitivity $num_large_triangles $area_large_triangles]}
$large_triangles_sensitivity setActionCallback keyReleased {[updateLargeLabel $large_triangles_sensitivity $num_large_triangles $area_large_triangles]}
$obj_range setActionCallback valueChanged  {[RequireRefresh $SolidsRefreshWarningPanel $SolidsConditioningPanel $Refresh_Needed_Comment]}
$trisol_range setActionCallback valueChanged  {[RequireRefresh $SolidsRefreshWarningPanel $SolidsConditioningPanel $Refresh_Needed_Comment]}
}
