2014-01-27 02:23:30 +06:00
proc meshingoptionsdialog { } {
set w .options_dlg
if { [ winfo exists .options_dlg] == 1 } {
wm withdraw $w
wm deiconify $w
2016-02-08 19:53:16 +05:00
focus $w
2014-01-27 02:23:30 +06:00
} {
2016-02-08 19:53:16 +05:00
2014-01-27 02:23:30 +06:00
toplevel $w
2016-02-08 19:53:16 +05:00
wm resizable $w 0 0
2014-01-27 02:23:30 +06:00
# global options.meshsize
2016-02-08 19:53:16 +05:00
pack [ ttk : : notebook $w.nb ] - fill both - side top
$w.nb add [ ttk : : frame $w.nb.general ] - text " G e n e r a l " - underline 0
$w.nb add [ ttk : : frame $w.nb.meshsize ] - text " M e s h S i z e " - underline 0
$w.nb add [ ttk : : frame $w.nb.chartopt ] - text " S T L C h a r t s " - underline 0
$w.nb add [ ttk : : frame $w.nb.optimizer ] - text " O p t i m i z e r " - underline 0
# $w.nb add [ttk::frame $w.nb.insider] -text "Insider" -underline 0
$w.nb add [ ttk : : frame $w.nb.debug ] - text " D e b u g " - underline 0
# tixNoteBook $w.nbold -ipadx 6 -ipady 6
# $w.nbold add general -label "General" -underline 0
# $w.nbold add meshsize -label "Mesh Size" -underline 0
# $w.nbold add chartopt -label "STL Charts" -underline 0
# $w.nbold add optimizer -label "Optimizer" -underline 0
# $w.nbold add insider -label "Insider" -underline 0
# $w.nbold add debug -label "Debug" -underline 0
# pack $w.nb -expand yes -fill both -padx 5 -pady 5 -side top
# ############################################################
2014-01-27 02:23:30 +06:00
# General meshing options
2016-02-08 19:53:16 +05:00
# ############################################################
set f $w.nb.general
2016-02-22 20:10:50 +05:00
ttk : : labelframe $f.f2 - relief groove - borderwidth 3 - text " G e n e r a l m e s h i n g o p t i o n s "
pack $f.f2 - pady 15 - fill x
2016-02-08 19:53:16 +05:00
set f $f.f2
2014-01-27 02:23:30 +06:00
set finevals { 1 2 3 4 5 6 }
set finelabs( 1 ) " v e r y c o a r s e "
set finelabs( 2 ) " c o a r s e "
set finelabs( 3 ) " m o d e r a t e "
set finelabs( 4 ) " f i n e "
set finelabs( 5 ) " v e r y f i n e "
set finelabs( 6 ) " u s e r d e f i n e d "
tixOptionMenu $f.fine - label " M e s h g r a n u l a r i t y : " \
-options {
label.width 19
label.anchor e
menubutton.width 15
}
foreach finev $finevals {
$f.fine add command $finev - label $finelabs ( $finev )
}
$f.fine config - variable meshoptions.fineness
$f.fine config - command { setgranularity }
global meshoptions.fineness
# setgranularity ${meshoptions.fineness}
2016-02-08 19:53:16 +05:00
# pack $f.fine
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
global meshoptions.fineness
ttk : : frame $f.fine2
ttk : : label $f.fine2.l - text " M e s h g r a n u l a r i t y : "
2016-02-22 20:10:50 +05:00
ttk : : menubutton $f.fine2.c - menu $f.fine2.m - text " c o a r s e " - width 20
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
menu $f.fine2.m - tearoff 0
foreach finev { 1 2 3 4 5 6 } {
$f.fine2.m add command - label $finelabs ( $finev ) \
-command " s e t m e s h o p t i o n s . f i n e n e s s $ f i n e v ; s e t g r a n u l a r i t y $ f i n e v ; $ f . f i n e 2 . c c o n f i g u r e - t e x t \" $ f i n e l a b s ( $ f i n e v ) \" "
}
$f.fine2.m invoke $finelabs ( $ { meshoptions.fineness } )
2016-02-22 20:10:50 +05:00
pack $f.fine2 - fill x - padx 50
2016-02-08 19:53:16 +05:00
pack $f.fine2.c $f.fine2.l - side right
2014-01-27 02:23:30 +06:00
set mgsteps { ag me ms os mv ov }
set mgsteplabel( ag ) " A n a l y z e G e o m e t r y "
set mgsteplabel( me ) " M e s h E d g e s "
set mgsteplabel( ms ) " M e s h S u r f a c e "
set mgsteplabel( os ) " O p t i m i z e S u r f a c e "
set mgsteplabel( mv ) " M e s h V o l u m e "
set mgsteplabel( ov ) " O p t i m i z e V o l u m e "
2016-02-08 19:53:16 +05:00
global meshoptions.firststep
ttk : : frame $f.first2
ttk : : label $f.first2.l - text " F i r s t S t e p : "
# ttk::menubutton $f.first2.c -menu $f.first2.m -text "Analyze Geometry" -width 12
2016-02-22 20:10:50 +05:00
ttk : : menubutton $f.first2.c - menu $f.first2.m - width 20
2016-02-08 19:53:16 +05:00
menu $f.first2.m - tearoff 0
foreach i $mgsteps {
$f.first2.m add command - label $mgsteplabel ( $i ) - command " s e t m e s h o p t i o n s . f i r s t s t e p $ i ; $ f . f i r s t 2 . c c o n f i g u r e - t e x t \" $ m g s t e p l a b e l ( $ i ) \" "
}
$f.first2.m invoke $mgsteplabel ( $ { meshoptions.firststep } )
2016-02-22 20:10:50 +05:00
pack $f.first2 - fill x - padx 50
2016-02-08 19:53:16 +05:00
pack $f.first2.c $f.first2.l - side right
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
global meshoptions.laststep
ttk : : frame $f.last2
ttk : : label $f.last2.l - text " L a s t S t e p : "
2016-02-22 20:10:50 +05:00
ttk : : menubutton $f.last2.c - menu $f.last2.m - width 20
2016-02-08 19:53:16 +05:00
menu $f.last2.m - tearoff 0
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
foreach i $mgsteps {
$f.last2.m add command - label $mgsteplabel ( $i ) - command " s e t m e s h o p t i o n s . l a s t s t e p $ i ; $ f . l a s t 2 . c c o n f i g u r e - t e x t \" $ m g s t e p l a b e l ( $ i ) \" "
2014-01-27 02:23:30 +06:00
}
2016-02-08 19:53:16 +05:00
$f.last2.m invoke $mgsteplabel ( $ { meshoptions.laststep } )
2016-02-22 20:10:50 +05:00
pack $f.last2 - fill x - padx 50
pack $f.last2.c $f.last2.l - side right
2016-02-08 19:53:16 +05:00
# tixOptionMenu $f.first -label "First Step : " \
# -options {
# label.width 19
# label.anchor e
# menubutton.width 15
# }
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
# tixOptionMenu $f.last -label "Last Step : " \
# -options {
# label.width 19
# label.anchor e
# menubutton.width 15
# }
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
# foreach step $mgsteps {
# $f.first add command $step -label $mgsteplabel($step)
# $f.last add command $step -label $mgsteplabel($step)
# }
# $f.first config -variable meshoptions.firststep
# $f.last config -variable meshoptions.laststep
# pack $f.first $f.last
2014-01-27 02:23:30 +06:00
set msg( 0 ) " N o n e "
set msg( 1 ) " L e a s t "
set msg( 2 ) " L i t t l e "
set msg( 3 ) " M o d e r a t e "
set msg( 4 ) " M u c h "
set msg( 5 ) " M o s t "
tixOptionMenu $f.msg - label " P r i n t M e s s a g e s : " \
-options {
label.width 19
label.anchor e
menubutton.width 15
}
2016-02-08 19:53:16 +05:00
foreach step { 0 1 2 3 4 5 } {
$f.msg add command $step - label $msg ( $step )
2014-01-27 02:23:30 +06:00
}
$f.msg config - variable options.printmsg
2016-02-08 19:53:16 +05:00
# pack $f.msg
global options.printmsg
ttk : : frame $f.msg2
ttk : : label $f.msg2.l - text " P r i n t M e s s a g e s : "
menu $f.msg2.m - tearoff 0
2016-02-22 20:10:50 +05:00
ttk : : menubutton $f.msg2.c - menu $f.msg2.m - width 20
2016-02-08 19:53:16 +05:00
foreach step { 0 1 2 3 4 5 } {
$f.msg2.m add command - label $msg ( $step ) - command " s e t o p t i o n s . p r i n t m s g $ s t e p ; $ f . m s g 2 . c c o n f i g u r e - t e x t $ m s g ( $ s t e p ) "
# if { ${options.printmsg} == $step } { $f.msg2.c configure -text $msg($step) }
}
$f.msg2.m invoke $ { options.printmsg }
2016-02-22 20:10:50 +05:00
pack $f.msg2 - fill x - padx 50
2016-02-08 19:53:16 +05:00
pack $f.msg2.c $f.msg2.l - side right
set f $w.nb.general
2016-02-22 20:10:50 +05:00
ttk : : labelframe $f.bts - borderwidth 3 - relief groove - text " A d d i t i o n a l m e s h i n g o p t i o n s "
pack $f.bts - fill x - pady 15
ttk : : frame $f.bts.btnframe
ttk : : checkbutton $f.bts.btnframe.parthread - text " P a r a l l e l m e s h i n g t h r e a d " \
2014-01-27 02:23:30 +06:00
-variable options.parthread
2016-02-22 20:10:50 +05:00
ttk : : checkbutton $f.bts.btnframe.second - text " S e c o n d o r d e r e l e m e n t s " \
2014-01-27 02:23:30 +06:00
-variable options.secondorder
2016-02-22 20:10:50 +05:00
ttk : : checkbutton $f.bts.btnframe.quad - text " Q u a d d o m i n a t e d " \
2014-01-27 02:23:30 +06:00
-variable options.quad - command {
if { $ { options.quad } } {
set meshoptions.laststep os
}
}
2016-02-22 20:10:50 +05:00
ttk : : checkbutton $f.bts.btnframe.invtets - text " I n v e r t v o l u m e e l e m e n t s " \
2014-01-27 02:23:30 +06:00
-variable options.inverttets
2016-02-22 20:10:50 +05:00
ttk : : checkbutton $f.bts.btnframe.invtrigs - text " I n v e r t s u r f a c e e l e m e n t s " \
2014-01-27 02:23:30 +06:00
-variable options.inverttrigs
2016-02-22 20:10:50 +05:00
ttk : : checkbutton $f.bts.btnframe.azref - text " A u t o m a t i c Z - r e f i n e m e n t " \
2014-01-27 02:23:30 +06:00
-variable options.autozrefine
2016-02-22 20:10:50 +05:00
pack $f.bts.btnframe - anchor e - padx 50
pack $f.bts.btnframe.parthread $f.bts.btnframe.second $f.bts.btnframe.quad $f.bts.btnframe.invtets $f.bts.btnframe.invtrigs $f.bts.btnframe.azref - anchor w
2016-02-08 19:53:16 +05:00
# tixControl $f.elementorder -label "Element order: " -integer true \
# -variable options.elementorder -min 1 -max 20 \
# -options {
# entry.width 2
# label.width 20
# label.anchor e
# }
# pack $f.elementorder
2016-02-22 20:10:50 +05:00
ttk : : frame $f.bts.btnframe.sbox
pack $f.bts.btnframe.sbox - anchor w - pady 10
ttk : : label $f.bts.btnframe.sbox.l - text " E l e m e n t o r d e r "
ttk : : spinbox $f.bts.btnframe.sbox.elementorder2 - from 1 - to 20 - textvariable options.elementorder - width 2
pack $f.bts.btnframe.sbox.l $f.bts.btnframe.sbox.elementorder2 - anchor w - side left
2016-02-08 19:53:16 +05:00
# ############################################################
# Mesh - Size options
# ############################################################
set f $w.nb.meshsize
ttk : : frame $f.f2
2016-02-22 20:10:50 +05:00
pack $f.f2 - pady 10
2016-02-08 19:53:16 +05:00
# # ttk::style configure Tframe -background red
# puts "********************"
# puts "found these themes:"
# puts [ttk::themes]
# ttk::setTheme classic
# ttk::setTheme aqua
# puts "style Tframe foreground = "
# puts [ttk::style lookup Tframe -foreground]
# puts "f2 style:"
# puts [$f.f2 cget -style]
# puts [winfo class $f.f2]
# puts "style element names gives:"
# puts [ttk::style element names]
set f $f.f2
ttk : : frame $f.meshsize
ttk : : label $f.meshsize.l - text " m a x m e s h - s i z e "
2016-02-22 20:10:50 +05:00
ttk : : spinbox $f.meshsize.s - from 1 e-9 - to 1 e9 - textvariable options.meshsize - width 5 - validate focus - validatecommand [ list my_validatespinbox $f.meshsize.s % P 2 ] \
-invalidcommand [ list my_invalidspinbox $f.meshsize.s ]
2016-02-08 19:53:16 +05:00
pack $f.meshsize - fill x
pack $f.meshsize.s $f.meshsize.l - side right
ttk : : frame $f.minmeshsize
ttk : : label $f.minmeshsize.l - text " m i n m e s h - s i z e "
2016-02-22 20:10:50 +05:00
ttk : : spinbox $f.minmeshsize.s - from 0 - to 1 e9 - textvariable options.minmeshsize - width 5 - validate focus - validatecommand [ list my_validatespinbox $f.minmeshsize.s % P 2 ] \
-invalidcommand [ list my_invalidspinbox $f.minmeshsize.s ]
2016-02-08 19:53:16 +05:00
pack $f.minmeshsize - fill x
pack $f.minmeshsize.s $f.minmeshsize.l - side right
ttk : : frame $f.grading
ttk : : label $f.grading.l - text " m e s h - s i z e g r a d i n g "
2016-02-22 20:10:50 +05:00
ttk : : spinbox $f.grading.s - from 0.1 - to 1.0 - textvariable options.grading - width 5 - increment 0.1 - validate focus - validatecommand [ list my_validatespinbox $f.grading.s % P 2 ] \
-invalidcommand [ list my_invalidspinbox $f.grading.s ]
2016-02-08 19:53:16 +05:00
pack $f.grading - fill x
pack $f.grading.s $f.grading.l - side right
# tixControl $f.meshsize -label "max mesh-size: " -integer false \
# -variable options.meshsize -min 1e-9 -max 1e6 \
# -options {
# entry.width 6
# label.width 25
# label.anchor e
# }
# tixControl $f.minmeshsize -label "min mesh-size: " -integer false \
# -variable options.minmeshsize -min 0 -max 1e6 \
# -options {
# entry.width 6
# label.width 25
# label.anchor e
# }
# tixControl $f.grading -label "mesh-size grading: " -integer false \
# -variable options.grading -min 0.1 -max 1 -step 0.1 \
# -options {
# entry.width 6
# label.width 25
# label.anchor e
# }
# pack $f.meshsize $f.minmeshsize $f.grading
set f $w.nb.meshsize
ttk : : labelframe $f.msf - text " m e s h - s i z e f i l e : "
2014-01-27 02:23:30 +06:00
pack $f.msf
2016-02-08 19:53:16 +05:00
# tixLabelEntry $f.msf.ent -label "mesh-size file: " \
# -labelside top \
# -options {
# entry.textVariable options.meshsizefilename
# entry.width 35
# label.width 25
# label.anchor w
# }
ttk : : entry $f.msf.ent - textvariable options.meshsizefilename - width 30
ttk : : button $f.msf.btn - text " B r o w s e " - command {
2014-01-27 02:23:30 +06:00
global options.meshsizefilename
set types {
{ " M e s h s i z e f i l e " { .msz } } }
set options.meshsizefilename [ tk_getOpenFile - filetypes $types - initialfile $ { options.meshsizefilename } ]
}
pack $f.msf.ent - side left - expand yes - fill x - anchor s - padx 4 - pady 4
pack $f.msf.btn - side left - anchor s - padx 4 - pady 4
label $f.lab - text " A d d i t i o n a l m e s h s i z e r e s t r i c t i o n s : "
# csg-meshsize options
2016-02-08 19:53:16 +05:00
ttk : : labelframe $f.csg - relief groove - borderwidth 3 - text " C S G m e s h - s i z e "
2014-01-27 02:23:30 +06:00
pack $f.csg - fill x
2016-02-08 19:53:16 +05:00
ttk : : frame $f.csg.curv
pack $f.csg.curv - fill x
ttk : : scale $f.csg.curv.sc - orient horizontal - length 150 - from 0.2 - to 5 \
-variable options.curvaturesafety
# -resolution 0.1
ttk : : entry $f.csg.curv.e - textvariable options.curvaturesafety - width 3
ttk : : label $f.csg.curv.la - text " E l e m e n t s p e r c u r v a t u r e r a d i u s "
pack $f.csg.curv.sc $f.csg.curv.e $f.csg.curv.la - side left - padx 4
ttk : : frame $f.csg.elen
pack $f.csg.elen - fill x
ttk : : scale $f.csg.elen.sc - orient horizontal - length 150 - from 0.2 - to 5 \
-variable options.segmentsperedge
# -resolution 0.1
ttk : : entry $f.csg.elen.e - textvariable options.segmentsperedge - width 3
ttk : : label $f.csg.elen.la - text " E l e m e n t s p e r e d g e "
pack $f.csg.elen.sc $f.csg.elen.e $f.csg.elen.la - side left - padx 4
2014-01-27 02:23:30 +06:00
# stl-meshsize options
2016-02-08 19:53:16 +05:00
ttk : : labelframe $f.stl - relief groove - borderwidth 3 - text " S T L m e s h - s i z e "
pack $f.stl
ttk : : frame $f.stl.r2
pack $f.stl.r2 - fill x
ttk : : scale $f.stl.r2.sc - orient horizontal - length 150 - from 0.2 - to 5 \
-variable stloptions.resthchartdistfac
ttk : : entry $f.stl.r2.e - textvariable stloptions.resthchartdistfac - width 3
ttk : : checkbutton $f.stl.r2.bu - text " S T L - c h a r t d i s t a n c e " \
2014-01-27 02:23:30 +06:00
-variable stloptions.resthchartdistenable
2016-02-08 19:53:16 +05:00
pack $f.stl.r2.sc $f.stl.r2.e $f.stl.r2.bu - side left - padx 4
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
ttk : : frame $f.stl.r6
2014-01-27 02:23:30 +06:00
pack $f.stl.r6 - anchor w
2016-02-08 19:53:16 +05:00
ttk : : scale $f.stl.r6.sc - orient horizontal - length 150 - from 0.2 - to 5 \
-variable stloptions.resthlinelengthfac
ttk : : entry $f.stl.r6.e - textvariable stloptions.resthlinelengthfac - width 3
ttk : : checkbutton $f.stl.r6.bu - text " S T L - l i n e l e n g t h " \
2014-01-27 02:23:30 +06:00
-variable stloptions.resthlinelengthenable
2016-02-08 19:53:16 +05:00
pack $f.stl.r6.sc $f.stl.r6.e $f.stl.r6.bu - side left - padx 4
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
ttk : : frame $f.stl.r3
2014-01-27 02:23:30 +06:00
pack $f.stl.r3 - anchor w
2016-02-08 19:53:16 +05:00
ttk : : scale $f.stl.r3.sc - orient horizontal - length 150 - from 0.2 - to 8 \
-variable stloptions.resthcloseedgefac
ttk : : entry $f.stl.r3.e - textvariable stloptions.resthcloseedgefac - width 3
ttk : : checkbutton $f.stl.r3.bu - text " S T L / I G E S / S T E P - c l o s e e d g e s " \
2014-01-27 02:23:30 +06:00
-variable stloptions.resthcloseedgeenable
2016-02-08 19:53:16 +05:00
pack $f.stl.r3.sc $f.stl.r3.e $f.stl.r3.bu - side left - padx 4
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
ttk : : frame $f.stl.r1
2014-01-27 02:23:30 +06:00
pack $f.stl.r1 - anchor w
2016-02-08 19:53:16 +05:00
ttk : : scale $f.stl.r1.sc - orient horizontal - length 150 - from 0.2 - to 5 \
-variable stloptions.resthsurfcurvfac
ttk : : entry $f.stl.r1.e - textvariable stloptions.resthsurfcurvfac - width 3
ttk : : checkbutton $f.stl.r1.bu - text " S T L - s u r f a c e c u r v a t u r e " \
2014-01-27 02:23:30 +06:00
-variable stloptions.resthsurfcurvenable
2016-02-08 19:53:16 +05:00
pack $f.stl.r1.sc $f.stl.r1.e $f.stl.r1.bu - side left - padx 4
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
ttk : : frame $f.stl.r3b
2014-01-27 02:23:30 +06:00
pack $f.stl.r3b - anchor w
2016-02-08 19:53:16 +05:00
ttk : : scale $f.stl.r3b.sc - orient horizontal - length 150 - from 0.2 - to 5 \
-variable stloptions.resthedgeanglefac
ttk : : entry $f.stl.r3b.e - textvariable stloptions.resthedgeanglefac - width 3
ttk : : checkbutton $f.stl.r3b.bu - text " S T L - e d g e a n g l e " \
-variable stloptions.resthedgeangleenable
pack $f.stl.r3b.sc $f.stl.r3b.e $f.stl.r3b.bu - side left - padx 4
ttk : : frame $f.stl.r5
2014-01-27 02:23:30 +06:00
pack $f.stl.r5 - anchor w
2016-02-08 19:53:16 +05:00
ttk : : scale $f.stl.r5.sc - orient horizontal - length 150 - from 0.2 - to 5 \
-variable stloptions.resthsurfmeshcurvfac
ttk : : entry $f.stl.r5.e - textvariable stloptions.resthsurfmeshcurvfac - width 3
ttk : : checkbutton $f.stl.r5.bu - text " S T L - s u r f a c e m e s h c u r v " \
2014-01-27 02:23:30 +06:00
-variable stloptions.resthsurfmeshcurvenable
2016-02-08 19:53:16 +05:00
pack $f.stl.r5.sc $f.stl.r5.e $f.stl.r5.bu - side left - padx 4
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
ttk : : checkbutton $f.stl.recalch - text " S T L - R e c a l c m e s h s i z e f o r s u r f a c e o p t i m i z a t i o n " \
2014-01-27 02:23:30 +06:00
-variable stloptions.recalchopt
pack $f.stl.recalch
2016-02-08 19:53:16 +05:00
ttk : : button $f.stl.calch - text " C a l c N e w H " - command { redraw ; Ng_STLCalcLocalH }
2014-01-27 02:23:30 +06:00
pack $f.stl.calch
2016-02-22 20:10:50 +05:00
# set f [$w.nb subwidget chartopt]
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
# round ttk::scale values to n_digits
proc mycom { w n_digits val} {
global [ $w cget - variable]
if { $n_digits == 0 } {
set [ $w cget - variable] [ tcl : : mathfunc::round $val ]
} else {
set [ $w cget - variable] [ format " % . [ a p p e n d n _ d i g i t s " f " ] " $val ]
}
}
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
# validate ttk::entry which are linked to ttk::scales widgets
proc my_validate { w val n_digits} {
if { [ string length $val ] == 0 } { return 0 }
if { [ string is double $val ] == 1 } {
set scale_loc [ lindex [ winfo children [ winfo parent $w ] ] [ lsearch [ winfo children [ winfo parent $w ] ] * scale] ]
global [ $scale_loc cget - variable]
if { $n_digits == 0 } {
set [ $scale_loc cget - variable] [ tcl : : mathfunc::max [ $scale_loc cget - from] [ tcl : : mathfunc::min [ $scale_loc cget - to] [ tcl : : mathfunc::round $val ] ] ]
} else {
set [ $scale_loc cget - variable] [ tcl : : mathfunc::max [ $scale_loc cget - from] [ tcl : : mathfunc::min [ $scale_loc cget - to] [ format " % . [ a p p e n d n _ d i g i t s " f " ] " $val ] ] ]
}
return 1
} else {
return 0
}
}
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
# if my_validate returns 0, this function gets called
proc my_invalid { w } {
set scale_loc [ lindex [ winfo children [ winfo parent $w ] ] [ lsearch [ winfo children [ winfo parent $w ] ] * scale] ]
global [ $scale_loc cget - variable]
set [ $scale_loc cget - variable] [ tcl : : mathfunc::round [ $scale_loc get ] ]
}
set f $w.nb.chartopt
ttk : : labelframe $f.mainframe - text " S T L a n g l e s " - relief groove - borderwidth 3
pack $f.mainframe - fill x - pady 15
set f $f.mainframe
ttk : : frame $f.f1
ttk : : label $f.f1.labYangles - text " Y e l l o w E d g e s A n g l e ( ) "
ttk : : scale $f.f1.scale - orient horizontal - length 150 - from 0 - to 90 - variable stloptions.yangle - takefocus 0 - command [ list mycom $f.f1.scale 1 ]
ttk : : entry $f.f1.entry - textvariable stloptions.yangle - width 5 - validate focusout - takefocus 0 - validatecommand [ list my_validate $f.f1.entry % P 1 ] \
-invalidcommand [ list my_invalid $f.f1.entry ]
pack $f.f1 - anchor w - padx 30
pack $f.f1.scale $f.f1.entry $f.f1.labYangles - side left - padx 4 - pady 6
ttk : : frame $f.f21
ttk : : label $f.f21.labEangles - text " E d g e C o r n e r A n g l e ( ) "
ttk : : scale $f.f21.scale - orient horizontal - length 150 - from 0 - to 180 - variable stloptions.edgecornerangle - takefocus 0 - command [ list mycom $f.f21.scale 1 ]
ttk : : entry $f.f21.entry - textvariable stloptions.edgecornerangle - width 5 - validate focusout - takefocus 0 - validatecommand [ list my_validate $f.f21.entry % P 1 ] \
-invalidcommand [ list my_invalid $f.f21.entry ]
pack $f.f21 - anchor w - padx 30
pack $f.f21.scale $f.f21.entry $f.f21.labEangles - side left - padx 4 - pady 6
frame $f.f31
ttk : : label $f.f31.lab31 - text " C h a r t A n g l e ( ) "
ttk : : scale $f.f31.scale - orient horizontal - length 150 - from 0 - to 180 - variable stloptions.chartangle - takefocus 0 - command [ list mycom $f.f31.scale 1 ]
ttk : : entry $f.f31.entry - textvariable stloptions.chartangle - width 5 - validate focusout - takefocus 0 - validatecommand [ list my_validate $f.f31.entry % P 1 ] \
-invalidcommand [ list my_invalid $f.f31.entry ]
pack $f.f31 - anchor w - padx 30
pack $f.f31.scale $f.f31.entry $f.f31.lab31 - side left - padx 4 - pady 6
frame $f.f41
ttk : : label $f.f41.lab41 - text " O u t e r C h a r t A n g l e ( ) "
ttk : : scale $f.f41.scale - orient horizontal - length 150 - from 0 - to 180 - variable stloptions.outerchartangle - takefocus 0 - command [ list mycom $f.f41.scale 1 ]
ttk : : entry $f.f41.entry - textvariable stloptions.outerchartangle - width 5 - validate focusout - takefocus 0 - validatecommand [ list my_validate $f.f41.entry % P 1 ] \
-invalidcommand [ list my_invalid $f.f41.entry ]
pack $f.f41 - anchor w - padx 30
pack $f.f41.scale $f.f41.entry $f.f41.lab41 - side left - padx 4 - pady 6
2014-01-27 02:23:30 +06:00
# Optimization options
2016-02-22 20:10:50 +05:00
global last_accepted
# Used to validate the entries linked with a ttk::spinbox widget
proc my_validatespinbox { w val n_digits} {
global last_accepted
if { [ string length $val ] == 0 } { return 0 }
if { [ string is double $val ] == 1 } {
if { $n_digits == 0 } { set val [ tcl : : mathfunc::int $val ] } else { set val [ format " % . [ a p p e n d n _ d i g i t s " f " ] " $val ] } ; # {set val [expr 0.1*[tcl::mathfunc::int [expr 10*$val]]] }
$w set [ tcl : : mathfunc::max [ $w cget - from] [ tcl : : mathfunc::min [ $w cget - to] $val ] ]
set last_accepted $val
return 1
} else {
return 0
}
}
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
proc my_invalidspinbox { w } {
global last_accepted
$w set $last_accepted
}
# set f [$w.nb subwidget optimizer]
set f $w.nb.optimizer
ttk : : labelframe $f.optframe - text " O p t i m i z a t i o n s e t t i n g s " - relief groove - borderwidth 3
pack $f.optframe - fill x - pady 15
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
ttk : : frame $f.optframe.sos
ttk : : label $f.optframe.sos.l - text " S u r f a c e o p t s t e p s "
ttk : : spinbox $f.optframe.sos.s - from 0 - to 99 - textvariable options.optsteps2d - width 5 - increment 1 - validate focus - validatecommand [ list my_validatespinbox $f.optframe.sos.s % P 0 ] \
-invalidcommand [ list my_invalidspinbox $f.optframe.sos.s ]
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
pack $f.optframe.sos - padx 60 - anchor e
pack $f.optframe.sos.s $f.optframe.sos.l - side right - fill x - pady 2
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
ttk : : frame $f.optframe.vos
ttk : : label $f.optframe.vos.l - text " V o l u m e o p t s t e p s "
ttk : : spinbox $f.optframe.vos.s - from 0 - to 99 - textvariable options.optsteps3d - width 5 - increment 1 - validate focus - validatecommand [ list my_validatespinbox $f.optframe.vos.s % P 0 ] \
-invalidcommand [ list my_invalidspinbox $f.optframe.vos.s ]
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
pack $f.optframe.vos - padx 60 - anchor e
pack $f.optframe.vos.s $f.optframe.vos.l - side right - fill x - pady 2
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
ttk : : frame $f.optframe.esw
ttk : : label $f.optframe.esw.l - text " E l e m e n t s i z e w e i g h t "
ttk : : spinbox $f.optframe.esw.s - from 0 - to 1 - textvariable options.elsizeweight - width 5 - increment 0.1 - validate focus - validatecommand [ list my_validatespinbox $f.optframe.esw.s % P 1 ] \
-invalidcommand [ list my_invalidspinbox $f.optframe.esw.s ]
pack $f.optframe.esw - padx 60 - anchor e
pack $f.optframe.esw.s $f.optframe.esw.l - side right - fill x - pady 2
ttk : : frame $f.optframe.wem
ttk : : label $f.optframe.wem.l - text " W o r s t e l e m e n t m e a s u r e "
ttk : : spinbox $f.optframe.wem.s - from 1 - to 10 - textvariable options.opterrpow - width 5 - increment 1 - validate focus - validatecommand [ list my_validatespinbox $f.optframe.wem.s % P 0 ] \
-invalidcommand [ list my_invalidspinbox $f.wem.s ]
pack $f.optframe.wem - padx 60 - anchor e
pack $f.optframe.wem.s $f.optframe.wem.l - side right - fill x - pady 2
# These functions are needed due to a bug within the aqua theme
# if a ttk::scale widget has a from value larger than 100.
proc mycom_helper_osx { w val} {
global [ $w cget - variable] options.badellimit
set [ $w cget - variable] [ tcl : : mathfunc::round $val ]
set options.badellimit [ expr [ tcl : : mathfunc::round $val ] + 100 ]
}
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
proc my_validate_helper_osx { w val} {
if { [ string length $val ] == 0 } { return 0 }
if { [ string is double $val ] == 1 } {
set scale_loc [ lindex [ winfo children [ winfo parent $w ] ] [ lsearch [ winfo children [ winfo parent $w ] ] * scale] ]
global [ $scale_loc cget - variable] options.badellimit
set [ $scale_loc cget - variable] [ tcl : : mathfunc::max [ $scale_loc cget - from] [ tcl : : mathfunc::min [ $scale_loc cget - to] [ expr [ tcl : : mathfunc::round $val ] - 100 ] ] ]
set options.badellimit [ tcl : : mathfunc::max [ expr [ $scale_loc cget - from] + 100 ] [ tcl : : mathfunc::min [ expr [ $scale_loc cget - to] + 100 ] [ tcl : : mathfunc::round $val ] ] ]
return 1
} else {
return 0
}
}
proc my_invalid_helper_osx { w } {
global options.badellimit
set scale_loc [ lindex [ winfo children [ winfo parent $w ] ] [ lsearch [ winfo children [ winfo parent $w ] ] * scale] ]
global [ $scale_loc cget - variable]
set [ $scale_loc cget - variable] [ tcl : : mathfunc::round [ $scale_loc get ] ]
set options.badellimit [ expr [ tcl : : mathfunc::round [ $scale_loc get ] ] + 100 ]
}
global dummy_badellimit
set dummy_badellimit 75
ttk : : labelframe $f.optframe2 - text " B a d e l e m e n t s " - relief groove - borderwidth 3
pack $f.optframe2 - fill x - pady 10 - ipadx 20 - ipady 5
ttk : : frame $f.optframe2.badellimit
ttk : : label $f.optframe2.badellimit.lab - text " b a d e l e m e n t c r i t e r i o n " ;
ttk : : scale $f.optframe2.badellimit.scale - orient horizontal - length 100 - from 60 - to 80 - variable dummy_badellimit - takefocus 0 - command [ list mycom_helper_osx $f.optframe2.badellimit.scale ]
ttk : : entry $f.optframe2.badellimit.entry - textvariable options.badellimit - width 3 - validate focusout - takefocus 0 - validatecommand [ list my_validate_helper_osx $f.optframe2.badellimit.entry % P] \
-invalidcommand [ list my_invalid_helper_osx $f.optframe2.badellimit.entry ]
pack $f.optframe2.badellimit - pady 8
pack $f.optframe2.badellimit.scale $f.optframe2.badellimit.entry $f.optframe2.badellimit.lab - side left - padx 4
2014-01-27 02:23:30 +06:00
# insider options
2016-02-08 19:53:16 +05:00
# set f [$w.nb subwidget insider]
set f $w.nb.debug
2016-02-22 20:10:50 +05:00
ttk : : labelframe $f.f2 - text " A d v a n c e d o p t i o n s " - borderwidth 3 - relief groove
pack $f.f2 - fill x - pady 15
ttk : : frame $f.f2.frame
pack $f.f2.frame
set f $f.f2.frame
2016-02-08 19:53:16 +05:00
ttk : : checkbutton $f.localh - text " U s e L o c a l M e s h s i z e " \
2014-01-27 02:23:30 +06:00
-variable options.localh
2016-02-08 19:53:16 +05:00
ttk : : checkbutton $f.delauney - text " U s e D e l a u n a y " \
2014-01-27 02:23:30 +06:00
-variable options.delaunay
2016-02-08 19:53:16 +05:00
ttk : : checkbutton $f.checkoverlap - text " C h e c k O v e r l a p p i n g " \
2014-01-27 02:23:30 +06:00
-variable options.checkoverlap
2016-02-08 19:53:16 +05:00
ttk : : checkbutton $f.checkcb - text " C h e c k C h a r t B o u n d a r y " \
2014-01-27 02:23:30 +06:00
-variable options.checkchartboundary
2016-02-08 19:53:16 +05:00
ttk : : checkbutton $f.blockfill - text " D o B l o c k f i l l i n g " \
2014-01-27 02:23:30 +06:00
-variable options.blockfill
2016-02-22 20:10:50 +05:00
grid $f.localh $f.delauney - sticky nw
grid $f.checkoverlap $f.blockfill - sticky nw
grid $f.checkcb - sticky nw
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
# debugging options
2016-02-08 19:53:16 +05:00
set f $w.nb.debug
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
# enable / disable ttk::entry widgets linked to ttk::checkbuttons
proc enable_cb { w1 w2 w3} {
Ng_SetDebugParameters
if { [ string match * selected* [ $w1 state ] ] == 1 } {
$w2 configure - state normal
$w3 configure - state normal
} else {
$w2 configure - state disabled
$w3 configure - state disabled
}
}
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
ttk : : labelframe $f.cb1 - text " D e b u g g i n g o p t i o n s " - borderwidth 3 - relief groove
pack $f.cb1 - fill x - pady 15
frame $f.cb1.cb0
pack $f.cb1.cb0
ttk : : checkbutton $f.cb1.cb0.slowchecks - text " S l o w c h e c k s " \
-variable debug.slowchecks - command { Ng_SetDebugParameters }
ttk : : checkbutton $f.cb1.cb0.debugoutput - text " D e b u g g i n g o u t o u t " \
-variable debug.debugoutput - command { Ng_SetDebugParameters }
ttk : : checkbutton $f.cb1.cb0.haltexline - text " H a l t o n e x i s i n g l i n e " \
-variable debug.haltexistingline - command { Ng_SetDebugParameters }
ttk : : checkbutton $f.cb1.cb0.haltoverlap - text " H a l t o n O v e r l a p " \
-variable debug.haltoverlap - command { Ng_SetDebugParameters }
ttk : : checkbutton $f.cb1.cb0.haltsuc - text " H a l t o n s u c c e s s " \
-variable debug.haltsuccess - command { Ng_SetDebugParameters }
ttk : : checkbutton $f.cb1.cb0.haltnosuc - text " H a l t o n n o s u c c e s s " \
-variable debug.haltnosuccess - command { Ng_SetDebugParameters }
ttk : : checkbutton $f.cb1.cb0.haltlargequal - text " H a l t o n l a r g e q u a l i t y c l a s s " \
-variable debug.haltlargequalclass - command { Ng_SetDebugParameters }
ttk : : checkbutton $f.cb1.cb0.haltseg - text " H a l t o n S e g m e n t : " \
-variable debug.haltsegment - command [ list enable_cb $f.cb1.cb0.haltseg $f.cb1.cb0.segs.ent1 $f.cb1.cb0.segs.ent2 ]
ttk : : checkbutton $f.cb1.cb0.haltnode - text " H a l t o n N o d e : " \
-variable debug.haltnode - command [ list enable_cb $f.cb1.cb0.haltnode $f.cb1.cb0.segs.ent1 $f.cb1.cb0.segs.ent2 ]
ttk : : frame $f.cb1.cb0.fr
ttk : : checkbutton $f.cb1.cb0.fr.cb - text " H a l t o n F a c e : " \
-variable debug.haltface - command [ list enable_cb $f.cb1.cb0.fr.cb $f.cb1.cb0.fr.ent $f.cb1.cb0.fr.ent ]
ttk : : entry $f.cb1.cb0.fr.ent - textvariable debug.haltfacenr - width 3 - state disabled
pack $f.cb1.cb0.fr.cb $f.cb1.cb0.fr.ent - side left
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
ttk : : frame $f.cb1.cb0.segs
ttk : : label $f.cb1.cb0.segs.lab1 - text " P 1 : "
ttk : : entry $f.cb1.cb0.segs.ent1 - width 8 \
-textvariable debug.haltsegmentp1 - state disabled
ttk : : label $f.cb1.cb0.segs.lab2 - text " P 2 : "
ttk : : entry $f.cb1.cb0.segs.ent2 - width 8 \
-textvariable debug.haltsegmentp2 - state disabled
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
pack $f.cb1.cb0.segs.lab1 $f.cb1.cb0.segs.ent1 $f.cb1.cb0.segs.lab2 $f.cb1.cb0.segs.ent2 - side left
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
grid $f.cb1.cb0.slowchecks $f.cb1.cb0.debugoutput - sticky nw
grid $f.cb1.cb0.haltexline $f.cb1.cb0.haltoverlap - sticky nw
grid $f.cb1.cb0.haltsuc $f.cb1.cb0.haltnosuc - sticky nw
grid $f.cb1.cb0.haltlargequal $f.cb1.cb0.fr - sticky nw
grid $f.cb1.cb0.haltnode - sticky nw
grid $f.cb1.cb0.haltseg - stick nw
grid $f.cb1.cb0.segs - stick w - row 4 - rowspan 2 - column 1
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
grid rowconfigure $f.cb1.cb0 3 - pad 8
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
ttk : : checkbutton $f.cb1.cb0.showactivechart - text " S h o w A c t i v e M e s h i n g - C h a r t " - variable stloptions.showactivechart - command { Ng_SetVisParameters ; redraw }
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
grid $f.cb1.cb0.showactivechart
grid rowconfigure $f.cb1.cb0 3 - pad 8
grid rowconfigure $f.cb1.cb0 5 - pad 8
set f $f.cb1
set f $w.nb.debug
ttk : : labelframe $f.cont - relief groove - borderwidth 3 - text " D e b u g g i n g a i s u a l i z a t i o n "
pack $f.cont - fill x - pady 15
ttk : : frame $f.cont.f
pack $f.cont.f
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
ttk : : checkbutton $f.cont.f.multidrawing - text " D r a w M e s h i n g " - variable multithread_drawing
ttk : : checkbutton $f.cont.f.multitestmode - text " M e s h i n g T e s t m o d e " - variable multithread_testmode
ttk : : button $f.cont.f.goon - text " G o O n " - command { set multithread_pause 0 }
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
grid $f.cont.f.multidrawing - sticky nw
grid $f.cont.f.multitestmode - sticky nw
grid $f.cont.f.goon - row 0 - rowspan 2 - column 1 - sticky w
grid columnconfigure $f.cont.f 0 - pad 30
grid columnconfigure $f.cont.f 1 - pad 20
2014-01-27 02:23:30 +06:00
global userlevel
if { $userlevel < 3 } {
$w.nb delete insider
$w.nb delete debug
}
# tixButtonBox $w.bbox -orientation horizontal
# $w.bbox add ok -text Apply -underline 0 -width 5 \
# -command {
# [.options_dlg.nb subwidget meshsize].meshsize invoke
# [.options_dlg.nb subwidget meshsize].grading invoke
# [.options_dlg.nb subwidget optimizer].os2d invoke
# [.options_dlg.nb subwidget optimizer].os3d invoke
# [.options_dlg.nb subwidget optimizer].elw invoke
# [.options_dlg.nb subwidget optimizer].wem invoke
# Ng_SetMeshingParameters
# }
# $w.bbox add close -text Done -underline 0 -width 5 \
# -command {
# [.options_dlg.nb subwidget meshsize].meshsize invoke
# [.options_dlg.nb subwidget meshsize].grading invoke
# [.options_dlg.nb subwidget optimizer].os2d invoke
# [.options_dlg.nb subwidget optimizer].os3d invoke
# [.options_dlg.nb subwidget optimizer].elw invoke
# [.options_dlg.nb subwidget optimizer].wem invoke
# Ng_SetMeshingParameters
# destroy .options_dlg
# }
2016-02-22 20:10:50 +05:00
# pack $w.bbox -side bottom -fill x
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
ttk : : frame $w.bu
pack $w.bu - fill x - ipady 3
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
ttk : : button $w.bu.apl - text " A p p l y " - command {
Ng_SetMeshingParameters
Ng_SetDebugParameters
}
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
ttk : : button $w.bu.ok - text " D o n e " - command {
Ng_SetMeshingParameters
Ng_SetDebugParameters
wm withdraw .options_dlg
# destroy .options_dlg
}
2014-01-27 02:23:30 +06:00
2016-02-22 20:10:50 +05:00
pack $w.bu.apl $w.bu.ok - side left - expand yes
wm withdraw $w
2014-01-27 02:23:30 +06:00
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " M e s h i n g O p t i o n s "
focus .options_dlg
}
}
meshingoptionsdialog
wm withdraw .options_dlg
#
#
# Viewing dialog
#
#
proc viewingoptionsdialog { } {
global userlevel
set w .viewopts_dlg
if { [ winfo exists .viewopts_dlg] == 1 } {
wm withdraw $w
wm deiconify $w
focus $w
} {
toplevel $w
2016-02-08 19:53:16 +05:00
wm resizable $w 0 0
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
pack [ ttk : : notebook $w.nb ] - fill both - fill both - side top
$w.nb add [ ttk : : frame $w.nb.general ] - text " G e n e r a l " - underline 0
$w.nb add [ ttk : : frame $w.nb.stl ] - text " S T L " - underline 0
$w.nb add [ ttk : : frame $w.nb.occ ] - text " I G E S / S T E P " - underline 0
$w.nb add [ ttk : : frame $w.nb.mesh ] - text " M e s h " - underline 0
$w.nb add [ ttk : : frame $w.nb.light ] - text " L i g h t " - underline 0
$w.nb add [ ttk : : frame $w.nb.edges ] - text " E d g e s " - underline 0
$w.nb add [ ttk : : frame $w.nb.misc ] - text " M i s c . " - underline 3
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
# tixNoteBook $w.nb -ipadx 6 -ipady 6
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
# $w.nb add general -label "General" -underline 0
# $w.nb add stl -label "STL" -underline 0
# $w.nb add occ -label "IGES/STEP" -underline 0
# $w.nb add mesh -label "Mesh" -underline 0
# $w.nb add light -label "Light" -underline 0
# $w.nb add edges -label "Edges" -underline 0
# $w.nb add misc -label "Misc." -underline 3
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
# pack $w.nb -expand yes -fill both -padx 5 -pady 5 -side top
2014-01-27 02:23:30 +06:00
# general
2016-02-08 19:53:16 +05:00
set f $w.nb.general
2014-01-27 02:23:30 +06:00
2016-02-08 19:53:16 +05:00
ttk : : checkbutton $f.backcol - text " W h i t e B a c k g r o u n d " \
2014-01-27 02:23:30 +06:00
-variable viewoptions.whitebackground \
-command { Ng_SetVisParameters ; redraw }
2016-02-08 19:53:16 +05:00
ttk : : checkbutton $f.cross - text " D r a w C o o r d i n a t e C r o s s " \
2014-01-27 02:23:30 +06:00
-variable viewoptions.drawcoordinatecross \
-command { Ng_SetVisParameters ; redraw }
2016-02-08 19:53:16 +05:00
ttk : : checkbutton $f.color - text " D r a w C o l o r - b a r " \
2014-01-27 02:23:30 +06:00
-variable viewoptions.drawcolorbar \
-command { Ng_SetVisParameters ; redraw }
2016-02-08 19:53:16 +05:00
ttk : : checkbutton $f.netgen - text " D r a w N e t g e n - l o g o " \
2014-01-27 02:23:30 +06:00
-variable viewoptions.drawnetgenlogo \
-command { Ng_SetVisParameters ; redraw }
pack $f.backcol $f.cross $f.color $f.netgen
# checkbutton $f.stereo -text "Stereo View" \
# -variable viewoptions.stereo \
# -command { Ng_SetVisParameters; redraw }
# pack $f.stereo
2016-02-08 19:53:16 +05:00
menu $f.stylemenu
2016-02-22 20:10:50 +05:00
ttk : : menubutton $f.style - menu $f.stylemenu - width 10
2016-02-08 19:53:16 +05:00
# -text [ttk::getTheme]
pack $f.style
foreach theme [ ttk : : themes] {
$f.stylemenu add command - label $theme \
-command " $ f . s t y l e c o n f i g u r e - t e x t $ t h e m e ; p u t s $ t h e m e ; t t k : : s e t T h e m e $ t h e m e "
}
2014-01-27 02:23:30 +06:00
# stl geometry
2016-02-08 19:53:16 +05:00
set f $w.nb.stl
2014-01-27 02:23:30 +06:00
frame $f.show - relief groove - borderwidth 3
pack $f.show
checkbutton $f.show.showtrias - text " S h o w S T L - T r i a n g l e s " \
-variable stloptions.showtrias - command { Ng_SetVisParameters ; redraw }
pack $f.show.showtrias - anchor w
checkbutton $f.show.showfilledtrias - text " S h o w F i l l e d T r i a n g l e s " \
-variable stloptions.showfilledtrias - command { Ng_SetVisParameters ; redraw }
pack $f.show.showfilledtrias - anchor w
checkbutton $f.show.showactivechart - text " S h o w A c t i v e M e s h i n g - C h a r t " \
-variable stloptions.showactivechart - command { Ng_SetVisParameters ; redraw }
pack $f.show.showactivechart - anchor w
checkbutton $f.show.showedges - text " S h o w E d g e s " \
-variable stloptions.showedges - command { Ng_SetVisParameters ; redraw }
pack $f.show.showedges - anchor w
frame $f.special - relief groove - borderwidth 3
pack $f.special
checkbutton $f.special.showmarktrias - text " S h o w C h a r t T r i a n g l e s " \
-variable stloptions.showmarktrias \
-command { set stldoctor.showfaces 0 ; Ng_STLDoctor ; Ng_SetVisParameters ; redraw }
pack $f.special.showmarktrias - side left
checkbutton $f.special.showfaces - text " S h o w F a c e s " \
-variable stldoctor.showfaces \
-command { set stloptions.showmarktrias 0 ; Ng_STLDoctor ; Ng_SetVisParameters ; redraw }
pack $f.special.showfaces - side left
frame $f.fn - relief groove - borderwidth 3
pack $f.fn
label $f.fn.lab3 - text " C h a r t / F a c e n u m b e r : "
scale $f.fn.scale3 - orient horizontal - length 200 - from 0 - to 200 \
-resolution 1 - tickinterval 50 \
-command { Ng_SetVisParameters ; redraw } - variable stloptions.chartnumber
pack $f.fn.lab3 $f.fn.scale3 - side left
frame $f.fo - relief groove - borderwidth 3
pack $f.fo
label $f.fo.lab - text " C h a r t / F a c e O f f s e t : " ;
entry $f.fo.ent - width 5 - relief sunken \
-textvariable stloptions.chartnumberoffset
pack $f.fo.lab $f.fo.ent - side left
frame $f.mt
pack $f.mt - fill x
checkbutton $f.mt.bu - text " S h o w M a r k e d ( D i r t y ) T r i a n g l e s " \
-variable stldoctor.showmarkedtrigs \
-command { Ng_STLDoctor ; redraw }
pack $f.mt.bu
frame $f.ep
pack $f.ep - fill x
checkbutton $f.ep.bu - text " s h o w e d g e c o r n e r p o i n t s " \
-variable stldoctor.showedgecornerpoints \
-command { Ng_STLDoctor ; redraw }
pack $f.ep.bu
frame $f.stt
pack $f.stt - fill x
checkbutton $f.stt.bu - text " s h o w t o u c h e d t r i a n g l e c h a r t " \
-variable stldoctor.showtouchedtrigchart \
-command { set stldoctor.showfaces 0 ; set stloptions.showmarktrias 1 ; \
Ng_STLDoctor ; Ng_SetVisParameters ; redraw }
pack $f.stt.bu
frame $f.sml
pack $f.sml - fill x
checkbutton $f.sml.bu - text " d r a w m e s h e d e d g e s " \
-variable stldoctor.drawmeshededges \
-command { Ng_STLDoctor ; }
pack $f.sml.bu
frame $f.sm
pack $f.sm - fill x
checkbutton $f.sm.bu - text " s e l e c t w i t h m o u s e " \
-variable stldoctor.selectwithmouse
pack $f.sm.bu
frame $f.st - relief groove - borderwidth 3
pack $f.st - fill x
label $f.st.lab - text " S e l e c t t r i a n g l e b y n u m b e r " ;
entry $f.st.ent - width 5 - relief sunken \
-textvariable stldoctor.selecttrig
pack $f.st.ent $f.st.lab - side left - expand yes
frame $f.vc - relief groove - borderwidth 3
pack $f.vc - fill x
checkbutton $f.vc.bu - text " s h o w v i c i n i t y " \
-variable stldoctor.showvicinity \
-command { Ng_STLDoctor vicinity; redraw }
label $f.vc.lab - text " v i c i n i t y s i z e " ;
scale $f.vc.sc - orient horizontal - length 200 - from 0 - to 200 \
-resolution 1 - variable stldoctor.vicinity \
-command { Ng_STLDoctor vicinity; redraw }
pack $f.vc.bu $f.vc.lab $f.vc.sc - expand yes
# IGES/STEP
2016-02-08 19:53:16 +05:00
set f $w.nb.occ
2014-01-27 02:23:30 +06:00
checkbutton $f.occshowsurfaces - text " S h o w s u r f a c e s " \
-variable occoptions.showsurfaces \
-command { Ng_SetOCCVisParameters ; redraw }
checkbutton $f.occshowedges - text " S h o w e d g e s " \
-variable occoptions.showedges \
-command { Ng_SetOCCVisParameters ; redraw }
frame $f.deflection - relief groove - borderwidth 3
pack $f.deflection - fill x
button $f.deflection.lab - text " R e b u i l d v i s u a l i z a t i o n d a t a " \
-command {
Ng_SetOCCVisParameters
Ng_OCCCommand buildvisualizationmesh
redraw
}
tixControl $f.deflection.ent - label " V i s u a l i z a t i o n s m o o t h n e s s " - integer false \
-variable occoptions.deflection - min 0.1 - max 3 - step 0.1 \
-options { entry.width 3 } \
-command { Ng_SetOCCVisParameters }
pack $f.deflection.ent $f.deflection.lab - side left - expand yes
pack $f.occshowsurfaces $f.occshowedges
# ACIS visualization / construction
tixControl $f.showsolid - label " S h o w s o l i d ( 0 f o r a l l ) " - integer true \
-variable occoptions.showsolidnr - min 0 - max 999 \
-options { entry.width 3 } \
-command { Ng_SetOCCVisParameters ; redraw }
tixControl $f.showsolid2 - label " S h o w s o l i d 2 " - integer true \
-variable occoptions.showsolidnr2 - min 0 - max 999 \
-options { entry.width 3 } \
-command { Ng_SetOCCVisParameters ; redraw }
button $f.subtract - text " S u b t r a c t ( 2 m i n u s 1 ) " \
-command {
Ng_ACISCommand subtract $ { occoptions.showsolidnr } $ { occoptions.showsolidnr2 }
redraw
}
button $f.combine - text " C o m b i n e a l l " \
-command {
Ng_ACISCommand combineall
redraw
}
pack $f.showsolid $f.showsolid2 $f.subtract $f.combine
# mesh options
2016-02-08 19:53:16 +05:00
set f $w.nb.mesh
2014-01-27 02:23:30 +06:00
checkbutton $f.showcolor - text " C o l o r e d M e s h s i z e V i s u a l i z a t i o n " \
-variable viewoptions.colormeshsize \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showfilledtrigs - text " S h o w f i l l e d t r i a n g l e s " \
-variable viewoptions.drawfilledtrigs \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showedges - text " S h o w e d g e s " \
-variable viewoptions.drawedges \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showoutline - text " S h o w T r i a n g l e O u t l i n e " \
-variable viewoptions.drawoutline \
-command { Ng_SetVisParameters ; redraw }
tixControl $f.subdiv - label " S u b d i v i s i o n " - integer true \
-variable visoptions.subdivisions - min 0 - max 8 \
-options { entry.width 2 } \
-command { Ng_SetVisParameters ; Ng_Vis_Set parameters; Ng_SetNextTimeStamp ; redraw }
checkbutton $f.showbadels - text " S h o w b a d e l e m e n t s " \
-variable viewoptions.drawbadels \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showprisms - text " S h o w p r i s m s " \
-variable viewoptions.drawprisms \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showpyramids - text " S h o w p y r a m i d s " \
-variable viewoptions.drawpyramids \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showhexes - text " S h o w h e x e s " \
-variable viewoptions.drawhexes \
-command { Ng_SetVisParameters ; redraw }
frame $f.fshrink
label $f.fshrink.lab - text " S h r i n k e l e m e n t s "
scale $f.fshrink.scale - orient horizontal - length 200 - from 0 - to 1.0001 \
-resolution 0.01 - tickinterval 0.25 \
-command { Ng_SetVisParameters ; after idle redraw } \
-variable viewoptions.shrink
checkbutton $f.showidentified - text " S h o w i d e n t i f i e d p o i n t s " \
-variable viewoptions.drawidentified \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showmetispartition - text " S h o w M E T I S P a r t i t i o n " \
-variable viewoptions.drawmetispartition \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showpointnumbers - text " S h o w P o i n t - n u m b e r s " \
-variable viewoptions.drawpointnumbers \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showedgenumbers - text " S h o w E d g e - n u m b e r s " \
-variable viewoptions.drawedgenumbers \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showfacenumbers - text " S h o w F a c e - n u m b e r s " \
-variable viewoptions.drawfacenumbers \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showelementnumbers - text " S h o w E l e m e n t - n u m b e r s " \
-variable viewoptions.drawelementnumbers \
-command { Ng_SetVisParameters ; redraw }
# label $f.showdomainlab -text "Domain Surface"
# scale $f.showdomain -orient horizontal -length 100 -from 0 -to 50 \
-resolution 1 - variable viewoptions.drawdomainsurf \
-command { Ng_SetVisParameters ; redraw } \
-label " D o m a i n S u r f a c e "
tixControl $f.showdomain - label " S h o w s u r f a c e o f d o m a i n " - integer true \
-variable viewoptions.drawdomainsurf - min 0 - max 50 \
-options { entry.width 2 } \
-command { Ng_SetVisParameters ; Ng_Vis_Set parameters; redraw }
frame $f.center - relief groove - borderwidth 3
pack $f.center - fill x
button $f.center.lab - text " S e t C e n t e r P o i n t " \
-command { Ng_SetVisParameters ; Ng_Center ; redraw }
entry $f.center.ent - width 5 - relief sunken \
-textvariable viewoptions.centerpoint
pack $f.center.ent $f.center.lab - side left - expand yes
frame $f.drawel - relief groove - borderwidth 3
pack $f.drawel - fill x
button $f.drawel.lab - text " D r a w E l e m e n t " \
-command { Ng_SetVisParameters ; Ng_ZoomAll ; redraw }
entry $f.drawel.ent - width 5 - relief sunken \
-textvariable viewoptions.drawelement
pack $f.drawel.ent $f.drawel.lab - side left - expand yes
pack $f.showfilledtrigs
pack $f.showoutline $f.subdiv $f.showedges $f.showbadels
# pack $f.showdomainlab
pack $f.showdomain
pack $f.showpointnumbers
pack $f.showedgenumbers $f.showfacenumbers $f.showelementnumbers
pack $f.showmetispartition
frame $f.frametets
checkbutton $f.frametets.showtets - text " S h o w T e t s i n d o m a i n " \
-variable viewoptions.drawtets \
-command { Ng_SetVisParameters ; redraw }
tixControl $f.frametets.showtetsdomain - label " " - integer true \
-variable viewoptions.drawtetsdomain - min 0 - max 500 \
-options { entry.width 2 } \
-command { Ng_SetVisParameters ; redraw }
pack $f.frametets
pack $f.frametets.showtets $f.frametets.showtetsdomain - side left
pack $f.showcolor $f.showpyramids $f.showprisms $f.showhexes $f.showidentified
pack $f.fshrink
pack $f.fshrink.lab $f.fshrink.scale - side left
# if {$userlevel == 3} {
# frame $f.framecurveproj
# checkbutton $f.framecurveproj.showcurveproj -text "Show curved edge projection " \
-variable viewoptions.drawcurveproj \
-command { Ng_SetVisParameters ; redraw }
# tixControl $f.framecurveproj.showcurveprojedge -label "" -integer true \
-variable viewoptions.drawcurveprojedge - min 1 - max 99999 \
-options { entry.width 5 } \
-command { Ng_SetVisParameters ; redraw }
# pack $f.framecurveproj
# pack $f.framecurveproj.showcurveproj $f.framecurveproj.showcurveprojedge -side left
# }
# light options
2016-02-08 19:53:16 +05:00
set f $w.nb.light
2014-01-27 02:23:30 +06:00
label $f.lab1 - text " A m b i e n t L i g h t "
scale $f.scale1 - orient horizontal - length 300 - from 0 - to 1 \
-resolution 0.01 - tickinterval 0.2 \
-command { Ng_SetVisParameters ; redraw } - variable viewoptions.light.amb
label $f.lab2 - text " D i f f u s e L i g h t "
scale $f.scale2 - orient horizontal - length 300 - from 0 - to 1 \
-resolution 0.01 - tickinterval 0.2 \
-command { Ng_SetVisParameters ; redraw } - variable viewoptions.light.diff
label $f.lab3 - text " S p e c u l a r L i g h t "
scale $f.scale3 - orient horizontal - length 300 - from 0 - to 1 \
-resolution 0.01 - tickinterval 0.2 \
-command { Ng_SetVisParameters ; redraw } - variable viewoptions.light.spec
label $f.lab4 - text " M a t e r i a l S h i n i n e s s "
scale $f.scale4 - orient horizontal - length 300 - from 0 - to 128 \
-resolution 1 - tickinterval 32 \
-command { Ng_SetVisParameters ; redraw } - variable viewoptions.mat.shininess
label $f.lab5 - text " M a t e r i a l T r a n s p a r e n c y "
scale $f.scale5 - orient horizontal - length 300 - from 0 - to 1 \
-resolution 0.01 - tickinterval 0.2 \
-command { Ng_SetVisParameters ; redraw } - variable viewoptions.mat.transp
pack $f.lab1 $f.scale1 $f.lab2 $f.scale2 $f.lab3 $f.scale3 $f.lab4 $f.scale4 $f.lab5 $f.scale5
# edges options
2016-02-08 19:53:16 +05:00
set f $w.nb.edges
2014-01-27 02:23:30 +06:00
checkbutton $f.showedges - text " S h o w E d g e s " \
-variable viewoptions.drawededges \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showpoints - text " S h o w P o i n t s " \
-variable viewoptions.drawedpoints \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showpointnrs - text " S h o w P o i n t s N r s " \
-variable viewoptions.drawedpointnrs \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.showtang - text " S h o w C P T a n g e n t s " \
-variable viewoptions.drawedtangents \
-command { Ng_SetVisParameters ; redraw }
checkbutton $f.drawedgenrs - text " S h o w E d g e N r s " \
-variable viewoptions.drawededgenrs \
-command { Ng_SetVisParameters ; redraw }
pack $f.showedges $f.showpoints $f.showpointnrs $f.showtang $f.drawedgenrs
frame $f.center - relief groove - borderwidth 3
pack $f.center - fill x
button $f.center.lab - text " S e t C e n t e r P o i n t " \
-command { Ng_SetVisParameters ; Ng_Center ; redraw }
entry $f.center.ent - width 5 - relief sunken \
-textvariable viewoptions.centerpoint
pack $f.center.ent $f.center.lab - side left - expand yes
frame $f.f1
pack $f.f1 - pady 5
label $f.f1.lab - text " S p e c P o i n t V e c l e n "
entry $f.f1.ent - width 5 - relief sunken - textvariable viewoptions.specpointvlen
pack $f.f1.lab $f.f1.ent
# misc options
2016-02-08 19:53:16 +05:00
set f $w.nb.misc
2014-01-27 02:23:30 +06:00
frame $f.point - relief groove - borderwidth 3
frame $f.point.dp
checkbutton $f.point.dp.drawpoint - text " D r a w P o i n t " \
-variable viewoptions.drawspecpoint \
-command { Ng_SetVisParameters ; redraw }
entry $f.point.dp.px - width 8 - relief sunken - textvariable viewoptions.specpointx
entry $f.point.dp.py - width 8 - relief sunken - textvariable viewoptions.specpointy
entry $f.point.dp.pz - width 8 - relief sunken - textvariable viewoptions.specpointz
pack $f.point.dp.drawpoint $f.point.dp.px $f.point.dp.py $f.point.dp.pz - side left
pack $f.point.dp
checkbutton $f.point.center - text " U s e a s C e n t e r " \
-variable viewoptions.usecentercoords \
-command {
if { $ { viewoptions.usecentercoords } } {
set viewoptions.centerx $ { viewoptions.specpointx }
set viewoptions.centery $ { viewoptions.specpointy }
set viewoptions.centerz $ { viewoptions.specpointz }
Ng_SetVisParameters ; Ng_Center
redraw
} {
Ng_SetVisParameters
}
}
pack $f.point.center
pack $f.point - fill x - ipady 3
2016-02-08 19:53:16 +05:00
ttk : : frame $w.bu
2014-01-27 02:23:30 +06:00
pack $w.bu - fill x - ipady 3
2016-02-08 19:53:16 +05:00
ttk : : button $w.bu.done - text " D o n e " - command {
2014-01-27 02:23:30 +06:00
Ng_SetVisParameters ;
redraw
destroy .viewopts_dlg
}
2016-02-08 19:53:16 +05:00
ttk : : button $w.bu.apply - text " A p p l y " - command {
2014-01-27 02:23:30 +06:00
Ng_SetVisParameters ;
redraw
}
pack $w.bu.apply $w.bu.done - expand yes - side left
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " V i e w i n g o p t i o n s "
focus $w
}
}
proc clipplanecommand { { optionalvar 0 } } {
Ng_SetVisParameters
after idle redraw
}
set clippingdialog_pop1 0
set clippingdialog_pop2 0
set clippingdialog_pop3 0
set clippingdialog_pop4 0
#
#
# clipping dialog
#
#
proc clippingdialog { } {
global clippingdialog_pop1
global clippingdialog_pop2
global clippingdialog_pop3
global clippingdialog_pop4
set clippingdialog_pop1 1
set clippingdialog_pop2 1
set clippingdialog_pop3 1
set clippingdialog_pop4 1
set w .clipping_dlg
if { [ winfo exists .clipping_dlg] == 1 } {
wm withdraw $w
wm deiconify $w
focus $w
} {
toplevel $w
label $w.lab1 - text " N o r m a l x "
scale $w.scale1 - orient horizontal - length 300 - from - 1 - to 1 \
-resolution 0.01 - tickinterval 0.5 \
-variable viewoptions.clipping.nx \
-command { clipplanecommand }
# -command { popupcheckredraw2 clippingdialog_pop1 ${viewoptions.clipping.enable} }
# Ng_SetVisParameters;
# if { ${viewoptions.clipping.enable} == 1 } { redraw };
# Ng_SetVisParameters
label $w.lab2 - text " N o r m a l y "
scale $w.scale2 - orient horizontal - length 300 - from - 1 - to 1 \
-resolution 0.01 - tickinterval 0.5 \
-variable viewoptions.clipping.ny \
-command { clipplanecommand }
# -command { popupcheckredraw2 clippingdialog_pop2 ${viewoptions.clipping.enable} }
label $w.lab3 - text " N o r m a l z "
scale $w.scale3 - orient horizontal - length 300 - from - 1 - to 1 \
-resolution 0.01 - tickinterval 0.5 \
-variable viewoptions.clipping.nz \
-command { clipplanecommand }
# -command { popupcheckredraw2 clippingdialog_pop3 ${viewoptions.clipping.enable} }
label $w.lab4 - text " D i s t a n c e "
scale $w.scale4 - orient horizontal - length 300 - from - 1 - to 1.001 \
-resolution 0.0001 - tickinterval 0.5 \
-variable viewoptions.clipping.dist \
-command { clipplanecommand }
# -command { popupcheckredraw2 clippingdialog_pop4 ${viewoptions.clipping.enable} }
label $w.lab5 - text " A d d i t i o n a l D i s t a n c e "
scale $w.scale5 - orient horizontal - length 300 - from - 1 - to 1.001 \
-resolution 0.0001 - tickinterval 0.5 \
-variable viewoptions.clipping.dist2 \
-command { clipplanecommand }
tixControl $w.clipdomain - label " C l i p o n l y d o m a i n " - integer true \
-variable viewoptions.clipping.onlydomain - min 0 - max 50 \
-options { entry.width 2 } \
-command { clipplanecommand ; }
# -command { Ng_SetVisParameters; redraw }
tixControl $w.donotclipdomain - label " D o n o t c l i p d o m a i n " - integer true \
-variable viewoptions.clipping.notdomain - min 0 - max 50 \
-options { entry.width 2 } \
-command { clipplanecommand ; }
# -command { Ng_SetVisParameters; redraw }
pack $w.lab1 $w.scale1 $w.lab2 $w.scale2 $w.lab3 $w.scale3 $w.lab4 $w.scale4 $w.lab5 $w.scale5 $w.clipdomain $w.donotclipdomain
checkbutton $w.cb1 - text " E n a b l e c l i p p i n g " \
-variable viewoptions.clipping.enable \
-command { Ng_SetVisParameters ; redraw }
pack $w.cb1
frame $w.bu
# pack $w.bu -fill x
pack $w.bu - fill x - ipady 3
button $w.bu.cancle - text " D o n e " - command " d e s t r o y $ w "
pack $w.bu.cancle - expand yes
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " C l i p p i n g P l a n e "
# grab $w
focus $w
# $w.scale1 configure -command { puts "call1b"; Ng_SetVisParameters; redraw }
# puts "after"
clipplanecommand
}
}
#
# refinement dialog
#
#
proc refinementdialog { } {
set w .refinement_dlg
if { [ winfo exists .refinement_dlg] == 1 } {
wm withdraw $w
wm deiconify $w
focus $w
} {
toplevel $w
tixControl $w.meshsize - label " m a x m e s h - s i z e : " - integer false \
-variable options.meshsize - min 1 e-6 - max 1 e6 \
-options {
entry.width 6
label.width 25
label.anchor e
}
pack $w.meshsize
global localh
set localh 1
tixControl $w.loch - label " l o c a l m e s h - s i z e : " - integer false \
-variable localh - min 1 e-6 - max 1 e6 \
-options {
entry.width 6
label.width 25
label.anchor e
}
pack $w.loch
button $w.restface - text " R e s t r i c t H a t f a c e " \
-command {
.refinement_dlg.meshsize invoke
.refinement_dlg.loch invoke
Ng_RestrictH face $localh
}
button $w.restedge - text " R e s t r i c t H a t e d g e " \
-command {
.refinement_dlg.meshsize invoke
.refinement_dlg.loch invoke
Ng_RestrictH edge $localh
}
button $w.restelement - text " R e s t r i c t H a t e l e m e n t " \
-command {
.refinement_dlg.meshsize invoke
.refinement_dlg.loch invoke
Ng_RestrictH element $localh
}
button $w.restpoint - text " R e s t r i c t H a t p o i n t " \
-command {
.refinement_dlg.meshsize invoke
.refinement_dlg.loch invoke
Ng_RestrictH point $localh
}
pack $w.restface $w.restedge $w.restelement $w.restpoint
button $w.anisoedge - text " D e c l a r e A n i s o t r o p i c e d g e " \
-command {
Ng_Anisotropy edge
}
pack $w.anisoedge
frame $w.bu
pack $w.bu - fill x - ipady 3
button $w.bu.cancle - text " D o n e " - command " d e s t r o y . r e f i n e m e n t _ d l g "
button $w.bu.refine - text " R e f i n e " \
-command {
# Ng_BisectCopyMesh;
set oldnp 0 ; set newnp $status_np ;
while { $oldnp < $newnp } {
set level [ expr $level + 1 ]
Ng_Bisect ;
Ng_HighOrder $ { options.elementorder }
Ng_ReadStatus ;
redraw ;
set oldnp $newnp
set newnp $status_np
puts " o l d n p $ o l d n p n e w n p $ n e w n p "
}
}
button $w.bu.zrefine - text " Z - R e f i n e " \
-command { Ng_ZRefinement ; Ng_ReadStatus ; redraw ; }
pack $w.bu.zrefine $w.bu.refine $w.bu.cancle - expand yes - side left
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " S e l e c t R e f i n e m e n t "
focus $w
}
}
#
# boundcondessing dialog
#
#
proc bcpropdialog { } {
set w .bcprop_dlg
if { [ winfo exists .bcprop_dlg] == 1 } {
wm withdraw $w
wm deiconify $w
} {
toplevel $w
frame $w.face - borderwidth 3
pack $w.face - fill x
label $w.face.lab - text " f a c e i n d e x : "
label $w.face.ent - text 1 - padx 4
button $w.face.next - text " n e x t " - command {
set w .bcprop_dlg;
set facenr [ $w.face.ent cget - text]
if { $facenr == [ Ng_BCProp getnfd] } {
set facenr 1
} {
set facenr [ expr $facenr + 1 ]
}
$w.face.ent configure - text $facenr
Ng_BCProp setactive $facenr
set bcnr [ Ng_BCProp getbc $facenr ]
$w.bc.ent delete 0 end
$w.bc.ent insert 0 $bcnr
redraw
}
button $w.face.prev - text " p r e v " - command {
set w .bcprop_dlg;
set facenr [ $w.face.ent cget - text]
if { $facenr == 1 } {
set facenr [ Ng_BCProp getnfd]
} {
set facenr [ expr $facenr - 1 ]
}
$w.face.ent configure - text $facenr
Ng_BCProp setactive $facenr
set bcnr [ Ng_BCProp getbc $facenr ]
$w.bc.ent delete 0 end
$w.bc.ent insert 0 $bcnr
redraw
}
pack $w.face.lab $w.face.ent $w.face.prev $w.face.next - side left
frame $w.bc - borderwidth 3
pack $w.bc - fill x
label $w.bc.lab - text " b c p r o p e r t y : "
entry $w.bc.ent - width 5 - relief sunken
button $w.bc.but - text " c h a n g e " - command {
set w .bcprop_dlg;
Ng_BCProp setbc [ $w.face.ent cget - text] [ $w.bc.ent get ] ;
}
button $w.bc.but2 - text " a l l " - command {
set w .bcprop_dlg;
Ng_BCProp setall [ $w.bc.ent get ] ;
}
pack $w.bc.lab $w.bc.ent $w.bc.but $w.bc.but2 - side left - expand yes
frame $w.bcname - borderwidth 3
pack $w.bcname - fill x
label $w.bcname.lab - text " b c n a m e : "
label $w.bcname.ent - text " - "
pack $w.bcname.lab $w.bcname.ent - side left - expand yes
frame $w.bu
pack $w.bu - fill x - ipady 3
button $w.bu.close - text " C l o s e " - command { destroy .bcprop_dlg }
pack $w.bu.close - expand yes - side left
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " B o u n d a r y C o n d i t i o n s "
}
focus $w
set facenr [ Ng_BCProp getactive]
$w.face.ent configure - text $facenr
set bcnr [ Ng_BCProp getbc $facenr ]
$w.bc.ent delete 0 end
$w.bc.ent insert 0 $bcnr
set bcname [ Ng_BCProp getbcname $facenr ]
$w.bcname.ent configure - text $bcname
}
#
# Philippose - 25/07/2010
# Display the face colours currently
# available in the mesh
#
proc currmeshcoloursdialog { } {
set w .currmeshcolours_dlg
if { [ winfo exists .currmeshcolours_dlg] == 1 } {
wm withdraw $w
wm deiconify $w
focus $w
} {
toplevel $w
global facecolslist
frame $w.facecols - borderwidth 3
listbox $w.facecols.list - yscroll " $ w . f a c e c o l s . s c r o l l s e t " - selectmode single - setgrid 1 - width 32 - height 12
scrollbar $w.facecols.scroll - command " $ w . f a c e c o l s . l i s t y v i e w "
pack $w.facecols.scroll - side right - fill y
pack $w.facecols.list - side left - expand yes - fill both
Ng_CurrentFaceColours getcolours facecolslist
set i 1
foreach el $facecolslist {
set hel [ format " % d : ( % . 4 f % . 4 f % . 4 f ) " $i [ lindex $el 0 ] [ lindex $el 1 ] [ lindex $el 2 ] ]
incr i
$w.facecols.list insert end $hel }
frame $w.bu1 - borderwidth 3
button $w.bu1.showonly - text " s h o w o n l y " - command {
Ng_CurrentFaceColours showonly [ .currmeshcolours_dlg.facecols.list curselection]
redraw
}
button $w.bu1.hideonly - text " h i d e o n l y " - command {
Ng_CurrentFaceColours hideonly [ .currmeshcolours_dlg.facecols.list curselection]
redraw
}
button $w.bu1.showalso - text " s h o w " - command {
Ng_CurrentFaceColours showalso [ .currmeshcolours_dlg.facecols.list curselection]
redraw
}
button $w.bu1.hidealso - text " h i d e " - command {
Ng_CurrentFaceColours hidealso [ .currmeshcolours_dlg.facecols.list curselection]
redraw
}
pack $w.bu1.showonly $w.bu1.hideonly $w.bu1.showalso $w.bu1.hidealso - expand yes - fill x - padx 2 - pady 2 - side left
frame $w.bu2
button $w.bu2.showall - text " s h o w a l l " - command {
Ng_CurrentFaceColours showall
redraw
}
button $w.bu2.hideall - text " h i d e a l l " - command {
Ng_CurrentFaceColours hideall
redraw
}
pack $w.bu2.showall $w.bu2.hideall - expand yes - fill x - padx 2 - pady 2 - side left
frame $w.bu3
button $w.bu3.close - text " c l o s e " - command {
destroy .currmeshcolours_dlg
}
pack $w.bu3.close - expand yes - fill x - pady 3 - side right
pack $w.facecols - side top - expand yes - fill x - fill y
pack $w.bu3 - side bottom
pack $w.bu2 - side bottom
pack $w.bu1 - expand yes - fill x - side left
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " I n s p e c t M e s h C o l o u r s "
focus $w
}
}
#
# Philippose - 30/01/2009
# Local Surface Mesh Size Selection
# (Currently only supports OCC Geometry)
#
#
proc surfacemeshsizedialog { } {
set w .surfacemeshsize_dlg
if { [ winfo exists .surfacemeshsize_dlg] == 1 } {
wm withdraw $w
wm deiconify $w
} {
toplevel $w
frame $w.face - borderwidth 3
pack $w.face - fill x - padx 5
label $w.face.lab - text " f a c e i n d e x : "
label $w.face.ent - text 1 - padx 4
button $w.face.next - text " n e x t " - command {
set w .surfacemeshsize_dlg;
set facenr [ $w.face.ent cget - text]
if { $facenr == [ Ng_SurfaceMeshSize getnfd] } {
set facenr 1
} {
set facenr [ expr $facenr + 1 ]
}
$w.face.ent configure - text $facenr
Ng_SurfaceMeshSize setactive $facenr
set surfms [ Ng_SurfaceMeshSize getsurfms $facenr ]
$w.sms.ent delete 0 end
$w.sms.ent insert 0 $surfms
redraw
}
button $w.face.prev - text " p r e v " - command {
set w .surfacemeshsize_dlg;
set facenr [ $w.face.ent cget - text]
if { $facenr == 1 } {
set facenr [ Ng_SurfaceMeshSize getnfd]
} {
set facenr [ expr $facenr - 1 ]
}
$w.face.ent configure - text $facenr
Ng_SurfaceMeshSize setactive $facenr
set surfms [ Ng_SurfaceMeshSize getsurfms $facenr ]
$w.sms.ent delete 0 end
$w.sms.ent insert 0 $surfms
redraw
}
pack $w.face.lab $w.face.ent $w.face.prev $w.face.next - side left
frame $w.sms - borderwidth 3
pack $w.sms - fill x
label $w.sms.lab - text " m a x m e s h s i z e : "
entry $w.sms.ent - width 8 - relief sunken
button $w.sms.but - text " c h a n g e " - command {
set w .surfacemeshsize_dlg;
Ng_SurfaceMeshSize setsurfms [ $w.face.ent cget - text] [ $w.sms.ent get ] ;
}
button $w.sms.but2 - text " a l l " - command {
set w .surfacemeshsize_dlg;
Ng_SurfaceMeshSize setall [ $w.sms.ent get ] ;
}
pack $w.sms.lab $w.sms.ent $w.sms.but $w.sms.but2 - side left - padx 5 - expand yes
frame $w.bu
pack $w.bu - fill x - ipady 3
button $w.bu.close - text " C l o s e " - command { destroy .surfacemeshsize_dlg }
pack $w.bu.close - expand yes - side left
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " E d i t S u r f a c e M e s h S i z e "
}
focus $w
set facenr [ Ng_SurfaceMeshSize getactive]
$w.face.ent configure - text $facenr
set surfms [ Ng_SurfaceMeshSize getsurfms $facenr ]
$w.sms.ent delete 0 end
$w.sms.ent insert 0 $surfms
}
#
# METIS dialog
#
#
proc METISdialog { } {
set w .metis_dlg
set w.parts 64
if { [ winfo exists .metis_dlg] == 1 } {
wm withdraw $w
wm deiconify $w
} {
toplevel $w
frame $w.a - borderwidth 0
frame $w.b - borderwidth 0
pack $w.a $w.b
label $w.a.lab - text " N u m b e r o f p a r t i t i o n s : "
entry $w.a.ent - textvariable w.parts - width 4 - relief sunken
button $w.b.start - text " S t a r t M E T I S " - command {
Ng_Metis $ { w.parts }
redraw
}
button $w.b.cancel - text " C a n c e l " - command { destroy .metis_dlg }
pack $w.a.lab $w.a.ent - side left - expand yes
pack $w.b.start $w.b.cancel - side left
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " M E T I S P a r t i t i o n i n g "
focus $w
}
}
#
# STL dialog
#
proc stloptionsdialog { } {
set w .stlopts_dlg
if { [ winfo exists .stlopts_dlg] == 1 } {
wm withdraw $w
wm deiconify $w
focus $w
} {
toplevel $w
2016-02-08 19:53:16 +05:00
pack [ ttk : : notebook $w.nb ] - fill both - fill both - side top
# tixNoteBook $w.nb -ipadx 6 -ipady 6
2014-01-27 02:23:30 +06:00
# $w config -bg gray
# $w.nb subwidget nbframe config -backpagecolor gray
# Create the two tabs on the notebook. The -underline option
# puts a underline on the first character of the labels of the tabs.
# Keyboard accelerators will be defined automatically according
# to the underlined character.
#
# $w.nb add chartopt -label "Chart Options" -underline 0
# #$w.nb add meshsize -label "Mesh Size" -underline 0
# pack $w.nb -expand yes -fill both -padx 5 -pady 5 -side top
# set f [$w.nb subwidget chartopt]
# label $f.lab1 -text "Yellow Edges Angle ()"
# scale $f.scale1 -orient horizontal -length 300 \
# -from 0 -to 90 -resolution 1 -tickinterval 10 \
# -variable stloptions.yangle
# pack $f.lab1 $f.scale1
# label $f.lab2e -text "Edge Corner Angle ()"
# scale $f.scale2e -orient horizontal -length 360 -from 0 -to 180 \
# -resolution 1 -tickinterval 20 \
# -variable stloptions.edgecornerangle
# pack $f.lab2e $f.scale2e
# label $f.lab2 -text "Chart Angle ()"
# scale $f.scale2 -orient horizontal -length 360 -from 0 -to 180 \
# -resolution 1 -tickinterval 20 \
# -variable stloptions.chartangle
# pack $f.lab2 $f.scale2
# label $f.lab2b -text "Outer Chart Angle ()"
# scale $f.scale2b -orient horizontal -length 360 -from 0 -to 180 \
# -resolution 1 -tickinterval 20 \
# -variable stloptions.outerchartangle
# pack $f.lab2b $f.scale2b
# frame $f.r4
# pack $f.r4 -anchor w
# scale $f.r4.sc -orient horizontal -length 200 -from 0.1 -to 10 \
# -resolution 0.1 -variable stloptions.resthatlasfac
# checkbutton $f.r4.bu -text "Restrict h for Calc Atlas (Faster)" \
# -variable stloptions.resthatlasenable
# pack $f.r4.sc $f.r4.bu -side left
# set f [$w.nb subwidget meshsize]
# checkbutton $w.seat -text "Use Searchtrees" \
# -variable stloptions.usesearchtree
# pack $w.seat
frame $w.bu
# pack $w.bu
pack $w.bu - fill x - ipady 3
# -fill x
button $w.bu.apply - text " A p p l y " - command { redraw ; Ng_GenerateMesh 1 2 }
button $w.bu.cancle - text " D o n e " - command { destroy .stlopts_dlg }
pack $w.bu.cancle $w.bu.apply - side left - expand yes
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " S T L O p t i o n s "
# grab $w
focus $w
}
}
proc stldoctordialog { } {
set wd .stldoctor_dlg
if { [ winfo exists .stldoctor_dlg] == 1 } {
wm withdraw $wd
wm deiconify $wd
focus $wd
} {
toplevel $wd
2016-02-08 19:53:16 +05:00
pack [ ttk : : notebook $wd.nb ] - fill both - fill both - side top
$wd.nb add [ ttk : : frame $wd.nb.general ] - text " G e n e r a l " - underline 0
$wd.nb add [ ttk : : frame $wd.nb.topology ] - text " E d i t T o p o l o g y " - underline 5
$wd.nb add [ ttk : : frame $wd.nb.edges ] - text " E d i t E d g e s " - underline 5
$wd.nb add [ ttk : : frame $wd.nb.normals ] - text " E d i t N o r m a l s " - underline 5
$wd.nb add [ ttk : : frame $wd.nb.advanced ] - text " A d v a n c e d " - underline 0
# tixNoteBook $wd.nb -ipadx 6 -ipady 6
# $wd.nb add general -label "General" -underline 0
# $wd.nb add topology -label "Edit Topology" -underline 5
# $wd.nb add edges -label "Edit Edges" -underline 5
# $wd.nb add normals -label "Edit Normals" -underline 5
# $wd.nb add advanced -label "Advanced" -underline 0
# pack $wd.nb -expand yes -fill both -padx 5 -pady 5 -side top
2014-01-27 02:23:30 +06:00
# GENERAL *****************************
2016-02-08 19:53:16 +05:00
set f $wd.nb.general
2014-01-27 02:23:30 +06:00
frame $f.show
pack $f.show - fill x
checkbutton $f.show.showtrias - text " S h o w S T L - T r i a n g l e s " \
-variable stloptions.showtrias - command { Ng_SetVisParameters ; redraw }
pack $f.show.showtrias - anchor w
checkbutton $f.show.showfilledtrias - text " S h o w F i l l e d T r i a n g l e s " \
-variable stloptions.showfilledtrias - command { Ng_SetVisParameters ; redraw }
pack $f.show.showfilledtrias - anchor w
set selmodevals { 0 1 2 3 4 }
set selmodelabs( 0 ) " t r i a n g l e "
set selmodelabs( 1 ) " e d g e "
set selmodelabs( 2 ) " p o i n t "
set selmodelabs( 3 ) " l i n e "
set selmodelabs( 4 ) " l i n e c l u s t e r "
tixOptionMenu $f.selmode - label " D o u b l e C l i c k s e l e c t s : " \
-options {
label.width 19
label.anchor e
menubutton.width 15
}
foreach selmodev $selmodevals {
$f.selmode add command $selmodev - label $selmodelabs ( $selmodev )
}
$f.selmode config - variable stldoctor.selectmode
$f.selmode config - command { Ng_STLDoctor }
global stldoctor.selectmode
pack $f.selmode
frame $f.sm
pack $f.sm - fill x
checkbutton $f.sm.bu - text " s e l e c t w i t h m o u s e " \
-variable stldoctor.selectwithmouse
pack $f.sm.bu
frame $f.st - relief groove - borderwidth 3
pack $f.st - fill x
label $f.st.lab - text " S e l e c t t r i a n g l e b y n u m b e r " ;
entry $f.st.ent - width 5 - relief sunken \
-textvariable stldoctor.selecttrig
pack $f.st.ent $f.st.lab - side left - expand yes
frame $f.vc - relief groove - borderwidth 3
pack $f.vc - fill x
checkbutton $f.vc.bu - text " s h o w v i c i n i t y " \
-variable stldoctor.showvicinity \
-command { Ng_STLDoctor vicinity; redraw }
label $f.vc.lab - text " v i c i n i t y s i z e " ;
scale $f.vc.sc - orient horizontal - length 200 - from 0 - to 200 \
-resolution 1 - variable stldoctor.vicinity \
-command { Ng_STLDoctor vicinity; redraw }
pack $f.vc.bu $f.vc.lab $f.vc.sc - expand yes
frame $f.ge - relief groove - borderwidth 3
pack $f.ge - fill x
button $f.ge.neighbourangles - text " c a l c n e i g h b o u r a n g l e s " - command { Ng_STLDoctor neighbourangles}
button $f.ge.showcoords - text " s h o w c o o r d s o f t o u c h e d t r i a n g l e " - command { Ng_STLDoctor showcoords}
button $f.ge.moveptm - text " m o v e p o i n t t o m i d d l e o f t r i a n g l e p o i n t s " - command { Ng_STLDoctor movepointtomiddle; redraw }
button $f.ge.destroy0trigs - text " d e s t r o y 0 - v o l u m e t r i a n g l e s " - command { Ng_STLDoctor destroy0trigs}
pack $f.ge.neighbourangles $f.ge.showcoords $f.ge.moveptm $f.ge.destroy0trigs - expand yes
button $f.ge.cancle - text " D o n e " - command { destroy .stldoctor_dlg }
pack $f.ge.cancle - expand yes
# TOPOLOGY ********************
2016-02-08 19:53:16 +05:00
set f $wd.nb.topology
2014-01-27 02:23:30 +06:00
frame $f.oc - relief groove - borderwidth 3
pack $f.oc - fill x
button $f.oc.bu - text " i n v e r t o r i e n t a t i o n o f s e l e c t e d t r i g " - command { Ng_STLDoctor invertselectedtrig; redraw }
button $f.oc.bu2 - text " o r i e n t a f t e r s e l e c t e d t r i g " - command { Ng_STLDoctor orientafterselectedtrig; redraw }
pack $f.oc.bu $f.oc.bu2 - side left - expand yes
button $f.toperr - text " m a r k i n c o n s i s t e n t t r i a n g l e s " - command { Ng_STLDoctor marktoperrortrigs; redraw }
button $f.deltrig - text " d e l e t e s e l e c t e d t r i a n g l e " - command { Ng_STLDoctor deleteselectedtrig; redraw }
button $f.geosmooth - text " g e o m e t r i c s m o o t h i n g " - command { Ng_STLDoctor smoothgeometry; redraw }
pack $f.toperr $f.deltrig $f.geosmooth
# EDGES ***********************
2016-02-08 19:53:16 +05:00
set f $wd.nb.edges
2014-01-27 02:23:30 +06:00
frame $f.be - relief groove - borderwidth 3
pack $f.be - fill x
label $f.be.lab - text " b u i l d e d g e s w i t h y e l l o w a n g l e : " ;
scale $f.be.sc - orient horizontal - length 200 - from 0 - to 100 \
-resolution 0.5
$f.be.sc config - variable stloptions.yangle
$f.be.sc config - command { Ng_SetSTLParameters ; Ng_STLDoctor buildedges; redraw }
label $f.be.lab2 - text " c o n t i n u e e d g e s w i t h y e l l o w a n g l e : " ;
scale $f.be.sc2 - orient horizontal - length 200 - from 0 - to 100 \
-resolution 0.5
$f.be.sc2 config - variable stloptions.contyangle
$f.be.sc2 config - command { Ng_SetSTLParameters ; Ng_STLDoctor buildedges; redraw }
button $f.be.buildedges - text " B u i l d E d g e s " - command { Ng_STLDoctor buildedges; redraw }
pack $f.be.lab $f.be.sc $f.be.lab2 $f.be.sc2 $f.be.buildedges - expand yes
frame $f.se
pack $f.se - fill x
checkbutton $f.se.bu - text " s h o w e x c l u d e d " \
-variable stldoctor.showexcluded \
-command { Ng_STLDoctor ; redraw }
pack $f.se.bu
# edgeselectmode ******
set edgeselmodevals { 0 1 2 3 4 }
set edgeselmodelabs( 0 ) " n o c h a n g e "
set edgeselmodelabs( 1 ) " u n d e f i n e d "
set edgeselmodelabs( 2 ) " c o n f i r m e d "
set edgeselmodelabs( 3 ) " c a n d i d a t e "
set edgeselmodelabs( 4 ) " e x c l u d e d "
tixOptionMenu $f.edgeselmode - label " D o u b l e C l i c k s e t s e d g e : " \
-options {
label.width 19
label.anchor e
menubutton.width 15
}
foreach edgeselmodev $edgeselmodevals {
$f.edgeselmode add command $edgeselmodev - label $edgeselmodelabs ( $edgeselmodev )
}
$f.edgeselmode config - variable stldoctor.edgeselectmode
$f.edgeselmode config - command { Ng_STLDoctor }
global stldoctor.edgeselectmode
pack $f.edgeselmode
# edge buttons
frame $f.edg - relief groove - borderwidth 3
pack $f.edg - fill x
# checkbutton $f.edg.bu -text "use external edges" \
# -variable stldoctor.useexternaledges \
# -command {Ng_STLDoctor; redraw}
# pack $f.edg.bu -expand yes
frame $f.edg.f0
pack $f.edg.f0
button $f.edg.f0.confirmedge - text " c o n f i r m " - command { Ng_STLDoctor confirmedge; redraw }
button $f.edg.f0.candidateedge - text " c a n d i d a t e " - command { Ng_STLDoctor candidateedge; redraw }
button $f.edg.f0.excludeedge - text " e x c l u d e " - command { Ng_STLDoctor excludeedge; redraw }
button $f.edg.f0.undefinededge - text " u n d e f i n e d " - command { Ng_STLDoctor undefinededge; redraw }
pack $f.edg.f0.confirmedge $f.edg.f0.candidateedge $f.edg.f0.excludeedge $f.edg.f0.undefinededge - side left
frame $f.edg.fa
pack $f.edg.fa
button $f.edg.fa.setallundefined - text " a l l u n d e f i n e d " - command { Ng_STLDoctor setallundefinededges; redraw }
button $f.edg.fa.erasecandidates - text " c a n d i d a t e s t o u n d e f i n e d " - command { Ng_STLDoctor erasecandidateedges; redraw }
pack $f.edg.fa.setallundefined $f.edg.fa.erasecandidates - side left
frame $f.edg.fb
pack $f.edg.fb
button $f.edg.fb.confirmcandidates - text " c a n d i d a t e s t o c o n f i r m e d " - command { Ng_STLDoctor confirmcandidateedges; redraw }
button $f.edg.fb.confirmedtocandidates - text " c o n f i r m e d t o c a n d i d a t e s " - command { Ng_STLDoctor confirmedtocandidateedges; redraw }
pack $f.edg.fb.confirmcandidates $f.edg.fb.confirmedtocandidates - side left
frame $f.edg.f1
frame $f.edg.f2
frame $f.edg.f3
frame $f.edg.f4
pack $f.edg.f1 $f.edg.f2 $f.edg.f3 $f.edg.f4
button $f.edg.f1.exportedges - text " e x p o r t e d g e s " - command { Ng_STLDoctor exportedges}
button $f.edg.f1.importedges - text " i m p o r t e d g e s " - command { Ng_STLDoctor importedges; redraw }
button $f.edg.f1.saveedgedata - text " s a v e e d g e d a t a " \
-command {
set types {
{ " N e t g e n E d g e d a t a " { .ned } }
}
set file [ tk_getSaveFile - filetypes $types - defaultextension " . n e d " ]
if { $file != " " } {
Ng_STLDoctor saveedgedata $file
}
}
button $f.edg.f1.loadedgedata - text " l o a d e d g e d a t a " \
-command {
set types {
{ " N e t g e n E d g e d a t a " { .ned } }
}
set file [ tk_getOpenFile - filetypes $types - defaultextension " . n e d " ]
if { $file != " " } {
Ng_STLDoctor loadedgedata $file
puts " l o a d i n g d o n e "
redraw
# wm title . [concat "NETGEN - " $file]
}
}
button $f.edg.f1.importAVLedges - text " i m p o r t A V L e d g e s " \
-command {
set types { { " E d g e f i l e " { .edg } } }
set file [ tk_getOpenFile - filetypes $types - defaultextension " . e d g " ]
if { $file != " " } {
Ng_STLDoctor importexternaledges $file ;
}
}
pack $f.edg.f1.importAVLedges $f.edg.f1.loadedgedata $f.edg.f1.saveedgedata - side left
# button $f.edg.f1.buildedges -text "build external edges" -command {Ng_STLDoctor buildexternaledges; redraw}
frame $f.edg2 - relief groove - borderwidth 3
pack $f.edg2 - fill x
# button $f.edg2.addlonglines -text "make long lines candidates (% of diam)" -command {Ng_STLDoctor addlonglines; redraw}
label $f.edg2.lab - text " l e n g t h ( % ) : "
scale $f.edg2.sc - orient horizontal - length 200 - from 0 - to 100 \
-resolution 0.5 \
-variable stldoctor.longlinefact
# button $f.edg2.deletedirtyedges -text "make dirty edges candidates" -command {Ng_STLDoctor deletedirtyedges; redraw}
button $f.edg2.undoedge - text " u n d o l a s t e d g e c h a n g e " - command { Ng_STLDoctor undoedgechange; redraw }
# pack $f.edg2.addlonglines $f.edg2.deletedirtyedges -expand yes
# pack $f.edg2.lab $f.edg2.sc -side left
pack $f.edg2.undoedge - expand yes
# NORMALS ***********************
2016-02-08 19:53:16 +05:00
set f $wd.nb.normals
2014-01-27 02:23:30 +06:00
frame $f.dt - relief groove - borderwidth 3
pack $f.dt - fill x
label $f.dt.lab - text " d i r t y t r i a n g l e f a c t o r " ;
entry $f.dt.ent - width 5 - relief sunken \
-textvariable stldoctor.dirtytrigfact
pack $f.dt.ent $f.dt.lab - side left - expand yes
frame $f.srt - relief groove - borderwidth 3
pack $f.srt - fill x
button $f.srt.bu - text " s m o o t h r e v e r t e d t r i a n g l e s g e o m e t r i c " - command { Ng_STLDoctor smoothrevertedtrigs; redraw }
entry $f.srt.ent - width 5 - relief sunken \
-textvariable stldoctor.smoothangle
pack $f.srt.ent $f.srt.bu - side left - expand yes
frame $f.bdt - relief groove - borderwidth 3
pack $f.bdt - fill x
button $f.bdt.bu - text " m a r k d i r t y t r i a n g l e s " - command { Ng_STLDoctor markdirtytrigs; redraw }
button $f.bdt.bu2 - text " s m o o t h d i r t y t r i a n g l e s n o r m a l " - command { Ng_STLDoctor smoothdirtytrigs; redraw }
pack $f.bdt.bu $f.bdt.bu2 - side left - expand yes
frame $f.sno - relief groove - borderwidth 3
pack $f.sno
label $f.sno.labrough - text " r o u g h "
scale $f.sno.scsmooth - orient horizontal - length 100 - from 0 - to 0.8 \
-resolution 0.01 - variable stldoctor.smoothnormalsweight \
-command { Ng_SetSTLParameters }
label $f.sno.labsmooth - text " s m o o t h "
button $f.sno.smoothnormals - text " s m o o t h n o r m a l s " - command { Ng_STLDoctor smoothnormals; redraw }
pack $f.sno.labrough $f.sno.scsmooth $f.sno.labsmooth $f.sno.smoothnormals - side left - padx 5
frame $f.no - relief groove - borderwidth 3
pack $f.no - fill x
button $f.no.marknonsmoothnormals - text " m a r k n o n - s m o o t h t r i a n g l e s " - command { Ng_STLDoctor marknonsmoothnormals; redraw }
button $f.no.calcnormals - text " c a l c u l a t e n o r m a l s f r o m g e o m e t r y " - command { Ng_STLDoctor calcnormals; redraw }
pack $f.no.marknonsmoothnormals $f.no.calcnormals - expand yes
# ADVANCED **************************
2016-02-08 19:53:16 +05:00
set f $wd.nb.advanced
2014-01-27 02:23:30 +06:00
frame $f.sc
pack $f.sc - fill x
checkbutton $f.sc.bu - text " s p i r a l c h e c k " \
-variable stldoctor.spiralcheck \
-command { Ng_STLDoctor ; }
checkbutton $f.sc.bu2 - text " c o n e c h e c k " \
-variable stldoctor.conecheck \
-command { Ng_STLDoctor ; }
pack $f.sc.bu $f.sc.bu2
tixControl $f.gtol - label " l o a d - g e o m e t r y t o l e r a n c e f a c t o r " - integer false \
-variable stldoctor.geom_tol_fact \
-options {
entry.width 8
label.width 30
label.anchor e
}
pack $f.gtol
button $f.adap - text " A p p l y " - command {
2016-02-08 19:53:16 +05:00
.stldoctor_dlg.nb.advanced.gtol invoke
2014-01-27 02:23:30 +06:00
Ng_STLDoctor ;
}
pack $f.adap - expand yes
# frame $f.gtol -relief groove -borderwidth 3
# pack $f.gtol -fill x
# label $f.gtol.lab -text "Geometry-Load-Tolerance-Factor";
# entry $f.gtol.ent -width 5 -relief sunken \
# -textvariable stldoctor.geom_tol_fact
# pack $f.gtol.lab $f.gtol.ent -side left -expand yes
# *******************************
wm withdraw $wd
wm geom $wd + 100 + 100
wm deiconify $wd
wm title $wd " S T L D o c t o r "
focus $wd
}
}
proc meshdoctordialog { } {
set w .meshdoc_dlg
global meshdoctor.active
if { [ winfo exists .meshdoc_dlg] == 1 } {
wm withdraw $w
wm deiconify $w
focus $w
} {
toplevel $w
set meshdoctor.active 1
Ng_MeshDoctor ;
frame $w.vis - relief groove - borderwidth 3
pack $w.vis
checkbutton $w.vis.showfilledtrigs - text " S h o w f i l l e d t r i a n g l e s " \
-variable viewoptions.drawfilledtrigs \
-command { Ng_SetVisParameters ; redraw }
checkbutton $w.vis.showedges - text " S h o w e d g e s " \
-variable viewoptions.drawedges \
-command { Ng_SetVisParameters ; redraw }
checkbutton $w.vis.showoutline - text " S h o w T r i a n g l e O u t l i n e " \
-variable viewoptions.drawoutline \
-command { Ng_SetVisParameters ; redraw }
pack $w.vis.showfilledtrigs $w.vis.showoutline $w.vis.showedges
tixControl $w.markedgedist - label " M a r k e d g e d i s t : " - integer true \
-min 0 - max 999 \
-variable meshdoc.markedgedist \
-options {
entry.width 3
label.width 20
label.anchor e
} \
-command {
Ng_MeshDoctor markedgedist $ { meshdoc.markedgedist }
redraw
}
pack $w.markedgedist
button $w.deledge - text " D e l e t e m a r k e d s e g m e n t s " - command {
Ng_MeshDoctor deletemarkedsegments
redraw
}
pack $w.deledge
button $w.close - text " C l o s e " - command {
set meshdoctor.active 0 ;
Ng_MeshDoctor ;
destroy .meshdoc_dlg
}
pack $w.close - expand yes
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " M e s h D o c t o r "
}
}
#
# Quality viewer
#
proc qualityviewdialog { show } {
set w .qualityview_dlg
if { [ winfo exists .qualityview_dlg] == 1 } {
if { $show == 1 } {
wm withdraw .qualityview_dlg
wm deiconify $w
focus $w
} {
wm withdraw $w
}
} {
toplevel $w
set c $w.c
canvas $c - relief raised - width 450 - height 300
pack $w.c - side top - fill x
set plotFont { Helvetica 12 }
set smallFont { Helvetica 12 }
$c create line 100 250 400 250 - width 2
$c create line 100 250 100 50 - width 2
for { set i 0 } { $i <= 10 } { incr i} {
set x [ expr { 100 + ( $i * 30 ) } ]
$c create line $x 250 $x 245 - width 2
if { [ expr { $i % 2 } ] == 0 } {
$c create text $x 254 - text [ format % 1.1 f [ expr 0.1 * $i ] ] - anchor n - font $plotFont
}
}
global qualbar
global qualbarnull
global qualbaraxis
for { set i 0 } { $i <= 5 } { incr i} {
set y [ expr { 250 - ( $i * 40 ) } ]
$c create line 100 $y 105 $y - width 2
# global qualbaraxis($i)
set qualbaraxis( $i ) \
[ $c create text 96 $y - text [ expr $i * 50 ] .0 - anchor e - font $plotFont ]
}
for { set i 0 } { $i < 20 } { incr i} {
set x1 [ expr { 100 + ( $i * 15 ) + 2 } ]
set x2 [ expr { $x1 + 10 } ]
set y [ expr { 250 - 10 * $i } ]
# global qualbar($i)
set qualbar( $i ) [ $c create rectangle $x1 250 $x2 245 - fill blue]
set qualbarnull( $i ) [ $c create text [ expr { ( $x1 + $x2 ) / 2 } ] 245 - text 0 - anchor s - font $smallFont - fill blue]
}
frame $w.bu
pack $w.bu
# -fill x
button $w.close - text " C l o s e " \
-command {
wm withdraw .qualityview_dlg
set viewqualityplot 0
}
pack $w.close
if { $show == 1 } {
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " M e s h Q u a l i t y "
focus $w
}
}
}
#
# Quality viewer
#
proc memusedialog { show } {
set w .memuse_dlg
if { [ winfo exists .memuse_dlg] == 1 } {
if { $show == 1 } {
wm withdraw .memuse_dlg
wm deiconify $w
focus $w
} {
wm withdraw $w
}
} {
toplevel $w
set c $w.c
canvas $c - relief raised - width 600 - height 300
pack $w.c - side top - fill x
set plotFont { Helvetica 18 }
set smallFont { Helvetica 12 }
global memmark
for { set i 0 } { $i < 512 } { incr i } {
set memmark( $i ) [ $c create line [ expr 50 + $i ] 50 [ expr 50 + $i ] 70 - fill blue]
}
set plotFont { Helvetica 18 }
set smallFont { Helvetica 12 }
$c create text 50 90 - text " 0 G B " - anchor n - font $plotFont
$c create text 178 90 - text " 1 G B " - anchor n - font $plotFont
$c create text 306 90 - text " 2 G B " - anchor n - font $plotFont
$c create text 434 90 - text " 3 G B " - anchor n - font $plotFont
$c create text 562 90 - text " 4 G B " - anchor n - font $plotFont
frame $w.bu
pack $w.bu
# -fill x
button $w.close - text " C l o s e " \
-command {
wm withdraw .memuse_dlg
set memuseplot 0
}
pack $w.close
if { $show == 1 } {
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " M e m o r y U s a g e "
focus $w
}
}
}
#
# STL INFO dialog
#
proc STLinfodialog { show } {
set w .STLinfo_dlg
if { [ winfo exists .STLinfo_dlg] == 1 } {
if { $show == 1 } {
wm withdraw .STLinfo_dlg
wm deiconify $w
focus $w
} {
wm withdraw $w
}
} {
toplevel $w
set c $w.c
canvas $c - relief raised - width 450 - height 300
pack $w.c - side top - fill x
set plotFont { Helvetica 18 }
set smallFont { Helvetica 12 }
$c create line 100 250 400 250 - width 2
$c create line 100 250 100 50 - width 2
frame $w.bu
pack $w.bu
# -fill x
button $w.close - text " C l o s e " \
-command {
wm withdraw .STLinfo_dlg
# set STLinfoopen 0
}
pack $w.close
if { $show == 1 } {
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " S T L G e o m e t r y I n f o "
focus $w
}
}
}
proc logwindow { } {
set w .logwindow
if { [ winfo exists .logwindow] == 1 } {
wm withdraw $w
wm deiconify $w
focus $w
} {
toplevel $w
text $w.edit - yscroll " $ w . s c r o l l y s e t " - setgrid 1 - height 12
scrollbar $w.scrolly - command " $ w . e d i t y v i e w "
pack $w.edit - side left - fill both - expand 1
pack $w.scrolly - side left - fill both - expand 0
.logwindow.edit insert end " N e t g e n L o g W i n d o w \n "
wm withdraw $w
wm geom $w + 100 + 100
wm deiconify $w
wm title $w " N e t g e n L o g "
focus $w
}
}
# logwindow
# Opens a window with a table. tablevar is a list, the first entry is the title, the second the number of rows, the third the number of columns,
# then the entries follow.
proc printtable { tablevar } {
set w newtcltable
while { [ winfo exists .$w ] == 1 } { set w 1 $w }
set w .$w
toplevel $w
for { set i 0 } { $i < [ lindex $tablevar 2 ] } { incr i } {
frame $w.col $i
for { set j 0 } { $j < [ lindex $tablevar 1 ] } { incr j } {
frame $w.col $i.row $j
message $w.col $i.row $j.txt - aspect 10000000 - text [ lindex $tablevar [ expr 3 + [ lindex $tablevar 2 ] * $j + $i ] ]
pack $w.col $i.row $j.txt
pack $w.col $i.row $j - side top
}
pack $w.col $i - side left
}
wm withdraw $w
wm geom $w + 200 + 100 ; wm deiconify $w
wm title $w [ lindex $tablevar 0 ]
focus $w
}
set latestwarning 0
proc printwarning { textvar } {
global latestwarning
set latestwarning $textvar
set w warning
while { [ winfo exists .$w ] == 1 } { set w 1 $w }
set w .$w
toplevel $w
message $w.mes - aspect 2000 - text " W A R N I N G : \n $ t e x t v a r "
button $w.done - text " D o n e " - command " d e s t r o y $ w "
pack $w.mes
pack $w.done
wm withdraw $w
wm deiconify $w
wm title $w " W a r n i n g "
focus $w
}
proc printlatestwarning { } {
global latestwarning
if { $latestwarning != 0 } { printwarning $latestwarning }
}
proc runtestdialog { } {
source $::ngdir / ngshell.tcl
set w .runtest_dlg
if { [ winfo exists .runtest_dlg] == 1 } {
wm withdraw $w
wm deiconify $w
focus $w
} {
toplevel $w
# in2d testing #
frame $w.in2dframe
pack $w.in2dframe
set in2dlogfile " "
tixLabelEntry $w.in2dframe.ent - label " i n 2 d l o g - f i l e : c o n s o l e i f e m p t y " \
-labelside top \
-options {
entry.textVariable in2dlogfile
entry.width 35
label.width 25
label.anchor w
}
button $w.in2dframe.btn - text " B r o w s e " - command {
set types { { " L o g f i l e " { .log } } }
set in2dlogfile [ tk_getOpenFile - filetypes $types - initialfile $in2dlogfile ]
}
button $w.in2dframe.test - text " T e s t i n 2 d m e s h i n g " - command { ngtest in2d $in2dlogfile }
pack $w.in2dframe.test - side left - anchor s - padx 4 - pady 4
pack $w.in2dframe.ent - side left - expand yes - fill x - anchor s - padx 4 - pady 4
pack $w.in2dframe.btn - side left - anchor s - padx 4 - pady 4
# geo testing #
frame $w.geoframe
pack $w.geoframe
set geologfile " "
tixLabelEntry $w.geoframe.ent - label " g e o l o g - f i l e : c o n s o l e i f e m p t y " \
-labelside top \
-options {
entry.textVariable geologfile
entry.width 35
label.width 25
label.anchor w
}
button $w.geoframe.btn - text " B r o w s e " - command {
set types { { " L o g f i l e " { .log } } }
set geologfile [ tk_getOpenFile - filetypes $types - initialfile $geologfile ]
}
button $w.geoframe.test - text " T e s t g e o m e s h i n g " - command { ngtest geo $geologfile }
pack $w.geoframe.test - side left - anchor s - padx 4 - pady 4
pack $w.geoframe.ent - side left - expand yes - fill x - anchor s - padx 4 - pady 4
pack $w.geoframe.btn - side left - anchor s - padx 4 - pady 4
# stl testing #
frame $w.stlframe
pack $w.stlframe
set stllogfile " "
tixLabelEntry $w.stlframe.ent - label " s t l l o g - f i l e : c o n s o l e i f e m p t y " \
-labelside top \
-options {
entry.textVariable stllogfile
entry.width 35
label.width 25
label.anchor w
}
button $w.stlframe.btn - text " B r o w s e " - command {
set types { { " L o g f i l e " { .log } } }
set stllogfile [ tk_getOpenFile - filetypes $types - initialfile $stllogfile ]
}
button $w.stlframe.test - text " T e s t s t l m e s h i n g " - command { ngtest stl $stllogfile }
pack $w.stlframe.test - side left - anchor s - padx 4 - pady 4
pack $w.stlframe.ent - side left - expand yes - fill x - anchor s - padx 4 - pady 4
pack $w.stlframe.btn - side left - anchor s - padx 4 - pady 4
# pde testing #
frame $w.pdeframe
pack $w.pdeframe
set pdelogfile " "
tixLabelEntry $w.pdeframe.ent - label " p d e l o g - f i l e : c o n s o l e i f e m p t y " \
-labelside top \
-options {
entry.textVariable pdelogfile
entry.width 35
label.width 25
label.anchor w
}
button $w.pdeframe.btn - text " B r o w s e " - command {
set types { { " L o g f i l e " { .log } } }
set pdelogfile [ tk_getOpenFile - filetypes $types - initialfile $pdelogfile ]
}
button $w.pdeframe.test - text " T e s t n g s o l v e p d e ' s " - command { ngtest pde $pdelogfile }
pack $w.pdeframe.test - side left - anchor s - padx 4 - pady 4
pack $w.pdeframe.ent - side left - expand yes - fill x - anchor s - padx 4 - pady 4
pack $w.pdeframe.btn - side left - anchor s - padx 4 - pady 4
wm title $w " T e s t i n g "
focus .runtest_dlg
}
}