From 8fd560230ffb8129ee1c293be3749df68a6c41e8 Mon Sep 17 00:00:00 2001 From: Philippose Rajan Date: Fri, 30 Jan 2009 22:22:13 +0000 Subject: [PATCH] * Modified the TCL Scripts to add a new Menu entry "Edit Face Mesh Size..." into the "Mesh" Menu - Used to interactively set the maximum mesh size of each face in an OCC Geometry - The Mouse double click has also been bound to the above function --- ng/dialog.tcl | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ ng/drawing.tcl | 1 + ng/menustat.tcl | 6 +++ 3 files changed, 104 insertions(+) diff --git a/ng/dialog.tcl b/ng/dialog.tcl index 341beec9..f0ea452f 100644 --- a/ng/dialog.tcl +++ b/ng/dialog.tcl @@ -1530,6 +1530,103 @@ proc bcpropdialog { } { +# +# 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 "face index:" + label $w.face.ent -text 1 -padx 4 + button $w.face.next -text "next" -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 "prev" -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 "max mesh size:" + entry $w.sms.ent -width 8 -relief sunken + button $w.sms.but -text "change" -command { + set w .surfacemeshsize_dlg; + Ng_SurfaceMeshSize setsurfms [$w.face.ent cget -text] [$w.sms.ent get]; + } + button $w.sms.but2 -text "all" -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 "Close" -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 "Edit Surface Mesh Size" + } + + 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 # diff --git a/ng/drawing.tcl b/ng/drawing.tcl index 5878dddd..9e95ee6b 100644 --- a/ng/drawing.tcl +++ b/ng/drawing.tcl @@ -31,6 +31,7 @@ if {[catch {togl .ndraw -width 400 -height 300 -rgba true -double true -depth t Ng_MouseDblClick %x %y .ndraw render if { [winfo exists .bcprop_dlg] } { bcpropdialog } + if { [winfo exists .surfacemeshsize_dlg] } { surfacemeshsizedialog } if { [winfo exists .fieldlines_dlg] } { fieldlinesdialog } } diff --git a/ng/menustat.tcl b/ng/menustat.tcl index ad1b9b4f..8c80ef5e 100644 --- a/ng/menustat.tcl +++ b/ng/menustat.tcl @@ -418,6 +418,12 @@ menu .ngmenu.mesh .ngmenu.mesh add command -label "Meshing Options..." \ -command meshingoptionsdialog +# Philippose - 30/01/2009 +# Add menu item for local face mesh size definition in the +# TCL Gui +.ngmenu.mesh add command -label "Edit Face Mesh Size..." \ + -command { surfacemeshsizedialog } + .ngmenu.mesh add separator .ngmenu.mesh add command -label "Delete Mesh" \