Class GLViewWindow
In: discretizer.rb
Parent: FXMainWindow

Methods

afterobjcreate   beforeobjcreate   create   createfromtable   deleteCasedir   exportMesh   findcurrentobject   findlower   findobj   findupper   getmeshnum   getrefnum   iftobc   imeshtest   loadIcon   new   onBlockModify   onCmdExport   onCmdExport1   onCmdNew   onCmdOpen   onCmdOpenPolymesh   onCmdSave   onCmdSaveAs   onCmdUpdate   onCmdWriteAndRun   onCmdWriteCase   onCreateInlet   onCreateOutlet   onCreatecsys   onCreatecube   onCreatecube1f   onCreatecube1p   onCreatecube2f   onCreatecube6f   onCreateface1f   onCreateface1l   onCreateface1p   onCreateface2l   onCreateface2lconn   onCreateface3l   onCreateface4l   onCreatefutureline   onCreateline1p   onCreateline2p   onCreatepoint   onCsysCreate   onCubeCreate   onFaceCreate   onHideSelected   onInletCreate   onLineCreate   onModify   onModifyInlet   onModifyOutlet   onModifycsys   onModifycsysdefault   onModifycube1f   onModifycube1p   onModifycube2f   onModifyface1f   onModifyface1l   onModifyface1p   onModifyface2l   onModifyfutureline   onModifyline1p   onModifyline2p   onModifypoint   onOutletCreate   onPerspectiveDlg   onPointCreate   onQueryMenu   onRadiusCreate   onRemove2cells   onRunFoam   onSelectedFunc   onShowAll   onShowSelected   onTableClick   onToggleDefaultCsys   onToggleVisibility   onUpdMode   onUpdTitle   onWhichIffaceno   refinfo   removeData100   removeallimesh   removeimesh   runSimpleFoam   saveFile   setchild   startover   swapl   table2meshref   testAndColorTable   testAndColorViewer   testbuffer   turbocheck   unselectall   updateface4l   updateobjects   visibilitycheck   writeCase   writeref  

Included Modules

Responder CommonTasks MeshExport Mesh FoamFiles

Constants

MAX_ROW = 250
MAX_COL = $MAX_ATTRIB_SIZE*2 + MAX_ROW*4 + 1
ID_QUERY_MODE = FXMainWindow::ID_LAST
ID_GLVIEWER = ID_QUERY_MODE + 1

Public Class methods

[Source]

# File discretizer.rb, line 105
   def initialize(app)
      #@selected=nil
      @selbuffer=[]
      # >= 1, good value = 2
      $meshinterpolationfactor = 3
      # >= 1, good value = 1
      $meshfindwideness = 3
      # 0.5 is a good value
      $meshradiusrecover = 0.5
      # tolerance for perfectmatch
      $perfectmatchtol = 1e-12
      $pointvisibility = true
      $linevisibility = true
      $facevisibility = true
      $readfile = false
      $cubecount001 = -1
      $updatelater = Array.new

      $defaults={ 'csysxpos' => 0.0,
               'csysypos' => 0.0,
               'csyszpos' => 0.0,
               'csysxrot' => 0.0,
               'csysyrot' => 0.0,
               'csyszrot' => 0.0,
               'csystype' => "normal",
               'csyssize' => 10.0,
               'pointxpos' => 0.0,
               'pointypos' => 0.0,
               'pointzpos' => 0.0,
               'linerefattr' => 0,
               'linexvec' => 10.0,
               'lineyvec' => 0.0,
               'linezvec' => 0.0,
               'lineradius' => 20.0,
               'lineaxis' => "z",
               'linexaxis' => 0.0,
               'lineyaxis' => 0.0,
               'linezaxis' => 1.0,
               'linemeshnum' => 5,
               'facerefattr' => 0,
               'facexlength' => 10.0,
               'faceylength' => 10.0,
               'facer0' => "inf",
               'facer1' => "inf",
               'facer2' => "inf",
               'facer3' => "inf",
               'facexrot' => 0.0,
               'faceyrot' => 0.0,
               'facezrot' => 0.0,
               'facexvec' => 0.0,
               'faceyvec'  => 10.0,
               'facezvec'  => 0.0,
               'faceplane'  => "xy",
               'facemeshnum'  => 5,
               'facemeshx'  => 5,
               'facemeshy'  => 5,
               'facediag' => nil,
               'facefacexlength' => 5.0,
               'facefaceylength' => 5.0,
               'facefacexpos' => 5.0,
               'facefaceypos' => 5.0,
               'facefacerefattr' => 0,
               'facefaceadjust' => 1,
               'cuberefattr' => 0,
               'cubetwist' => 0,
               'cubeflipdir' => 0,
               'cubexlength' => 10.0,
               'cubeylength' => 10.0,
               'cubezlength' => 10.0,
               'cubexvec' => 0.0,
               'cubeyvec' => 0.0,
               'cubezvec' => 10.0,
               'cubemeshx' => 5,
               'cubemeshy' => 5,
               'cubemeshz' => 5,
               'cubemeshnum' => 5,
               'cubeang1' => 0.0,
               'cubeang2' => 0.0,
               'cubeangattr' => 1,
               'cubeextrude' => 10.0,
               'cubediag' => nil,
               'defaultfilename' => "default.dtz",
               'workdir' => "~/",
               'casename' => "default",
               'foamtype' => "simpleFoam",
               'scalefactor' => 0.001,
               'bcbctype' => "OUTLET",
               'bcxvel' => 0.0,
               'bcyvel' => 0.0,
               'bczvel' => 0.0,
               'bck' => 1.5,
               'bcepsilon' => 40.0,
               'bcvelmag' => 10.0,
               'bcxvec' => 1.0,
               'bcyvec' => 0.0,
               'bczvec' => 0.0,
               'bcturbintensity' => 10,
               'bcturblength' => 0.125,
               'bcp' => 0.0}

      @filename = $defaults['defaultfilename']
      @filenameset = false
      # Initialize base class first
      # for my old thinkpad 240X super(app, "Discretizer", nil, nil, DECOR_ALL, 0, 0, 800, 520)
      super(app, "Discretizer - " + @filename, nil, nil, DECOR_ALL, 0, 0, 1024, 768)

      # Define message identifiers for this class
      # Set up the message map
      FXMAPFUNC(SEL_UPDATE,  GLViewWindow::ID_QUERY_MODE, :onUpdMode)
      #FXMAPFUNC(SEL_UPDATE,  FXWindow::ID_UPDATE, :onUpdMode)
      # also works: FXMAPFUNC(SEL_COMMAND, FXWindow::ID_QUERY_MENU,     :onQueryMenu)
      FXMAPFUNC(SEL_COMMAND, GLViewWindow::ID_QUERY_MENU,       :onQueryMenu)
      #FXMAPFUNC(SEL_COMMAND, FXTable::RIGHT_MOUSE_CONTEXT_MENU, :onSelectedFunc)
      #FXMAPFUNC(RIGHT_MOUSE_CONTEXT_MENU, FXTable::ID_QUERY_MENU, :onSelectedFunc)
      #FXMAPFUNC(SEL_RIGHTBUTTONRELEASE, FXTable::ID_QUERY_MENU, :onSelectedFunc)
      #FXMAPFUNC(SEL_LEFTBUTTONPRESS, GLViewWindow::ID_GLVIEWER, :onClickedFunc)
      #FXMAPFUNC(SEL_LEFTBUTTONRELEASE, GLViewWindow::ID_GLVIEWER, :onLeftbuttonRelease)
      FXMAPFUNC(SEL_COMMAND, GLViewWindow::ID_GLVIEWER, :onSelectedFunc)
      FXMAPFUNC(SEL_UPDATE, FXDocument::ID_TITLE, :onUpdTitle)


      setTarget(self)
      setSelector(FXDocument::ID_TITLE)

      # Update title
      def onUpdTitle(sender, sel, ptr)
         title = "Discretizer - " + @filename
         sender.handle(self, MKUINT(FXWindow::ID_SETSTRINGVALUE, SEL_COMMAND), title)
         return 1
      end



      @objects = InfoList.new 
      # store all objects in this. $globalobjects[ row ] = object on row
      $globalobjects = Array.new
      # store boundaries here
      $globalboundary = Array.new
      @viewer = [nil]
      # create all the dialog boxes

      # csys dialogs
      @createcsys0p = CsysDialog0p.new(self,"Create Coordinate System")
      @createcsys0p.setdefault
      @modifycsysdefault = CsysDefault.new(self, "Modify Default Coordinate System")
      @modifycsys0p = CsysDialog0p.new(self,"Modify Coordinate System")
      @modifycsys0p.setdefault

      # Point dialogs
      @pointdialog = PointDialog.new(self) 
      @pointdialog.setdefault
      @modifypoint = PointDialog.new(self) 

      # Line dialogs
      @linedialog1p = LineDialog1p.new(self,"Create Line")
      @linedialog1p.setdefault
      @modifyline1p = LineDialog1p.new(self,"Modify Line")
      @modifyline1p.setdefault
      @linedialog2p = LineDialog2p.new(self,"Create Line")
      @linedialog2p.setdefault
      @modifyline2p = LineDialog2p.new(self,"Modify Line")
      @modifyline2p.setdefault
      @createfutureline = FutureLineDialog.new(self, "Create Radius")
      @createfutureline.setdefault
      @modifyfutureline = FutureLineDialog.new(self, "Modify Radius")
      @modifyfutureline.setdefault

      # Face dialogs
      @facedialog1p = FaceDialog1p.new(self, "Create Face")
      @modifyface1p = FaceDialog1p.new(self, "Modify Face")
      @facedialog1l = FaceDialog1l.new(self, "Create Face")
      @facedialog1l.setdefault
      @modifyface1l = FaceDialog1l.new(self, "Modify Face")
      @facedialog2l = LineDialog2p.new(self,"Create Face")
      @facedialog2l.setdefault
      @facedialog2l.labelAttribute.text = "Face attributes:"
      @modifyface2l = LineDialog2p.new(self,"Modify Face")
      @modifyface2l.setdefault
      @modifyface2l.labelAttribute.text = "Face attributes:"
      @facedialog1f = FaceDialog1f.new(self, "Create Face on Face")
      @facedialog1f.setdefault
      @modifyface1f = FaceDialog1f.new(self, "Modify Face on Face")
      @modifyface1f.setdefault
      @facedialog2lconn = FaceDialog4l.new(self, "Create Face")
      @facedialog3l= FaceDialog4l.new(self, "Create Face")
      @facedialog4l= FaceDialog4l.new(self, "Create Face")
      # @facedialog1f.show
      #@blockdialog = BlockDialog.new(self, "Create Face")
      #@modifyblock = BlockDialog.new(self,"Modify Face")

      # Cube dialogs
      @cubedialog1f = CubeDialog1f.new(self, "Create Cube")
      @modifycube1f = CubeDialog1f.new(self, "Modify Cube")
      @cubedialog1f.setdefault
      @cubedialog2f = CubeDialog2f.new(self, "Create Cube")
      @modifycube2f = CubeDialog2f.new(self, "Modify Cube")
      @cubedialog2f.setdefault
      #@cubedialog2f.show
      @cubedialog = CubeDialog.new(self, "Create Cube")
      @cubedialog.setdefault
      @cubedialog1p = CubeDialog1p.new(self, "Create Cube")
      @cubedialog1p.setdefault
      @modifycube1p = CubeDialog1p.new(self, "Modify Cube")
      @modifycube1p.setdefault
      @modifycube = CubeDialog.new(self,"Modify Cube")
      @modifycube.setdefault
      @cubedialog6f = CubeDialog6f.new(self, "Create Cube")

     # OpenFOAM dialogs
      @openfoamdialog = OpenFoamDialog.new(self, "OpenFOAM Run Dialog")
      @openfoamdialog.setdefault
      @openfoamdialog.writeMeshButton.connect(SEL_COMMAND, method(:onCmdExport ))
      @openfoamdialog.writeCaseButton.connect(SEL_COMMAND, method(:onCmdWriteCase ))
      @openfoamdialog.writeAndRunButton.connect(SEL_COMMAND, method(:onCmdWriteAndRun ))
      @bcinletdialog = BcInletDialog.new(self, "Inlet Boundary")
      @bcinletdialog.setdefault
      #@bcinletdialog.show
      @bcoutletdialog = BcOutletDialog.new(self, "Outlet Boundary")
      @bcoutletdialog.setdefault
      #@bcoutletdialog.show
      @modifybcinletdialog = BcInletDialog.new(self, "Modify Inlet Boundary")
      @modifybcinletdialog.setdefault
      @modifybcoutletdialog = BcOutletDialog.new(self, "Modify Outlet Boundary")
      @modifybcoutletdialog.setdefault

      ashell = Shell.new
      begin
         $globalworkdir = ashell.expand_path( $defaults['workdir'] )
      rescue
         $globalworkdir = ashell.expand_path( "c:\\" )
         # TODO set the work dir
      end

      $globalcasename = $defaults['casename']
      $globalinlet = Array.new
      $globaloutlet = Array.new

      # Main window icon
      mesh = loadIcon("mesh")
      setIcon(mesh)

      # The colors dialog
      colordlg = FXColorDialog.new(self, "Color Dialog", DECOR_TITLE|DECOR_BORDER)

      # Menubar
      menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)

      # Tool bar
      FXHorizontalSeparator.new(self,
         LAYOUT_SIDE_TOP|SEPARATOR_GROOVE|LAYOUT_FILL_X);
         toolbar = FXToolBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0)

      # Make status bar
      statusbar = FXStatusBar.new(self, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER)

      # Contents
      frame = FXSplitter.new(self,LAYOUT_SIDE_TOP|LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_Y)
      #frame = FXHorizontalFrame.new(self,

      # Nice sunken box around GL viewer
      # if this is placed to right the tab book is placed to left...
      box1 = FXVerticalFrame.new(frame, FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0)
      box2 = FXVerticalFrame.new(frame, FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0)

      tableFrame = FXVerticalFrame.new(box1, (FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_CENTER_X|LAYOUT_TOP|LAYOUT_LEFT))
      tableFrame.padLeft = 0
      tableFrame.padRight = 0
      tableFrame.padTop = 0
      tableFrame.padBottom = 0
      @table = FXTable.new(tableFrame, nil, 0, TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 10,0,0,0, 2,2,2,2)
      $globaltable = @table

      # the table is not editable
      @table.editable=false
      # enable the table pane
      @table.connect(SEL_RIGHTBUTTONRELEASE){|sender,sel,event|
         onTableClick(sender,sel,event)
      }
      # note: can be used to sort out which object: @table.getSelStartRow
      # select entire object with all attribute rows
      @table.connect(SEL_COMMAND){|sender,sel,event|
         # puts "sender #{sender} sel #{sel} event #{event}"
         # puts "FXTablePos.col #{event.col} FXTablePos.row #{event.row}"
         # find current object's upper range
         # which object?
         selrow = event.row
         if @table.getItemText(event.row,1) != "" || @table.getItemText(event.row,0) != ""
            currentobject = findcurrentobject(selrow, @objects)
            # puts "currentobject #{currentobject}"
            #upper = currentobject.row
            #lower = currentobject.row
            #upper = findupper(selrow,@table)
            #lower = findlower(selrow,@table)
            #unselectall
            #@table.selectRange(upper.to_i,lower.to_i,0,40,notify=false)
            #@table.setRowText(upper.to_i,"#{upper.to_i} *")
            # also select table selected object in viewer
            #@objects.whichobject(upper).select
            testAndColorTable(currentobject)
            @viewer.update
         end
      }
      @table.visibleRows = 20
      @table.visibleColumns = 8
      @table.defColumnWidth = 18
      @table.rowHeaderWidth = 38

      @table.setTableSize(MAX_ROW, MAX_COL)
      # I just needed some empty cells for table overlay
      @emptycellsfromstart = @table.extractText(0, MAX_ROW-1, 0, MAX_COL-1)
      # Column headers, references begin at column no 41
      columnNames = ["item"]
      (1..($MAX_ATTRIB_SIZE)).each do 
         columnNames.push("attr","")
      end
      columnNames.push("r","e","f","e","r","e","n","c","e","s")
      # Column widths
      columnSizes = [40]
      (1..($MAX_ATTRIB_SIZE)).each do 
         columnSizes.push(55,35)
      end
      # Initialize column widths
      columnSizes.each_with_index do |w, w_idx|
         @table.setColumnWidth(w_idx, w)
      end
      # Initialize column headers
      columnNames.each_with_index do |c, c_idx|
         @table.setColumnText(c_idx, c)
      end

      # Initialize row headers
      (0...MAX_ROW).each { |r| @table.setRowText(r, "#{r}") }

      # A visual to drag OpenGL in double-buffered mode; note the glvisual is
      # shared between all windows which need the same depths and numbers of
      # buffers. Thus, while the first visual may take some time to initialize,
      # each subsequent window can be created very quickly; we need to determine
      # graphics hardware characteristics only once.
      @glvisual = FXGLVisual.new(getApp(), VISUAL_DOUBLEBUFFER|VISUAL_BEST)

      # Drawing gl canvas
      @viewer = FXGLViewer.new(box2, @glvisual, self, ID_GLVIEWER, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT)

      @viewer.setBackgroundColor(FXVec4f.new(0.3,0.3,0.2,0),FALSE)
      @viewer.setBackgroundColor(FXVec4f.new(0.8,0.8,0.6,0),TRUE)
      $globalviewer = @viewer
      @viewer.maxHits=100000
      @viewer.handle(self,MKUINT(FXGLViewer::ID_PARALLEL,SEL_COMMAND) , nil)
      @perspectivedialog = PerspectiveDialog.new(self, "Perspective settings")

      # create colors
      $gray = FXMaterial.new
      $gray.ambient[0]=165.0/255
      $gray.ambient[1]=160.0/255
      $gray.ambient[2]=160.0/255
      $gray.ambient[3]=0.0
      $gray.diffuse = $gray.ambient
      $dark = FXMaterial.new
      $dark.ambient[0]=165.0/255
      $dark.ambient[1]=145.0/255
      $dark.ambient[2]=145.0/255
      $dark.ambient[3]=0.0
      $dark.diffuse = $dark.ambient
      $selgray = FXMaterial.new
      $selgray.ambient[0]=255.0/255
      $selgray.ambient[1]=255.0/255
      $selgray.ambient[2]=0.0/255
      $selgray.ambient[3]=0.0
      $selgray.diffuse = $selgray.ambient
      $seldark = FXMaterial.new
      $seldark.ambient[0]=245.0/255
      $seldark.ambient[1]=245.0/255
      $seldark.ambient[2]=0.0/255
      $seldark.ambient[3]=0.0
      $seldark.diffuse = $seldark.ambient

      # Construct these icons
      newdoc = loadIcon("filenew")
      opendoc = loadIcon("fileopen")
      savedoc = loadIcon("filesave")
      saveasdoc = loadIcon("filesaveas")

      # File Menu
      filemenu = FXMenuPane.new(self)
      FXMenuTitle.new(menubar, "&File", nil, filemenu)
      newCmd = FXMenuCommand.new(filemenu, "&New...\tCtl-N\tCreate new document.", newdoc)
      newCmd.connect(SEL_COMMAND, method(:onCmdNew))
      openCmd = FXMenuCommand.new(filemenu, "&Open...\tCtl-O\tOpen document file.", opendoc)
      openCmd.connect(SEL_COMMAND, method(:onCmdOpen))
      saveCmd = FXMenuCommand.new(filemenu, "&Save\tCtl-S\tSave document.", savedoc)
      saveCmd.connect(SEL_COMMAND, method(:onCmdSave))
      saveAsCmd = FXMenuCommand.new(filemenu, "Save &As...\t\tSave document to another file.", saveasdoc)
      saveAsCmd.connect(SEL_COMMAND, method(:onCmdSaveAs))
      FXMenuSeparator.new(filemenu)
      exportCmd = FXMenuCommand.new(filemenu, "&Open PolyMesh\tCtl-E\tOpen Polymesh.", mesh)
      #exportCmd.connect(SEL_COMMAND, method(:onCmdExport))
      exportCmd.connect(SEL_COMMAND, method(:onCmdOpenPolymesh))
      # export1Cmd = FXMenuCommand.new(filemenu, "Export &first cube\t\tExport first cube.", mesh)
      # export1Cmd.connect(SEL_COMMAND, method(:onCmdExport1))
      runFoamCmd = FXMenuCommand.new(filemenu, "&Run Dialog\t\tRun OpenFOAM, save case and mesh.", nil)
      runFoamCmd.connect(SEL_COMMAND, method(:onRunFoam))
      FXMenuSeparator.new(filemenu)
      FXMenuCommand.new(filemenu, "&Print Image...\t\tPrint snapshot image.", nil, @viewer, FXGLViewer::ID_PRINT_IMAGE, MENU_AUTOGRAY)
      FXMenuCommand.new(filemenu, "&Print Vector...\t\tPrint geometry.", nil, @viewer, FXGLViewer::ID_PRINT_VECTOR, MENU_AUTOGRAY)
      FXMenuCommand.new(filemenu, "&Dump...\t\tDump widgets.", nil, getApp(), FXApp::ID_DUMP)
      FXMenuSeparator.new(filemenu)
      FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application.", nil, getApp(), FXApp::ID_QUIT)

      # Edit Menu
      editmenu = FXMenuPane.new(self)
      updateCmd = FXMenuCommand.new(editmenu, "&Update\tCtl-U\tUpdate selected objects.", nil)
      updateCmd.connect(SEL_COMMAND, method(:onCmdUpdate))
      FXMenuTitle.new(menubar, "&Edit", nil, editmenu)
??

      # Create object menu
      createmenu = FXMenuPane.new(self)
      FXMenuTitle.new(menubar, "&Create", nil, createmenu)
      csysCmd = FXMenuCommand.new(createmenu, "C&sys")
      csysCmd.connect(SEL_COMMAND){ onCsysCreate }
      FXMenuSeparator.new(createmenu)
      pointCmd = FXMenuCommand.new(createmenu, "&Point")
      pointCmd.connect(SEL_COMMAND){ onPointCreate }
      lineCmd = FXMenuCommand.new(createmenu, "&Line")
      lineCmd.connect(SEL_COMMAND){ onLineCreate }
      faceCmd = FXMenuCommand.new(createmenu, "&Face")
      faceCmd.connect(SEL_COMMAND){ onFaceCreate }
      cubeCmd = FXMenuCommand.new(createmenu, "&Cube")
      cubeCmd.connect(SEL_COMMAND){ onCubeCreate }
      FXMenuSeparator.new(createmenu)
      radiusCmd = FXMenuCommand.new(createmenu, "&Radius")
      radiusCmd.connect(SEL_COMMAND){ onRadiusCreate }

      # File manipulation
      newBtn = FXButton.new(toolbar, "\tNew\tCreate new document.", newdoc, nil, 0, FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
      newBtn.connect(SEL_COMMAND, method(:onCmdNew))
      openBtn = FXButton.new(toolbar, "\tOpen\tOpen document file.", opendoc, nil, 0, FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
      openBtn.connect(SEL_COMMAND, method(:onCmdOpen))
      saveCmd = FXButton.new(toolbar, "\tSave\tSave document.", savedoc, nil, 0, FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
      saveCmd.connect(SEL_COMMAND, method(:onCmdSave))
      saveAsCmd = FXButton.new(toolbar, "\tSave As\tSave document to another file.",
      saveasdoc, nil, 0, FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
      saveAsCmd.connect(SEL_COMMAND, method(:onCmdSaveAs))
      #FXButton.new(toolbar, "\tNew Folder\tNo comment", loadIcon("newfolder"),
      #  nil, 0, FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)

      # Print
      FXFrame.new(toolbar, LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, 0, 0, 4, 20)
      FXButton.new(toolbar, "\tPrint Image\tPrint shapshot image.", loadIcon("printicon"), @viewer, FXGLViewer::ID_PRINT_IMAGE,
         BUTTON_AUTOGRAY|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
??
 
      # Projections
      FXFrame.new(toolbar, (LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT), 0, 0, 8, 20)
      FXButton.new(toolbar, "\tPerspective\tSwitch to perspective projection.", loadIcon("perspective"), @viewer, FXGLViewer::ID_PERSPECTIVE,
         BUTTON_AUTOGRAY|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
      FXButton.new(toolbar, "\tParallel\tSwitch to parallel projection.", loadIcon("parallel"), @viewer, FXGLViewer::ID_PARALLEL,
         BUTTON_AUTOGRAY|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
??
 
      # View orientation
      FXFrame.new(toolbar, (LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT), 0, 0, 8, 20)
      FXButton.new(toolbar, "\tFront View\tView objects from the front.", loadIcon("frontview"), @viewer, FXGLViewer::ID_FRONT,
         BUTTON_AUTOGRAY|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
      FXButton.new(toolbar, "\tBack View\tView objects from behind.", loadIcon("backview"), @viewer, FXGLViewer::ID_BACK,
         BUTTON_AUTOGRAY|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
      FXButton.new(toolbar, "\tLeft View\tView objects from the left.", loadIcon("leftview"), @viewer, FXGLViewer::ID_LEFT,
         BUTTON_AUTOGRAY|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
      FXButton.new(toolbar, "\tRight View\tView objects from the right.", loadIcon("rightview"), @viewer, FXGLViewer::ID_RIGHT,
         BUTTON_AUTOGRAY|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
      FXButton.new(toolbar, "\tTop View\tView objects from the top.", loadIcon("topview"), @viewer, FXGLViewer::ID_TOP,
         BUTTON_AUTOGRAY|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
      FXButton.new(toolbar, "\tBottom View\tView objects from below.", loadIcon("bottomview"), @viewer, FXGLViewer::ID_BOTTOM,
         BUTTON_AUTOGRAY|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
      FXButton.new(toolbar, "\tReset\tReset the viewer.", loadIcon("reset"), @viewer, FXGLViewer::ID_RESETVIEW,
         FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT)
??

      # View menu
      viewmenu = FXMenuPane.new(self)
      FXMenuTitle.new(menubar, "&View", nil, viewmenu)
      perspectiveDlg = FXMenuCommand.new(viewmenu, "&Perspective settings\t\tPerspective settings dialog")
      perspectiveDlg.connect(SEL_COMMAND){onPerspectiveDlg}
      FXMenuSeparator.new(viewmenu)
      FXMenuCommand.new(viewmenu, "Parallel\t\tSwitch to parallel projection.", nil, @viewer, FXGLViewer::ID_PARALLEL, MENU_AUTOGRAY)
      FXMenuCommand.new(viewmenu, "Perspective\t\tSwitch to perspective projection.", nil, @viewer, FXGLViewer::ID_PERSPECTIVE, MENU_AUTOGRAY)
      FXMenuCommand.new(viewmenu, "&Front\tCtl-F\tFront view.", nil, @viewer, FXGLViewer::ID_FRONT, MENU_AUTOGRAY)
      FXMenuCommand.new(viewmenu, "&Back\tCtl-B\tBack view.", nil, @viewer, FXGLViewer::ID_BACK, MENU_AUTOGRAY)
      FXMenuCommand.new(viewmenu, "&Left\tCtl-L\tLeft view.", nil, @viewer, FXGLViewer::ID_LEFT, MENU_AUTOGRAY)
      FXMenuCommand.new(viewmenu, "&Right\tCtl-R\tRight view.", nil, @viewer, FXGLViewer::ID_RIGHT, MENU_AUTOGRAY)
      FXMenuCommand.new(viewmenu, "&Top\tCtl-T\tTop view.", nil, @viewer, FXGLViewer::ID_TOP, MENU_AUTOGRAY)
      FXMenuCommand.new(viewmenu, "&Bottom\tCtl-K\tBottom view.", nil, @viewer, FXGLViewer::ID_BOTTOM, MENU_AUTOGRAY)
      FXMenuCommand.new(viewmenu, "F&it\t\tFit to view.", nil, @viewer, FXGLViewer::ID_FITVIEW, MENU_AUTOGRAY)
      FXMenuCommand.new(viewmenu, "R&eset\tCtl-G\tReset all viewing parameters", nil, @viewer, FXGLViewer::ID_RESETVIEW, MENU_AUTOGRAY)
      FXMenuCommand.new(viewmenu, "Zoom...\t\tZoom in on area", nil, @viewer, FXGLViewer::ID_LASSO_ZOOM, MENU_AUTOGRAY)
      FXMenuCommand.new(viewmenu, "Select...\t\tZoom in on area", nil, @viewer, FXGLViewer::ID_LASSO_SELECT, MENU_AUTOGRAY)
      FXMenuSeparator.new(viewmenu)
      #FXMenuCommand.new(viewmenu, "Toolbar", nil,  toolbar, FXWindow::ID_TOGGLESHOWN)
      FXMenuCheck.new(viewmenu, "Toolbar",  toolbar, FXWindow::ID_TOGGLESHOWN)
      FXMenuCheck.new(viewmenu, "Model Sheet", box1, FXWindow::ID_TOGGLESHOWN)
      #FXMenuCheck.new(viewmenu, "3D View", box2, FXWindow::ID_TOGGLESHOWN)
      #FXMenuCheck.new(viewmenu, "Misc Options", box3, FXWindow::ID_TOGGLESHOWN)

      # Visible menu
      visiblemenu = FXMenuPane.new(self)
      FXMenuTitle.new(menubar, "Visi&ble", nil, visiblemenu)
      @pointmenucheck = FXMenuCheck.new(visiblemenu, "Point Visibility")
      @pointmenucheck.connect(SEL_COMMAND){visibilitycheck}
      @linemenucheck = FXMenuCheck.new(visiblemenu, "Line Visibility")
      @linemenucheck.connect(SEL_COMMAND){visibilitycheck}
      @facemenucheck = FXMenuCheck.new(visiblemenu, "Face Visibility")
      @facemenucheck.connect(SEL_COMMAND){visibilitycheck}
      @pointmenucheck.check = true
      @linemenucheck.check = true
      @facemenucheck.check = true
      def visibilitycheck
         if @pointmenucheck.check == true
            $pointvisibility = true
         else
            $pointvisibility = false
         end
         if @linemenucheck.check == true
            $linevisibility = true
         else
            $linevisibility = false
         end
         if @facemenucheck.check == true
            $facevisibility = true
         else
            $facevisibility = false
         end
         # maybe time for a show if visible method?
         @objects.objects.each do |obj|
            if obj.visible
               obj.hide
               obj.show
            end
         end
      end
      FXMenuSeparator.new(visiblemenu)
      @turbomenucheck = FXMenuCheck.new(visiblemenu, "Turbo mode")
      @turbomenucheck.connect(SEL_COMMAND){turbocheck}
      @turbomenucheck.check = true
      @viewer.turboMode = true
      def turbocheck
         if @turbomenucheck.check == true
            @viewer.turboMode = true
         else
            @viewer.turboMode = false
         end
      end
      FXMenuSeparator.new(visiblemenu)
      toggleVisibility = FXMenuCommand.new(visiblemenu, "Toggle visibility")
      toggleVisibility.connect(SEL_COMMAND){ onToggleVisibility }
      showSelected = FXMenuCommand.new(visiblemenu, "Show selected")
      showSelected.connect(SEL_COMMAND){ onShowSelected }
      hideSelected = FXMenuCommand.new(visiblemenu, "Hide selected")
      hideSelected.connect(SEL_COMMAND){ onHideSelected }
      FXMenuSeparator.new(visiblemenu)
      showAll = FXMenuCommand.new(visiblemenu, "Show all")
      showAll.connect(SEL_COMMAND){ onShowAll }
      FXMenuSeparator.new(visiblemenu)
      toggleDefaultCsys = FXMenuCommand.new(visiblemenu, "Toggle Default Coordinate System")
      toggleDefaultCsys.connect(SEL_COMMAND){ onToggleDefaultCsys }
      FXMenuSeparator.new(visiblemenu)
      toggleRemove2cells = FXMenuCommand.new(visiblemenu, "Remove first 2 cells")
      toggleRemove2cells.connect(SEL_COMMAND){ onRemove2cells }

      # boundary menu
      bcmenu = FXMenuPane.new(self)
      FXMenuTitle.new(menubar, "&Bc", nil, bcmenu )
      infoOnIfface = FXMenuCommand.new(bcmenu, "Internal Face No")
      infoOnIfface.connect(SEL_COMMAND){ onWhichIffaceno }
      createBcInlet = FXMenuCommand.new(bcmenu, "Create Inlet")
      createBcInlet.connect(SEL_COMMAND){ onInletCreate }
      createBcOutlet = FXMenuCommand.new(bcmenu, "Create Outlet")
      createBcOutlet.connect(SEL_COMMAND){ onOutletCreate }
 
??
  
      # Help menu
      helpmenu = FXMenuPane.new(self)
      FXMenuTitle.new(menubar, "&Help", nil, helpmenu, LAYOUT_RIGHT)
      aboutCmd = FXMenuCommand.new(helpmenu, "&About Discretizer\t\tDisplay Discretizer about panel.")
      aboutCmd.connect(SEL_COMMAND) {
         FXMessageBox.information(self, MBOX_OK, "About Discretizer",
            "Discretizer, mesh program. Create you domain and discretize it.\nProject web site: http://www.discretizer.org\n\nGPL license v3 or later\nauthor Bjorn Bergqvist\n\ninitial souces by Jeroen van der Zijp\n\nThis software uses the FOX Toolkit Library (http://www.fox-toolkit.org).")
      }

      #
      # connections for okButtons. Creation/modification of objects.
      #
      # Common methods always used when creating objects
      # before object is created beforeobjcreate(dialog)
      def beforeobjcreate(dialog)
         getApp().beginWaitCursor()
         if @currentRowNum == nil
            @currentRowNum = 0
         end
         if @currentRefNum == nil
            @currentRefNum = $MAX_ATTRIB_SIZE*2 +1
         end
         dialog.hide
      end
      # helper function to find how many refs
      def getrefnum
         (@currentRefNum..MAX_COL-1).each do |col|
            if @table.getItemText(@currentRowNum, col) == ""
               return col
            end 
         end 
      end
      # after object is created, method afterobjcreate(createdobj)
      def afterobjcreate(createdobj)
         @objects.insert(@currentRowNum, createdobj)
         if !$readfile
            write2table(@table, @currentRowNum, createdobj)
            writeref(createdobj) 
            #table2meshref
            imeshtest
            #updateobjects  if createdobj.class == FutureRadius # create must happend before update
         else
            createdobj.row = @currentRowNum
            @currentRefNum = getrefnum
         end
         # check mesh count here
         createdobj.create
         createdobj.show
         @viewer.update
         unselectall
         @currentRowNum = @objects.currentrownum
         getApp().endWaitCursor()
      end
      # Create coordinate system
      def onCreatecsys
         beforeobjcreate(@createcsys0p)
         # create a coordinate system in viewer and table
         csys = Csys.new(@createcsys0p.xpos.text.to_f,
                         @createcsys0p.ypos.text.to_f, 
                         @createcsys0p.zpos.text.to_f, 
                         @createcsys0p.xrot.text.to_f, 
                         @createcsys0p.yrot.text.to_f, 
                         @createcsys0p.zrot.text.to_f, 
                         @createcsys0p.csystype.value,
                         @createcsys0p.size.text.to_f)
         afterobjcreate(csys)
      end
      # connect csys dialog ok button
      @createcsys0p.okButton.connect(SEL_COMMAND){
         onCreatecsys
      }
      def onModifycsysdefault
         getApp().beginWaitCursor()
         @modifycsysdefault.hide
         @modifycsysdefault.selection.last.size = @modifycsysdefault.size.text.to_f
         unselectall
         updateobjects
         getApp().endWaitCursor()
      end
      @modifycsysdefault.okButton.connect(SEL_COMMAND){
         onModifycsysdefault
      }
      # Modify coordinate system.
      def onModifycsys
         getApp().beginWaitCursor()
         @modifycsys0p.hide
         @modifycsys0p.selection.last.xpos = @modifycsys0p.xpos.text.to_f
         @modifycsys0p.selection.last.ypos = @modifycsys0p.ypos.text.to_f
         @modifycsys0p.selection.last.zpos = @modifycsys0p.zpos.text.to_f
         @modifycsys0p.selection.last.xrot = @modifycsys0p.xrot.text.to_f
         @modifycsys0p.selection.last.yrot = @modifycsys0p.yrot.text.to_f
         @modifycsys0p.selection.last.zrot = @modifycsys0p.zrot.text.to_f
         @modifycsys0p.selection.last.csystype = @modifycsys0p.csystype.value
         @modifycsys0p.selection.last.size = @modifycsys0p.size.text.to_f
         unselectall
         @modifycsys0p.selection.last.update
         write2table(@table, @modifycsys0p.selection.last.row, @modifycsys0p.selection.last)
         updateobjects
         getApp().endWaitCursor()
      end
      @modifycsys0p.okButton.connect(SEL_COMMAND){
         onModifycsys
      }
      def onCreatepoint
         beforeobjcreate(@pointdialog)
         # create point in viewer and table 
         vertex = InfoPoint.new(@pointdialog.selection, @pointdialog.xpos.text.to_f,
            @pointdialog.ypos.text.to_f,
            @pointdialog.zpos.text.to_f)
         afterobjcreate(vertex)
      end
      # connect point dialog ok button
      @pointdialog.okButton.connect(SEL_COMMAND){
         onCreatepoint
      }
      def onModifypoint
         getApp().beginWaitCursor()
         @modifypoint.hide
         if @selbuffer[0].class == InfoPoint 
            @selbuffer[0].xpos = @modifypoint.xpos.text.to_f 
            @selbuffer[0].ypos = @modifypoint.ypos.text.to_f 
            @selbuffer[0].zpos = @modifypoint.zpos.text.to_f 
            updateobjects
            write2table(@table, @selbuffer[0].row.to_i, @selbuffer[0])
         end
         unselectall
         getApp().endWaitCursor()
      end
      @modifypoint.okButton.connect(SEL_COMMAND){
         onModifypoint
      }
      def onCreateline1p
         beforeobjcreate(@linedialog1p)
         # create line in viewer and table
         # InfoLine.new 5 arg init reftype 1p
         # new initialization:
         # line = InfoLine.new("1p", @linedialog1p.selection.csys, @linedialog1p.selection, ..args..)
         # args should be xvec, yvec, zvec, meshnum?
         #
         # def initialize2(reftype, csys, ref, parent, info, *args)
         #
         # puts "csys #{@linedialog1p.csys} meshnum #{@linedialog1p.meshnum}"
         line = InfoLine.new("1p",@linedialog1p.csys, @linedialog1p.ref, nil, nil,
            @linedialog1p.xvec.text.to_f,
            @linedialog1p.yvec.text.to_f,
            @linedialog1p.zvec.text.to_f,@linedialog1p.meshnum.text.to_i)
         afterobjcreate(line)
      end
      # connect line dialog ok button
      @linedialog1p.okButton.connect(SEL_COMMAND){
         onCreateline1p
      }
      def onModifyline1p
         getApp().beginWaitCursor()
         @modifyline1p.hide
         @selbuffer.last.xvec = @modifyline1p.xvec.text.to_f
         @selbuffer.last.yvec = @modifyline1p.yvec.text.to_f
         @selbuffer.last.zvec = @modifyline1p.zvec.text.to_f
         @selbuffer.last.meshnum = @modifyline1p.meshnum.text.to_i
         updateobjects
         write2table(@table, @selbuffer.last.row,@selbuffer.last)
         unselectall
         getApp().endWaitCursor()
      end
      @modifyline1p.okButton.connect(SEL_COMMAND){
         onModifyline1p
      }
      def onModifyfutureline
         getApp().beginWaitCursor()
         @modifyfutureline.hide
         @modifyfutureline.selection.radius = @modifyfutureline.radius.text.to_f
         @modifyfutureline.selection.refattr = @modifyfutureline.refattr.text.to_i
         @modifyfutureline.selection.axis = @modifyfutureline.axis.to_s
         @modifyfutureline.selection.xaxis = @modifyfutureline.xaxis.to_f
         @modifyfutureline.selection.yaxis = @modifyfutureline.yaxis.to_f
         @modifyfutureline.selection.zaxis = @modifyfutureline.zaxis.to_f
         @modifyfutureline.selection.update
         updateobjects
         write2table(@table, @modifyfutureline.selection.row, @modifyfutureline.selection)
         unselectall
         getApp().endWaitCursor()
      end
      @modifyfutureline.okButton.connect(SEL_COMMAND){
         onModifyfutureline
      }
      def onCreateline2p
         beforeobjcreate(@linedialog2p)
         # create line in viewer and table 
         #line = InfoLine.new(@selbuffer[0],@selbuffer[0])
         # InfoLine.new(refs, refattr, xvec, yvec, zvec, radius, xaxis, yaxis, zaxis)
         # InfoLine.new 9 arg init reftype 2p
         line = InfoLine.new("2p", @linedialog2p.csys, @linedialog2p.ref, nil, nil,
            @linedialog2p.meshnum.text.to_i, @linedialog2p.flipdir.to_i)
         afterobjcreate(line)
      end
      @linedialog2p.okButton.connect(SEL_COMMAND){
         onCreateline2p
      }
      def onModifyline2p
         getApp().beginWaitCursor()
         @modifyline2p.hide
         @selbuffer.last.meshnum = @modifyline2p.meshnum.text.to_i
         @selbuffer.last.flipdir = @modifyline2p.flipdir.to_i
         unselectall
         updateobjects
         write2table(@table, @modifyline2p.selection.row,@modifyline2p.selection)
         getApp().endWaitCursor()
      end
      @modifyline2p.okButton.connect(SEL_COMMAND){
         onModifyline2p
      }
      def onCreatefutureline
         beforeobjcreate(@createfutureline)
         # FutureLine.new( 6 args )
         radline = FutureRadius.new("line", @createfutureline.csys, @createfutureline.ref, @createfutureline.ref,
            @createfutureline.radius.text.to_f, 
            @createfutureline.xaxis, @createfutureline.yaxis, @createfutureline.zaxis,
            @createfutureline.axis, 
            @createfutureline.refattr.text.to_i)
         @createfutureline.ref.info[1].futureref = radline
         @createfutureline.ref.info[1].futurerefed = true
         afterobjcreate(radline)
         radline.parent.update
      end
      @createfutureline.okButton.connect(SEL_COMMAND){
         onCreatefutureline
      }
      def onCreateface1p
         beforeobjcreate(@facedialog1p)
         # create line in viewer and table 
         #line = InfoLine.new(@selbuffer[0],@selbuffer[0])
         # InfoLine.new(refs, refattr, xlength, ylength, xnorm, ynorm, znorm) 8 arg reftype 1p
         #
         #    def initialize2(reftype, csys, ref, parent, info, *args)
         #
         face = InfoFace.new("1p", @facedialog1p.csys, @facedialog1p.ref, nil, nil, @currentRowNum, 
            @facedialog1p.xlength.text.to_f,
            @facedialog1p.ylength.text.to_f,
            @facedialog1p.plane,
            @facedialog1p.meshx.text.to_i,
            @facedialog1p.meshy.text.to_i)
         afterobjcreate(face)
      end
      @facedialog1p.okButton.connect(SEL_COMMAND){
         onCreateface1p
      }
      def onCreateface1l
         beforeobjcreate(@facedialog1l)
         # 6 attributes
         face = InfoFace.new("1l",@facedialog1l.csys, @facedialog1l.ref, nil, nil, @currentRowNum, 
            @facedialog1l.xvec.text.to_f,
            @facedialog1l.yvec.text.to_f,
            @facedialog1l.zvec.text.to_f,
            @facedialog1l.meshnum.text.to_i)
         afterobjcreate(face)
      end
      @facedialog1l.okButton.connect(SEL_COMMAND){
         onCreateface1l
      }

      def onCreateface2l
         beforeobjcreate(@facedialog2l)
         # input rownum in initialization
         face = InfoFace.new("2l",@facedialog2l.csys, @facedialog2l.ref, nil, nil, @currentRowNum, 
            @facedialog2l.meshnum.text.to_i, @facedialog2l.flipdir.to_i )
         afterobjcreate(face)
      end
      @facedialog2l.okButton.connect(SEL_COMMAND){
         onCreateface2l
      }

      def onCreateface2lconn
         beforeobjcreate(@facedialog2lconn)
         face = InfoFace.new("2lconn",@facedialog2lconn.csys, @facedialog2lconn.ref, nil, nil, @currentRowNum)
         afterobjcreate(face)
      end
      @facedialog2lconn.okButton.connect(SEL_COMMAND){
         onCreateface2lconn
      }

      def onCreateface3l
         beforeobjcreate(@facedialog3l)
         face = InfoFace.new("3l",@facedialog3l.csys, @facedialog3l.ref, nil, nil, @currentRowNum)
         afterobjcreate(face)
      end
      @facedialog3l.okButton.connect(SEL_COMMAND){
         onCreateface3l
      }

      def onCreateface4l
         beforeobjcreate(@facedialog4l)
         face = InfoFace.new("4l",@facedialog4l.csys, @facedialog4l.ref, nil, nil, @currentRowNum)
         afterobjcreate(face)
      end
      @facedialog4l.okButton.connect(SEL_COMMAND){
         onCreateface4l
      }

      def onCreateface1f
         # when the face on face is going to be created it would be nice if
         # the referenced face is not created, just the surrounding lines.
         # Also its a problem when more than one face is created on the referenced face
         # then the face mesh should be created in the end. Or if the face class is made so
         # that it can use the future created faces as input before any face mesh is made.
         # The face on  face is then considered as a future ref object. I think right now.
         # When a real face is created it looks for future references and use them as input.
         # 
         # FaceDialog1f xlength ylength refattr xpos ypos
         #
         beforeobjcreate(@facedialog1f)
         @faceref = @facedialog1f.selection.last
         # parent, xlength, ylength, xpos, ypos, refattr
         puts @faceref
         puts @facedialog1f.xlength.text
         puts @facedialog1f.ylength.text
         puts @facedialog1f.xpos.text
         puts @facedialog1f.ypos.text
         puts @facedialog1f.refattr.text
         faceface = FutureFace.new(@faceref, @facedialog1f.xlength.text.to_f, @facedialog1f.ylength.text.to_f,
            @facedialog1f.xpos.text.to_f, @facedialog1f.ypos.text.to_f, @facedialog1f.refattr.text.to_i, @facedialog1f.adjust )
         # puts "adjust value #{@facedialog1f.adjust}, class #{@facedialog1f.adjust.class}" 
         afterobjcreate(faceface)
         # is createfaceface going to create a new class? (FutureRef?)
         #tmp.createfaceface(@facedialog1f.xlength.text.to_f,@facedialog1f.ylength.text.to_f,@facedialog1f.refattr.text,
         #                   @facedialog1f.xpos.text.to_f,@facedialog1f.ypos.text.to_f)
         # tmp.externref = true
         # puts "face on face is going to be created"
         @faceref.recreate
         #updateobjects
      end
      @facedialog1f.okButton.connect(SEL_COMMAND){
         onCreateface1f
      }
      def onCreatecube1f
         beforeobjcreate(@cubedialog1f)
         #meshtmp = {"meshnum" => @cubedialog1f.meshnum.text }
         #if $meshref[@currentRowNum].size > 0
         #   meshtmp[ $meshref[@currentRowNum][2] ] = @objects.objonrow( $meshref[@currentRowNum][0] ).reflist[ $meshref[@currentRowNum][1] ]
         #end
         # 6 attributes
         cube = InfoCube1f.new("1f",@cubedialog1f.csys, @cubedialog1f.ref, @currentRowNum, 
            @cubedialog1f.xvec.text.to_f,
            @cubedialog1f.yvec.text.to_f,
            @cubedialog1f.zvec.text.to_f,
            @cubedialog1f.meshnum.text.to_i)
            ###meshtmp["meshnum"] )
         # cube.meshnum = @cubedialog1p.meshnum.text.to_i
         # puts "xvec #{@cubedialog1f.xvec}, yvec #{@cubedialog1f.yvec}, zvec #{@cubedialog1f.zvec}" 
         afterobjcreate(cube)
      end
      @cubedialog1f.okButton.connect(SEL_COMMAND){
         onCreatecube1f
      }
      def onCreatecube2f
         beforeobjcreate(@cubedialog2f)
         # 6 attributes
         cube = InfoCube2f.new("2f",@cubedialog2f.csys, @cubedialog2f.ref, @currentRowNum, 
            @cubedialog2f.twist.text.to_i,
            @cubedialog2f.flipdir.text.to_i,
            @cubedialog2f.meshnum.text.to_i)
         afterobjcreate(cube)
      end
      @cubedialog2f.okButton.connect(SEL_COMMAND){
         onCreatecube2f
      }
      def onCreatecube6f
         beforeobjcreate(@cubedialog6f)
         #text = "Create cube from: "
         #@cubedialog6f.selection.each do |tmp|
         #   text += "#{tmp.info[0].to_s}, "
         #end
         #puts text
         cube = InfoCube6f.new("6f",@cubedialog6f.csys, @cubedialog6f.selection)

         afterobjcreate(cube)
      end
      @cubedialog6f.okButton.connect(SEL_COMMAND){
         onCreatecube6f
      }
      def onModifyface1p
         getApp().beginWaitCursor()
         @modifyface1p.hide
         @selbuffer.last.xlength = @modifyface1p.xlength.text.to_f
         @selbuffer.last.ylength = @modifyface1p.ylength.text.to_f
         @selbuffer.last.xrot = 0.0
         @selbuffer.last.yrot = 0.0
         @selbuffer.last.zrot = 0.0
         @selbuffer.last.meshx = @modifyface1p.meshx.text.to_i
         @selbuffer.last.meshy = @modifyface1p.meshy.text.to_i
         @selbuffer.last.plane = @modifyface1p.plane.to_s
         removeallimesh
         @selbuffer.last.update
         write2table(@table, @selbuffer.last.row, @selbuffer.last)
         unselectall
         updateobjects
         getApp().endWaitCursor()
      end
      @modifyface1p.okButton.connect(SEL_COMMAND){
         onModifyface1p
      }
      def onModifycube1p
         # puts "modify 1p cube"
         getApp().beginWaitCursor()
         @modifycube1p.hide
         @modifycube1p.selection.xlength = @modifycube1p.xlength.text.to_f
         @modifycube1p.selection.ylength = @modifycube1p.ylength.text.to_f
         @modifycube1p.selection.zlength = @modifycube1p.zlength.text.to_f
         @modifycube1p.selection.meshx = @modifycube1p.meshx.text.to_i
         @modifycube1p.selection.meshy = @modifycube1p.meshy.text.to_i
         @modifycube1p.selection.meshz = @modifycube1p.meshz.text.to_i
         @modifycube1p.selection.refupdate
         write2table(@table, @modifycube1p.selection.row, @modifycube1p.selection)
         unselectall
         updateobjects
         getApp().endWaitCursor()
      end
      @modifycube1p.okButton.connect(SEL_COMMAND){
         onModifycube1p
      }
      def onModifycube1f
         # puts "modify 1f cube"
         getApp().beginWaitCursor()
         @modifycube1f.hide
         @modifycube1f.selection.xvec = @modifycube1f.xvec.text.to_f
         @modifycube1f.selection.yvec = @modifycube1f.yvec.text.to_f
         @modifycube1f.selection.zvec = @modifycube1f.zvec.text.to_f
         @modifycube1f.selection.meshnum = @modifycube1f.meshnum.text.to_i
         @modifycube1f.selection.refupdate
         write2table(@table, @modifycube1f.selection.row, @modifycube1f.selection)
         unselectall
         updateobjects
         getApp().endWaitCursor()
      end
      @modifycube1f.okButton.connect(SEL_COMMAND){
         onModifycube1f
      }
      def onModifycube2f
         # puts "modify 2f cube"
         getApp().beginWaitCursor()
         @modifycube2f.hide
         @modifycube2f.selection.twist = @modifycube2f.twist.text.to_i
         @modifycube2f.selection.flipdir = @modifycube2f.flipdir.text.to_i
         @modifycube2f.selection.meshnum = @modifycube2f.meshnum.text.to_i
         @modifycube2f.selection.refupdate
         write2table(@table, @modifycube2f.selection.row, @modifycube2f.selection)
         unselectall
         updateobjects
         getApp().endWaitCursor()
      end
      @modifycube2f.okButton.connect(SEL_COMMAND){
         onModifycube2f
      }
      def onModifyface1l
         getApp().beginWaitCursor()
         @modifyface1l.hide
         @selbuffer.last.xvec = @modifyface1l.xvec.text.to_f
         @selbuffer.last.yvec = @modifyface1l.yvec.text.to_f
         @selbuffer.last.zvec = @modifyface1l.zvec.text.to_f
         @selbuffer.last.meshnum = @modifyface1l.meshnum.text.to_i
         removeallimesh
         @selbuffer.last.update
         write2table(@table, @selbuffer.last.row, @selbuffer.last)
         unselectall
         updateobjects
         getApp().endWaitCursor()
      end
      @modifyface1l.okButton.connect(SEL_COMMAND){
         onModifyface1l
      }
      def onModifyface1f
         getApp().beginWaitCursor()
         @modifyface1f.hide
         @modifyface1f.selection.xlength = @modifyface1f.xlength.text.to_f
         @modifyface1f.selection.ylength = @modifyface1f.ylength.text.to_f
         @modifyface1f.selection.xpos = @modifyface1f.xpos.text.to_f
         @modifyface1f.selection.ypos = @modifyface1f.ypos.text.to_f
         @modifyface1f.selection.refattr = @modifyface1f.refattr.text.to_i
         @modifyface1f.selection.adjust = @modifyface1f.adjust
         @modifyface1f.selection.update
         @modifyface1f.selection.parent.recreate
         write2table(@table, @modifyface1f.selection.row, @modifyface1f.selection)
         unselectall
         #updateobjects
         getApp().endWaitCursor()
      end
      @modifyface1f.okButton.connect(SEL_COMMAND){
         onModifyface1f
      }
      def onModifyface2l
         getApp().beginWaitCursor()
         @modifyface2l.hide
         @selbuffer.last.meshnum = @modifyface2l.meshnum.text.to_i
         @selbuffer.last.flipdir = @modifyface2l.flipdir.to_i
         unselectall
         removeallimesh
         updateobjects
         write2table(@table, @modifyface2l.selection.row,@modifyface2l.selection)
         getApp().endWaitCursor()
      end
      @modifyface2l.okButton.connect(SEL_COMMAND){
         onModifyface2l
      }
      # connect box dialog ok button
      # create cube. Unused method.
      def onCreatecube
         puts "onCreatecube this is not used currently"
      end
      @cubedialog.okButton.connect(SEL_COMMAND){
         onCreatecube
      }
      def onCreatecube1p
         # puts "create 1p cube"
         beforeobjcreate(@cubedialog1p)
         #meshtmp = {"meshx" => @cubedialog1p.meshx.text, "meshy" => @cubedialog1p.meshy.text,"meshz" => @cubedialog1p.meshz.text}
         #if $meshref[@currentRowNum].size > 0
         #   meshtmp[ $meshref[@currentRowNum][2] ] = @objects.objonrow( $meshref[@currentRowNum][0] ).reflist[ $meshref[@currentRowNum][1] ]
         #end
         #cube = InfoCube1p.new("1p", @cubedialog1p.csys, @cubedialog1p.ref, @currentRowNum, @cubedialog1p.xlength.text, @cubedialog1p.ylength.text, @cubedialog1p.zlength.text,
         #   meshtmp["meshx"], meshtmp["meshy"], meshtmp["meshz"] )
         cube = InfoCube1p.new("1p", @cubedialog1p.csys, @cubedialog1p.ref, @currentRowNum, @cubedialog1p.xlength.text, @cubedialog1p.ylength.text, @cubedialog1p.zlength.text,
            @cubedialog1p.meshx.text, @cubedialog1p.meshy.text, @cubedialog1p.meshz.text) 
         afterobjcreate(cube)
      end
      @cubedialog1p.okButton.connect(SEL_COMMAND){
         onCreatecube1p
      }
      def onCreateInlet
         getApp().beginWaitCursor()
         @bcinletdialog.hide
         unselectall
         bc = OpenFoamBoundary.new("INLET", @bcinletdialog.xvel.text.to_f, @bcinletdialog.yvel.text.to_f, @bcinletdialog.zvel.text.to_f, 
            @bcinletdialog.turbk.text.to_f, @bcinletdialog.turbepsilon.text.to_f)
         bc.ref = @bcinletdialog.ref
         $globalboundary.push(bc)
         if !$readfile
            write2table(@table, @currentRowNum, bc)
         else
            bc.row = @currentRowNum
         end
         writeref(bc) if !$readfile
         @objects.insert(bc.row, bc)
         @currentRowNum += 1
         getApp().endWaitCursor()
      end
      def onCreateOutlet
         getApp().beginWaitCursor()
         @bcoutletdialog.hide
         unselectall
         bc = OpenFoamBoundary.new("OUTLET", @bcoutletdialog.pressure.text.to_f)
         bc.ref = @bcoutletdialog.ref
         $globalboundary.push(bc)
         if !$readfile
            write2table(@table, @currentRowNum, bc)
         else
            bc.row = @currentRowNum
         end
         writeref(bc) if !$readfile
         @objects.insert(bc.row, bc)
         @currentRowNum += 1
         getApp().endWaitCursor()
      end
      @bcinletdialog.okButton.connect(SEL_COMMAND){
         onCreateInlet
      }
      @bcoutletdialog.okButton.connect(SEL_COMMAND){
         onCreateOutlet
      }

      def onModifyInlet
         getApp().beginWaitCursor()
         @modifybcinletdialog.hide
         bc = @selbuffer.last
         unselectall
         bc.xvel = @modifybcinletdialog.xvel.text
         bc.yvel = @modifybcinletdialog.yvel.text
         bc.zvel = @modifybcinletdialog.zvel.text
         bc.k = @modifybcinletdialog.turbk.text
         bc.epsilon = @modifybcinletdialog.turbepsilon.text
         bc.update
         write2table(@table, bc.row, bc)
         getApp().endWaitCursor()
      end
      def onModifyOutlet
         getApp().beginWaitCursor()
         @modifybcoutletdialog.hide
         bc = @selbuffer.last
         unselectall
         bc.p = @modifybcoutletdialog.pressure.text
         bc.update
         write2table(@table, bc.row, bc)
         getApp().endWaitCursor()
      end
      @modifybcinletdialog.okButton.connect(SEL_COMMAND){
         onModifyInlet
      }
      @modifybcoutletdialog.okButton.connect(SEL_COMMAND){
         onModifyOutlet
      }

      # Make a tool tip
      FXToolTip.new(getApp(), 0)

      # The status bar shows our mode
      statusbar.statusLine.target = self
      statusbar.statusLine.selector = ID_QUERY_MODE
 
      # Make a scene with default coordinate system!
      @scene = FXGLGroup.new
      $globalscene = @scene
      @gp2 = FXGLGroup.new
      @scene.append(@gp2)
      # Add scene to GL viewer
      @viewer.scene = @scene
      $defaultcsys = Csys.new(0.0, 0.0, 0.0, 
         0.0, 0.0, 0.0,
        "normal", 10.0)
      # don't show the default coordinate system "by default"
      # $defaultcsys.show(@scene)
      @objects.insert(nil, $defaultcsys)

   end

Public Instance methods

after object is created, method afterobjcreate(createdobj)

[Source]

# File discretizer.rb, line 786
      def afterobjcreate(createdobj)
         @objects.insert(@currentRowNum, createdobj)
         if !$readfile
            write2table(@table, @currentRowNum, createdobj)
            writeref(createdobj) 
            #table2meshref
            imeshtest
            #updateobjects  if createdobj.class == FutureRadius # create must happend before update
         else
            createdobj.row = @currentRowNum
            @currentRefNum = getrefnum
         end
         # check mesh count here
         createdobj.create
         createdobj.show
         @viewer.update
         unselectall
         @currentRowNum = @objects.currentrownum
         getApp().endWaitCursor()
      end

connections for okButtons. Creation/modification of objects.

Common methods always used when creating objects before object is created beforeobjcreate(dialog)

[Source]

# File discretizer.rb, line 767
      def beforeobjcreate(dialog)
         getApp().beginWaitCursor()
         if @currentRowNum == nil
            @currentRowNum = 0
         end
         if @currentRefNum == nil
            @currentRefNum = $MAX_ATTRIB_SIZE*2 +1
         end
         dialog.hide
      end

Create and show the main window

[Source]

# File discretizer.rb, line 1376
   def create
      super
      show(PLACEMENT_SCREEN)
   end

[Source]

# File discretizer.rb, line 3700
def createfromtable
   $readfile = true
   $globalobjects = Array.new
   #table2meshref
   # find object with certain name
   def findobj(name,objects)
      if name == "csys0"
         return $defaultcsys
      end
      objects.objects.each do |obj|
         if obj.info[2] == name
            return obj
         end
      end
   end
   # try to get reference info
   def refinfo(row,objects)
      # puts "stage 1"
      # fill with ref info
      csys = $defaultcsys
      ref = Array.new
      # look in each column to find references
      (($MAX_ATTRIB_SIZE*2 + 1)..MAX_COL-1).each do |col03|
         cell04 = @table.getItemText(row, col03)
         # check if cell is empty or a future ref
         if cell04 != "" && cell04[cell04.size-1,cell04.size] != "+"
            # puts "stage 2"
            if cell04[0,4] == "csys" 
               # puts "stage 3 - csys"
               # obj = @table.getItemText(row, 0)
               # puts "x,y,x on #{obj} is referenced to x,y,z on #{cell04}"
               csys = findobj(cell04,objects)
            else
               # puts "stage 3 -else"
               # now search through the column, top to bottom
               (0..MAX_ROW-1).each do |row03|
                  cell05 = @table.getItemText(row03, col03)
                  # TODO have a case construction instead?
                  if cell05 != ""
                     # puts "stage 4"
                     # refobj is the object that is referenced by current object obj
                     refobj = @table.getItemText(row03, 0)
                     obj = @table.getItemText(row, 0)
                     # onrefobj = cell04
                     if (cell05 == "*" || cell05 == "*+") && row03 != row
                        #print "* or *+ "
                        ref.push(findobj(refobj,objects))
                     elsif row03 < row
                        #get this internal object
                        # this is just a string...?
                        case refobj[0,1]
                           when "l"
                              parent = findobj(refobj, objects)
                              if cell05 == "p0"
                                 ref.push(parent.p0)
                              elsif cell05 == "p1"
                                 ref.push(parent.p1)
                              else
                                 puts "something wrong with reference to line while reading file"
                              end
                           when "f"
                              parent = findobj(refobj, objects)
                              case cell05
                                 when "l0"
                                    ref.push(parent.l0)
                                 when "l1"
                                    ref.push(parent.l1)
                                 when "l2"
                                    ref.push(parent.l2)
                                 when "l3"
                                    ref.push(parent.l3)
                                 when "p0"
                                    ref.push(parent.p0)
                                 when "p1"
                                    ref.push(parent.p1)
                                 when "p2"
                                    ref.push(parent.p2)
                                 when "p3"
                                    ref.push(parent.p3)
                              end
                           when "c"
                              parent = findobj(refobj, objects)
                              # remove "+" if present
                              if cell05[cell05.size-1,cell05.size] == "+"
                                 cell05.chop!
                              end
                              case cell05
                                 when "f0"
                                    ref.push(parent.f0)
                                 when "f1"
                                    ref.push(parent.f1)
                                 when "f2"
                                    ref.push(parent.f2)
                                 when "f3"
                                    ref.push(parent.f3)
                                 when "f4"
                                    ref.push(parent.f4)
                                 when "f5"
                                    ref.push(parent.f5)
                                 when "l0"
                                    ref.push(parent.l0)
                                 when "l1"
                                    ref.push(parent.l1)
                                 when "l2"
                                    ref.push(parent.l2)
                                 when "l3"
                                    ref.push(parent.l3)
                                 when "l4"
                                    ref.push(parent.l4)
                                 when "l5"
                                    ref.push(parent.l5)
                                 when "l6"
                                    ref.push(parent.l6)
                                 when "l7"
                                    ref.push(parent.l7)
                                 when "l8"
                                    ref.push(parent.l8)
                                 when "l9"
                                    ref.push(parent.l9)
                                 when "l10"
                                    ref.push(parent.l10)
                                 when "l11"
                                    ref.push(parent.l11)
                                 when "p0"
                                    ref.push(parent.p0)
                                 when "p1"
                                    ref.push(parent.p1)
                                 when "p2"
                                    ref.push(parent.p2)
                                 when "p3"
                                    ref.push(parent.p3)
                                 when "p4"
                                    ref.push(parent.p4)
                                 when "p5"
                                    ref.push(parent.p5)
                                 when "p6"
                                    ref.push(parent.p6)
                                 when "p7"
                                    ref.push(parent.p7)
                              end
                        end
                     else
                        # on the row row
                     end
                     # TODO todo object creation after the point reference thing is sorted out
                     # puts "#{onobj} on #{obj} is referenced to #{onrefobj} on #{refobj}"
                  end
               end
            end
         end
      end
      referencestring = "ref(s): #{csys.info[2]}, "
      ref.each do |references|
         if references.info[0] == references.info[1]
            referencestring += "#{references.info[2]}, "
         else
            referencestring += "#{references.info[0].info[2]}.#{references.info[2]}, "
         end
      end
      referencestring.chop!
      referencestring.chop!
      referencestring += " \t\t"
      print referencestring
      return csys, ref
   end
   print "\nBegin parsing table: "
   (0..MAX_ROW-1).each do |row|
      flag01 = false
      # temporary disable rescue 
      # begin
      cell01 = @table.getItemText(row, 0)
      case cell01[0,1]
         # Create radius on a line.
         when "r"
            print "\nradius: \t"
            csys, ref = refinfo(row, @objects)
            raise if ref.size > 7
            @createfutureline.setdefault
            table2modifyfutureline(row, @table, @createfutureline)
            @createfutureline.csys = csys
            @createfutureline.ref = ref.first
            onCreatefutureline
         when "c"
            # Create coordinate system.
            if cell01[0,2] == "cs"
               print "\ncsys: \t\t"
               flag01 = true
               @createcsys0p.setdefault
               table2csysdialog0p(row,@table,@createcsys0p)
               onCreatecsys
            else
               print "\ncube: \t\t"
               csys, ref = refinfo(row, @objects)
               # Create 6 face referenced cube.
               if ref.size == 6
                  @cubedialog6f.setdefault
                  @cubedialog6f.ref = ref
                  @cubedialog6f.selection = ref
                  @cubedialog6f.csys = csys
                  onCreatecube6f
               elsif ref.size == 2
                  @cubedialog2f.setdefault
                  @cubedialog2f.ref = ref
                  @cubedialog2f.selection = ref
                  @cubedialog2f.csys = csys
                  table2modifycube2f(row, @table, @cubedialog2f)
                  onCreatecube2f
               elsif ref.size == 1
                  # Create 1 face referenced cube.
                  if ref[0].class == InfoFace
                     @cubedialog1f.setdefault
                     @cubedialog1f.ref = ref[0]
                     @cubedialog1f.csys = csys
                     table2modifycube1f(row, @table, @cubedialog1f)
                     onCreatecube1f
                  # Create 1 point referenced cube.
                  elsif ref[0].class == InfoPoint
                     @cubedialog1p.setdefault
                     @cubedialog1p.ref = ref[0]
                     @cubedialog1p.csys = csys
                     table2modifycube1p(row, @table, @cubedialog1p)
                     onCreatecube1p
                  end
               end
            end
         # Create point.
         when "p"
            print "\npoint: \t\t"
            csys, ref = refinfo(row,@objects)
            raise if ref.size > 7
            @pointdialog.setdefault
            table2pointdialog(row,@table,@pointdialog)
            @pointdialog.ref = csys
            @pointdialog.selection = csys
            onCreatepoint
         when "l"
            print "\nline: \t\t"
            csys, ref = refinfo(row,@objects)
            raise if ref.size > 7
            # Create 1 point referenced line.
            if ref.size == 1
               @linedialog1p.setdefault
               table2modifyline1p(row, @table, @linedialog1p)
               @linedialog1p.csys = csys
               @linedialog1p.ref = ref.last
               onCreateline1p
            # Create 2 point referenced line.
            elsif ref.size == 2
               @linedialog2p.setdefault
               table2modifyline2p(row, @table, @linedialog2p)
               @linedialog2p.csys = csys
               @linedialog2p.ref = ref
               onCreateline2p
            else
               puts "something wrong with creation of line"
            end
            flag01 = true
         when "f"
            print "\nface: \t\t"
            csys, ref = refinfo(row, @objects)
            if cell01[0,2] != "ff"
            raise if ref.size > 7
            if ref.size == 1
               # Create 1 line referenced face.
               if ref.last.class == InfoLine || ref.last.class == DefLine
                  @facedialog1l.setdefault
                  table2modifyface1l(row, @table, @facedialog1l)
                  @facedialog1l.csys = csys
                  @facedialog1l.ref = ref.last
                  onCreateface1l
               # Create 1 point referenced face.
               elsif ref.last.class == InfoPoint
                  @facedialog1p.setdefault
                  table2modifyface1p(row, @table, @facedialog1p)
                  @facedialog1p.csys = csys
                  @facedialog1p.ref = ref.last
                  onCreateface1p
               end
            # Create 2 line referenced face.
            elsif ref.size == 2
               if ( ref.first.class == InfoLine || ref.first.class == DefLine ) &&
                  ( ref.last.class == InfoLine || ref.last.class == DefLine )
                  @facedialog2l.setdefault
                  table2modifyface2l(row, @table, @facedialog2l)
                  @facedialog2l.csys = csys
                  @facedialog2l.ref = ref
                  onCreateface2l
               end
            # Create 4 line referenced face.
            elsif ref.size == 4
               if ( ref[0].class == InfoLine || ref[0].class == DefLine ) &&
                  ( ref[1].class == InfoLine || ref[1].class == DefLine ) &&
                  ( ref[2].class == InfoLine || ref[2].class == DefLine ) &&
                  ( ref[3].class == InfoLine || ref[3].class == DefLine )
                  @facedialog4l.setdefault
                  @facedialog4l.csys = csys
                  @facedialog4l.ref = ref
                  onCreateface4l
               end
            end
         # Create 1 face referenced face.
         else
            @facedialog1f.setdefault
            table2modifyface1f(row, @table, @facedialog1f)
            @facedialog1f.selection = ref
            @facedialog1f.ref = ref
            onCreateface1f
         end
         # Create boundary condition.
         when "b"
            print "\nBC: \t\t"
            csys, ref = refinfo(row, @objects)
            case table2modifybctest(row, @table ).to_s
               when "INLET"
                  print "INLET "
                  @bcinletdialog.setdefault
                  @bcinletdialog.ref = ref
                  table2modifybcinlet( row, @table, @bcinletdialog )
                  onCreateInlet
               when "OUTLET"
                  print "OUTLET "
                  @bcoutletdialog.setdefault
                  @bcoutletdialog.ref = ref
                  table2modifybcoutlet( row, @table, @bcoutletdialog )
                  onCreateOutlet
            end
      end
??
      # rescue start
??
      end
      print "\n"
      # update the recursing InfoFace4l
      #updateface4l
      imeshtest 
      updateobjects
      $readfile = false
   end

I dont use this yet

[Source]

# File discretizer.rb, line 1602
   def deleteCasedir
      ashell = Shell.new
      rootdir = $globalworkdir
      casename1 = $gloablcasename
      begin
         FileUtils::cd(rootdir)
         puts "going to remove #{rootdir}/#{casename1}"
         FileUtils::rmdir(casename1)
      rescue
      end
   end

Export mesh

[Source]

# File discretizer.rb, line 1517
   def exportMesh
      getApp().beginWaitCursor()
      puts "Export of all cubes begins..."
      ashell = Shell.new
      $globalworkdir = ashell.expand_path(@openfoamdialog.workdir.text.to_s)
      $globalcasename = @openfoamdialog.casename.text.to_s
      # find openfoam boundary numbers
      #
      #   (0..$globalboundary.size-1).each do |tmp|
      #     $globalboundary[tmp].bcface = openfoambcno( $globalboundary[tmp].ref, @objects )
      #  end
      #
      #$globalface = 0
      #$globalvert = 0
      $globalinlet = Array.new
      $globalinletdata = Array.new
      $globaloutlet = Array.new
      $globaloutletdata = Array.new
      $globalboundary.each do |bctmp|
         if bctmp.bctype == "INLET"
            bc = openfoambcno(bctmp.ref,@objects)
            $globalinlet += bc
            bc.each do |idx|
               $globalinletdata[idx] = [ bctmp.xvel, bctmp.yvel, bctmp.zvel, bctmp.k, bctmp.epsilon]
            end
         elsif bctmp.bctype == "OUTLET"
            bc = openfoambcno(bctmp.ref,@objects)
            $globaloutlet += bc
            bc.each do |idx|
               $globaloutletdata[idx] = [ bctmp.p ]
            end
         end
      end
      @cubearray = Array.new
      @objects.objects.each do |tmp|
         if tmp.class.to_s[0,8] == "InfoCube"
            @cubearray.push(tmp)
         end
      end
      begin
         openfoamexport2(@cubearray, "filename")
         system("rm -rf #{$globalcasename}/100")
         system("transformPoints #{$globalworkdir} #{$globalcasename} -scale \"(#{0.001} #{0.001} #{0.001})\"")
         system("renumberMesh #{$globalworkdir} #{$globalcasename}")
      rescue
         writeCase
         openfoamexport2(@cubearray, "filename")
         system("transformPoints #{$globalworkdir} #{$globalcasename} -scale \"(#{0.001} #{0.001} #{0.001})\"")
         system("renumberMesh #{$globalworkdir} #{$globalcasename}")
      end
      getApp().endWaitCursor()
   end

[Source]

# File discretizer.rb, line 2404
def findcurrentobject(row,objectlist)
   objectlist.rows.each_with_index do |rows,index|
      if row == rows
            return objectlist.objects[index]
      end
   end
end

[Source]

# File discretizer.rb, line 2420
def findlower(selrow,table)
   if table.getItemText(selrow+1,0) == table.getItemText(selrow,0)
      selrow += 1
      selrow=findlower(selrow,table)
   end
   return selrow
end

table2meshref

 find object with certain name

[Source]

# File discretizer.rb, line 3705
   def findobj(name,objects)
      if name == "csys0"
         return $defaultcsys
      end
      objects.objects.each do |obj|
         if obj.info[2] == name
            return obj
         end
      end
   end

[Source]

# File discretizer.rb, line 2411
def findupper(selrow,table)
   if selrow > 0
      if table.getItemText(selrow-1,0) == table.getItemText(selrow,0)
         selrow -= 1
         selrow=findupper(selrow,table)
      end
    end
    return selrow
end

[Source]

# File discretizer.rb, line 2685
def getmeshnum(obj)
   if obj.info[0].class == InfoLine || obj.info[0].class == DefLine
      if obj.imesh == nil
         return obj.meshnum
      else
         return obj.imesh
      end
   elsif obj.info[0].class == InfoFace
      if obj.imesh == nil
         if obj.info[0].reftype == "1p" 
            if obj.info[2] == "l0" || obj.info[2] == "l2"
               return obj.info[0].meshx
            end
            if obj.info[2] == "l1" || obj.info[2] == "l3"
               return obj.info[0].meshy
            end
         elsif obj.info[0].reftype == "1l"
            if obj.info[2] == "l1" || obj.info[2] == "l3"
               return obj.info[0].meshnum
            end
         elsif obj.info[0].reftype == "2l"
            if obj.info[2] == "l1" || obj.info[2] == "l3"
               return obj.info[0].meshnum
            end
         end
      else
         return obj.imesh
      end
   elsif obj.info[0].class == InfoCube1p
      if obj.info[2] == "l0" || obj.info[2] == "l2" || obj.info[2] == "l10" || obj.info[2] == "l8" 
         return obj.info[0].meshx
      elsif obj.info[2] == "l1" || obj.info[2] == "l3" || obj.info[2] == "l9" || obj.info[2] == "l11" 
         return obj.info[0].meshy
      elsif obj.info[2] == "l4" || obj.info[2] == "l5" || obj.info[2] == "l6" || obj.info[2] == "l7" 
         return obj.info[0].meshz
      end
   elsif obj.info[0].class == InfoCube1f || obj.info[0].class == InfoCube2f
      if obj.info[2] == "l4" || obj.info[2] == "l5" || obj.info[2] == "l6" || obj.info[2] == "l7" 
         return obj.info[0].meshnum
      else
         return "unknown2"
      end
   else
      return "unknown"
   end
end

helper function to find how many refs

[Source]

# File discretizer.rb, line 778
      def getrefnum
         (@currentRefNum..MAX_COL-1).each do |col|
            if @table.getItemText(@currentRowNum, col) == ""
               return col
            end 
         end 
      end

[Source]

# File discretizer.rb, line 2538
   def iftobc(ifno)
      case ifno.to_s
         when "0" 
            return 4
         when "1" 
            return 2 
         when "2" 
            return 1
         when "3"
            return 3
         when "4" 
            return 0
         when "5" 
            return 5 
      end
   end

[Source]

# File discretizer.rb, line 2868
def imeshtest
   $deep = 0
   $globalobjects.each do |obj|
      removeimesh(obj)
   end
   $globalobjects.each do |obj|
      #puts "setchild processing #{obj.info[0].info[2]}.#{obj.info[2]}"
      setchild(obj, nil)
   end
#=begin
   @selbuffer.each do |obj|
      begin
         puts "#{obj.info[0].info[2]}.#{obj.info[2]} has imesh value #{obj.imesh}"
      rescue
         puts "no imesh for #{obj.info[0].info[2]}.#{obj.info[2]}"
      end
   end
#=end
end

Load the named PNG icon from a file

[Source]

# File discretizer.rb, line 92
   def loadIcon(filename)
      begin
         filename = File.join("icons", filename) + ".png"
         icon = nil
         File.open(filename, "rb") { |f|
         icon = FXPNGIcon.new(getApp(), f.read)
         }
         icon
      rescue
         raise RuntimeError, "Couldn't load icon: #{filename}"
      end
   end

[Source]

# File discretizer.rb, line 2025
def onBlockModify
  if @selbuffer[0].class == InfoLine
      @modifyblock.selection = @selbuffer
      table2blockdialog(@modifyblock.selection[0].info[1].row, @modifyblock, @table)
      @modifyblock.okButton.setDefault
      @modifyblock.okButton.setFocus 
      @modifyblock.show(PLACEMENT_CURSOR)
  else
     FXMessageBox.information(self,MBOX_OK,"Information",
        "There is currently nothing selected\nPlease try again")
  end 
end

[Source]

# File discretizer.rb, line 1582
   def onCmdExport(sender, sel, ptr)
      exportMesh
   end

export first cube

[Source]

# File discretizer.rb, line 1570
   def onCmdExport1(sender, sel, ptr)
      puts "export of first cube begins"
      @flag = true
      @objects.objects.each do |tmp|
         if tmp.class == InfoCube6f
            if @flag
               openfoamexport(tmp.if, "filename")
               @flag = false
            end
         end
      end
   end

open file

[Source]

# File discretizer.rb, line 1381
   def onCmdNew(sender, sel, ptr)
      getApp().beginWaitCursor()
      # clear the table
      #(0..MAX_ROW-1).each do |row|
      #   (0..MAX_COL-1).each do |col|
      #      @table.setItemText(row, col, "")
      #   end
      #end
      unselectall
      # clear and reset objects
      #@objects.objects.each do |obj|
      startover 
      # insert the default csys to the InfoList
      @filename = $defaults['defaultfilename']
      @filenameset = false
      getApp().endWaitCursor()
   end

[Source]

# File discretizer.rb, line 1416
   def onCmdOpen(sender, sel, ptr)
      dlg = FXFileDialog.new(self, "Open file")
      dlg.selectMode = SELECTFILE_EXISTING
      dlg.setPatternList([
         "Discretizer Files (*.[Dd][Tt][Zz])",
         "CSV table (*.[Cc][Ss][Vv])",
         "All Files (*)"])
      dlg.filename = @filename
      if dlg.execute() != 0
         # Set wait cursor
         getApp().beginWaitCursor()
         maxrow = MAX_ROW - 1
         maxcol = MAX_COL - 1
         startover
         infile = File.open(dlg.filename,"r").read
         @table.overlayText(0 , maxrow , 0 , maxcol ,infile , cs=";", rs="\n", notify = false)
         time1 = Benchmark.measure {
            createfromtable
         }
         puts "File read #{time1.total} s"
         @viewer.handle(self,MKUINT(FXGLViewer::ID_RESETVIEW,SEL_COMMAND) , nil)
         getApp().endWaitCursor()
         #puts "currentRowNum #{@currentRowNum}, currentRefNum #{@currentRefNum}"
         @filename = dlg.filename 
         @filenameset = true
      end
      return 1
   end

[Source]

# File discretizer.rb, line 1398
   def onCmdOpenPolymesh(sender, sel, ptr)
      dlg = FXDirDialog.new(self, "Open PolyMesh file")
      if dlg.execute() != 0
         puts "Begin reading of #{dlg.directory}"
         method(:onCmdNew)
         getApp().beginWaitCursor()
         startover
         begin
         readpolymesh( dlg.directory )
         @viewer.handle(self,MKUINT(FXGLViewer::ID_RESETVIEW,SEL_COMMAND) , nil)
         rescue
            puts "Please select the root dir, not the polymesh folder"
         end
         puts "Read of #{dlg.directory} finished"
         getApp().endWaitCursor()
      end
      return 1
   end

save to file

[Source]

# File discretizer.rb, line 1486
   def onCmdSave(sender, sel, ptr)
      if !@filenameset
         return onCmdSaveAs(sender, sel, ptr)
      end
      saveFile(@filename)
      return 1
   end

[Source]

# File discretizer.rb, line 1494
   def onCmdSaveAs(sender, sel, ptr)
      saveDialog = FXFileDialog.new(self, "Save file")
      saveDialog.setPatternList([
         "Discretizer Files (*.[Dd][Tt][Zz])",
         "CSV table (*.[Cc][Ss][Vv])",
         "All Files (*)" ])
      if saveDialog.execute() != 0
         file = saveDialog.filename

         if File.exists?(file)
            if MBOX_CLICKED_NO == FXMessageBox.question(self, MBOX_YES_NO,
               "Overwrite Document", "Overwrite existing document: #{file}?")
               return 1
            end
         end
         saveFile(file)
      end
      return 1
   end

update selected

[Source]

# File discretizer.rb, line 1686
   def onCmdUpdate(sender, sel, ptr)
      if @selbuffer.size > 0
      @selbuffer.each do |tmp|
         begin
            tmp.update
         rescue
            puts " update failed "
         end
      end
      else
         updateobjects
      end
      $globalviewer.update
   end

write and run button

[Source]

# File discretizer.rb, line 1673
   def onCmdWriteAndRun(sender, sel, ptr)
      removeData100
      writeCase
      exportMesh
      runSimpleFoam     
   end

write case button

[Source]

# File discretizer.rb, line 1586
   def onCmdWriteCase(sender, sel, ptr)
      writeCase
   end

[Source]

# File discretizer.rb, line 1279
      def onCreateInlet
         getApp().beginWaitCursor()
         @bcinletdialog.hide
         unselectall
         bc = OpenFoamBoundary.new("INLET", @bcinletdialog.xvel.text.to_f, @bcinletdialog.yvel.text.to_f, @bcinletdialog.zvel.text.to_f, 
            @bcinletdialog.turbk.text.to_f, @bcinletdialog.turbepsilon.text.to_f)
         bc.ref = @bcinletdialog.ref
         $globalboundary.push(bc)
         if !$readfile
            write2table(@table, @currentRowNum, bc)
         else
            bc.row = @currentRowNum
         end
         writeref(bc) if !$readfile
         @objects.insert(bc.row, bc)
         @currentRowNum += 1
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 1297
      def onCreateOutlet
         getApp().beginWaitCursor()
         @bcoutletdialog.hide
         unselectall
         bc = OpenFoamBoundary.new("OUTLET", @bcoutletdialog.pressure.text.to_f)
         bc.ref = @bcoutletdialog.ref
         $globalboundary.push(bc)
         if !$readfile
            write2table(@table, @currentRowNum, bc)
         else
            bc.row = @currentRowNum
         end
         writeref(bc) if !$readfile
         @objects.insert(bc.row, bc)
         @currentRowNum += 1
         getApp().endWaitCursor()
      end

Create coordinate system

[Source]

# File discretizer.rb, line 807
      def onCreatecsys
         beforeobjcreate(@createcsys0p)
         # create a coordinate system in viewer and table
         csys = Csys.new(@createcsys0p.xpos.text.to_f,
                         @createcsys0p.ypos.text.to_f, 
                         @createcsys0p.zpos.text.to_f, 
                         @createcsys0p.xrot.text.to_f, 
                         @createcsys0p.yrot.text.to_f, 
                         @createcsys0p.zrot.text.to_f, 
                         @createcsys0p.csystype.value,
                         @createcsys0p.size.text.to_f)
         afterobjcreate(csys)
      end

connect box dialog ok button create cube. Unused method.

[Source]

# File discretizer.rb, line 1257
      def onCreatecube
         puts "onCreatecube this is not used currently"
      end

[Source]

# File discretizer.rb, line 1086
      def onCreatecube1f
         beforeobjcreate(@cubedialog1f)
         #meshtmp = {"meshnum" => @cubedialog1f.meshnum.text }
         #if $meshref[@currentRowNum].size > 0
         #   meshtmp[ $meshref[@currentRowNum][2] ] = @objects.objonrow( $meshref[@currentRowNum][0] ).reflist[ $meshref[@currentRowNum][1] ]
         #end
         # 6 attributes
         cube = InfoCube1f.new("1f",@cubedialog1f.csys, @cubedialog1f.ref, @currentRowNum, 
            @cubedialog1f.xvec.text.to_f,
            @cubedialog1f.yvec.text.to_f,
            @cubedialog1f.zvec.text.to_f,
            @cubedialog1f.meshnum.text.to_i)
            ###meshtmp["meshnum"] )
         # cube.meshnum = @cubedialog1p.meshnum.text.to_i
         # puts "xvec #{@cubedialog1f.xvec}, yvec #{@cubedialog1f.yvec}, zvec #{@cubedialog1f.zvec}" 
         afterobjcreate(cube)
      end

[Source]

# File discretizer.rb, line 1263
      def onCreatecube1p
         # puts "create 1p cube"
         beforeobjcreate(@cubedialog1p)
         #meshtmp = {"meshx" => @cubedialog1p.meshx.text, "meshy" => @cubedialog1p.meshy.text,"meshz" => @cubedialog1p.meshz.text}
         #if $meshref[@currentRowNum].size > 0
         #   meshtmp[ $meshref[@currentRowNum][2] ] = @objects.objonrow( $meshref[@currentRowNum][0] ).reflist[ $meshref[@currentRowNum][1] ]
         #end
         #cube = InfoCube1p.new("1p", @cubedialog1p.csys, @cubedialog1p.ref, @currentRowNum, @cubedialog1p.xlength.text, @cubedialog1p.ylength.text, @cubedialog1p.zlength.text,
         #   meshtmp["meshx"], meshtmp["meshy"], meshtmp["meshz"] )
         cube = InfoCube1p.new("1p", @cubedialog1p.csys, @cubedialog1p.ref, @currentRowNum, @cubedialog1p.xlength.text, @cubedialog1p.ylength.text, @cubedialog1p.zlength.text,
            @cubedialog1p.meshx.text, @cubedialog1p.meshy.text, @cubedialog1p.meshz.text) 
         afterobjcreate(cube)
      end

[Source]

# File discretizer.rb, line 1106
      def onCreatecube2f
         beforeobjcreate(@cubedialog2f)
         # 6 attributes
         cube = InfoCube2f.new("2f",@cubedialog2f.csys, @cubedialog2f.ref, @currentRowNum, 
            @cubedialog2f.twist.text.to_i,
            @cubedialog2f.flipdir.text.to_i,
            @cubedialog2f.meshnum.text.to_i)
         afterobjcreate(cube)
      end

[Source]

# File discretizer.rb, line 1118
      def onCreatecube6f
         beforeobjcreate(@cubedialog6f)
         #text = "Create cube from: "
         #@cubedialog6f.selection.each do |tmp|
         #   text += "#{tmp.info[0].to_s}, "
         #end
         #puts text
         cube = InfoCube6f.new("6f",@cubedialog6f.csys, @cubedialog6f.selection)

         afterobjcreate(cube)
      end

[Source]

# File discretizer.rb, line 1051
      def onCreateface1f
         # when the face on face is going to be created it would be nice if
         # the referenced face is not created, just the surrounding lines.
         # Also its a problem when more than one face is created on the referenced face
         # then the face mesh should be created in the end. Or if the face class is made so
         # that it can use the future created faces as input before any face mesh is made.
         # The face on  face is then considered as a future ref object. I think right now.
         # When a real face is created it looks for future references and use them as input.
         # 
         # FaceDialog1f xlength ylength refattr xpos ypos
         #
         beforeobjcreate(@facedialog1f)
         @faceref = @facedialog1f.selection.last
         # parent, xlength, ylength, xpos, ypos, refattr
         puts @faceref
         puts @facedialog1f.xlength.text
         puts @facedialog1f.ylength.text
         puts @facedialog1f.xpos.text
         puts @facedialog1f.ypos.text
         puts @facedialog1f.refattr.text
         faceface = FutureFace.new(@faceref, @facedialog1f.xlength.text.to_f, @facedialog1f.ylength.text.to_f,
            @facedialog1f.xpos.text.to_f, @facedialog1f.ypos.text.to_f, @facedialog1f.refattr.text.to_i, @facedialog1f.adjust )
         # puts "adjust value #{@facedialog1f.adjust}, class #{@facedialog1f.adjust.class}" 
         afterobjcreate(faceface)
         # is createfaceface going to create a new class? (FutureRef?)
         #tmp.createfaceface(@facedialog1f.xlength.text.to_f,@facedialog1f.ylength.text.to_f,@facedialog1f.refattr.text,
         #                   @facedialog1f.xpos.text.to_f,@facedialog1f.ypos.text.to_f)
         # tmp.externref = true
         # puts "face on face is going to be created"
         @faceref.recreate
         #updateobjects
      end

[Source]

# File discretizer.rb, line 999
      def onCreateface1l
         beforeobjcreate(@facedialog1l)
         # 6 attributes
         face = InfoFace.new("1l",@facedialog1l.csys, @facedialog1l.ref, nil, nil, @currentRowNum, 
            @facedialog1l.xvec.text.to_f,
            @facedialog1l.yvec.text.to_f,
            @facedialog1l.zvec.text.to_f,
            @facedialog1l.meshnum.text.to_i)
         afterobjcreate(face)
      end

[Source]

# File discretizer.rb, line 980
      def onCreateface1p
         beforeobjcreate(@facedialog1p)
         # create line in viewer and table 
         #line = InfoLine.new(@selbuffer[0],@selbuffer[0])
         # InfoLine.new(refs, refattr, xlength, ylength, xnorm, ynorm, znorm) 8 arg reftype 1p
         #
         #    def initialize2(reftype, csys, ref, parent, info, *args)
         #
         face = InfoFace.new("1p", @facedialog1p.csys, @facedialog1p.ref, nil, nil, @currentRowNum, 
            @facedialog1p.xlength.text.to_f,
            @facedialog1p.ylength.text.to_f,
            @facedialog1p.plane,
            @facedialog1p.meshx.text.to_i,
            @facedialog1p.meshy.text.to_i)
         afterobjcreate(face)
      end

[Source]

# File discretizer.rb, line 1013
      def onCreateface2l
         beforeobjcreate(@facedialog2l)
         # input rownum in initialization
         face = InfoFace.new("2l",@facedialog2l.csys, @facedialog2l.ref, nil, nil, @currentRowNum, 
            @facedialog2l.meshnum.text.to_i, @facedialog2l.flipdir.to_i )
         afterobjcreate(face)
      end

[Source]

# File discretizer.rb, line 1024
      def onCreateface2lconn
         beforeobjcreate(@facedialog2lconn)
         face = InfoFace.new("2lconn",@facedialog2lconn.csys, @facedialog2lconn.ref, nil, nil, @currentRowNum)
         afterobjcreate(face)
      end

[Source]

# File discretizer.rb, line 1033
      def onCreateface3l
         beforeobjcreate(@facedialog3l)
         face = InfoFace.new("3l",@facedialog3l.csys, @facedialog3l.ref, nil, nil, @currentRowNum)
         afterobjcreate(face)
      end

[Source]

# File discretizer.rb, line 1042
      def onCreateface4l
         beforeobjcreate(@facedialog4l)
         face = InfoFace.new("4l",@facedialog4l.csys, @facedialog4l.ref, nil, nil, @currentRowNum)
         afterobjcreate(face)
      end

[Source]

# File discretizer.rb, line 964
      def onCreatefutureline
         beforeobjcreate(@createfutureline)
         # FutureLine.new( 6 args )
         radline = FutureRadius.new("line", @createfutureline.csys, @createfutureline.ref, @createfutureline.ref,
            @createfutureline.radius.text.to_f, 
            @createfutureline.xaxis, @createfutureline.yaxis, @createfutureline.zaxis,
            @createfutureline.axis, 
            @createfutureline.refattr.text.to_i)
         @createfutureline.ref.info[1].futureref = radline
         @createfutureline.ref.info[1].futurerefed = true
         afterobjcreate(radline)
         radline.parent.update
      end

[Source]

# File discretizer.rb, line 884
      def onCreateline1p
         beforeobjcreate(@linedialog1p)
         # create line in viewer and table
         # InfoLine.new 5 arg init reftype 1p
         # new initialization:
         # line = InfoLine.new("1p", @linedialog1p.selection.csys, @linedialog1p.selection, ..args..)
         # args should be xvec, yvec, zvec, meshnum?
         #
         # def initialize2(reftype, csys, ref, parent, info, *args)
         #
         # puts "csys #{@linedialog1p.csys} meshnum #{@linedialog1p.meshnum}"
         line = InfoLine.new("1p",@linedialog1p.csys, @linedialog1p.ref, nil, nil,
            @linedialog1p.xvec.text.to_f,
            @linedialog1p.yvec.text.to_f,
            @linedialog1p.zvec.text.to_f,@linedialog1p.meshnum.text.to_i)
         afterobjcreate(line)
      end

[Source]

# File discretizer.rb, line 938
      def onCreateline2p
         beforeobjcreate(@linedialog2p)
         # create line in viewer and table 
         #line = InfoLine.new(@selbuffer[0],@selbuffer[0])
         # InfoLine.new(refs, refattr, xvec, yvec, zvec, radius, xaxis, yaxis, zaxis)
         # InfoLine.new 9 arg init reftype 2p
         line = InfoLine.new("2p", @linedialog2p.csys, @linedialog2p.ref, nil, nil,
            @linedialog2p.meshnum.text.to_i, @linedialog2p.flipdir.to_i)
         afterobjcreate(line)
      end

[Source]

# File discretizer.rb, line 856
      def onCreatepoint
         beforeobjcreate(@pointdialog)
         # create point in viewer and table 
         vertex = InfoPoint.new(@pointdialog.selection, @pointdialog.xpos.text.to_f,
            @pointdialog.ypos.text.to_f,
            @pointdialog.zpos.text.to_f)
         afterobjcreate(vertex)
      end

[Source]

# File discretizer.rb, line 1763
   def onCsysCreate
      @createcsys0p.csystype.handle(self, MKUINT(FXDataTarget::ID_OPTION + 0, SEL_COMMAND), nil)
      @createcsys0p.okButton.setDefault
      @createcsys0p.okButton.setFocus
      @createcsys0p.show(PLACEMENT_CURSOR)
   end

[Source]

# File discretizer.rb, line 1917
def onCubeCreate
   # extract selected csys
   csystmp, reftmp = getcsys(@selbuffer)
   #if @selbuffer.size == 1 && @selbuffer.last.class == InfoPoint
   if reftmp.size == 1 && reftmp.last.class == InfoPoint
      @cubedialog1p.selection = reftmp.last
      @cubedialog1p.ref = reftmp.last
      @cubedialog1p.okButton.setDefault
      @cubedialog1p.okButton.setFocus
      @cubedialog1p.csys = csystmp
      if reftmp.last.info[0] == reftmp.last.info[1]
         text = reftmp.last.info[2]
      else
         text = "#{reftmp.last.info[0].info[2]}.#{reftmp.last.info[2]}"
      end
      @cubedialog1p.reftext.text = "#{csystmp.info[2]}, #{text}"
      @cubedialog1p.show(PLACEMENT_CURSOR)
   elsif reftmp.size == 1 && reftmp[0].class == InfoFace
      @cubedialog1f.selection = reftmp[0]
      @cubedialog1f.ref = reftmp[0]
      @cubedialog1f.okButton.setDefault
      @cubedialog1f.okButton.setFocus
      @cubedialog1f.csys = csystmp
      if reftmp.last.info[0] == reftmp.last.info[1]
         text = reftmp.last.info[2]
      else
         text = "#{reftmp.last.info[0].info[2]}.#{reftmp.last.info[2]}"
      end
      @cubedialog1f.reftext.text = "#{csystmp.info[2]}, #{text}"
      @cubedialog1f.show(PLACEMENT_CURSOR)
   elsif reftmp.size == 2 && reftmp[0].class == InfoFace && reftmp[1].class == InfoFace
      @cubedialog2f.selection = reftmp
      @cubedialog2f.ref = reftmp
      @cubedialog2f.okButton.setDefault
      @cubedialog2f.okButton.setFocus
      @cubedialog2f.csys = csystmp
      if reftmp.last.info[0] == reftmp.last.info[1]
         text = reftmp.last.info[2]
      else
         text = "#{reftmp.last.info[0].info[2]}.#{reftmp.last.info[2]}"
      end
      @cubedialog2f.reftext.text = "#{csystmp.info[2]}, #{text}"
      @cubedialog2f.show(PLACEMENT_CURSOR)
   elsif reftmp.size == 6 && (reftmp[0].class == InfoFace && reftmp[1].class == InfoFace && reftmp[2].class == InfoFace &&
                              reftmp[3].class == InfoFace && reftmp[4].class == InfoFace && reftmp[5].class == InfoFace )
      puts "create volume"
      @cubedialog6f.csys = csystmp
      @cubedialog6f.selection = reftmp
      text = ""
      @cubedialog6f.selection.each do |tmp|
         text += ", #{tmp.info[2].to_s}"
      end
      @cubedialog6f.reftext.text = @cubedialog6f.csys.info[2].to_s + text 
      @cubedialog6f.okButton.setDefault
      @cubedialog6f.okButton.setFocus
      @cubedialog6f.show(PLACEMENT_CURSOR)
   else
      FXMessageBox.information(self,MBOX_OK,"Information",
         "Reference is needed for cubes.\nSelect 1 point, 1 line or 1-6 faces.")
   end 
end

[Source]

# File discretizer.rb, line 1815
def onFaceCreate
   # extract selected csys
   csystmp, reftmp = getcsys(@selbuffer)
   if reftmp.size == 1 && reftmp.first.class == InfoPoint
      @facedialog1p.csys = csystmp
      @facedialog1p.ref = reftmp.first
      @facedialog1p.reftext.text = "#{@facedialog1p.csys.info[2].to_s}, #{@facedialog1p.ref.info[2].to_s}"
      @facedialog1p.okButton.setDefault
      @facedialog1p.okButton.setFocus
      @facedialog1p.show(PLACEMENT_CURSOR)
   elsif reftmp.size == 1 && (reftmp.first.class == InfoLine || reftmp.first.class == DefLine)
      @facedialog1l.csys = csystmp
      @facedialog1l.selection = @selbuffer
      @facedialog1l.ref = reftmp.first
      if @facedialog1l.ref.class == DefLine
         @facedialog1l.reftext.text = "#{@facedialog1l.csys.info[2].to_s}, #{@facedialog1l.ref.info[0].info[2].to_s}.#{@facedialog1l.ref.info[2]}"
      else
         @facedialog1l.reftext.text = "#{@facedialog1l.csys.info[2].to_s}, #{@facedialog1l.ref.info[2].to_s}"
      end
      @facedialog1l.okButton.setDefault
      @facedialog1l.okButton.setFocus
      @facedialog1l.show(PLACEMENT_CURSOR)
   elsif reftmp.size == 1 && reftmp.first.class == InfoFace
      @facedialog1f.selection = @selbuffer
      @facedialog1f.ref = reftmp.first
      @facedialog1f.reftext.text = "#{@facedialog1f.ref.info[2].to_s}"
      @facedialog1f.okButton.setDefault
      @facedialog1f.okButton.setFocus
      @facedialog1f.show(PLACEMENT_CURSOR)
   elsif reftmp.size == 2 && 
         ( reftmp.first.class ==  InfoLine || reftmp.first.class ==  DefLine ) &&
         ( reftmp.last.class  ==  InfoLine || reftmp.last.class  ==  DefLine  )
      test = test2lconn(reftmp.first, reftmp.last)
      if test
         puts "2lconn"
         @facedialog2lconn.selection = @selbuffer
         @facedialog2lconn.ref = reftmp
         @facedialog2lconn.csys = csystmp
         text0 = @facedialog2lconn.csys.info[2].to_s
         text1 = @facedialog2lconn.ref[0].info[0].info[2].to_s + "." + @facedialog2lconn.ref[0].info[2].to_s
         text2 = @facedialog2lconn.ref[1].info[0].info[2].to_s + "." + @facedialog2lconn.ref[1].info[2].to_s
         @facedialog2lconn.reftext.text = text0 + ", " + text1 + ", " + text2
         @facedialog2lconn.okButton.setDefault
         @facedialog2lconn.okButton.setFocus
         @facedialog2lconn.show(PLACEMENT_CURSOR)
      else
         @facedialog2l.selection = @selbuffer
         @facedialog2l.ref = reftmp
         @facedialog2l.csys = csystmp
         text0 = @facedialog2l.csys.info[2].to_s
         if @facedialog2l.ref[0].class == DefLine
            text1 = @facedialog2l.ref[0].info[0].info[2].to_s + "." + @facedialog2l.ref[0].info[2].to_s
         else
            text1 = @facedialog2l.ref[0].info[2].to_s 
         end
         if @facedialog2l.ref[1].class == DefLine
            text2 = @facedialog2l.ref[1].info[0].info[2].to_s + "." + @facedialog2l.ref[1].info[2].to_s
         else
            text2 = @facedialog2l.ref[1].info[2].to_s 
         end
         @facedialog2l.reftext.text = text0 + ", " + text1 + ", " + text2 
         @facedialog2l.okButton.setDefault
         @facedialog2l.okButton.setFocus
         @facedialog2l.show(PLACEMENT_CURSOR)
      end
   elsif reftmp.size == 3 && 
         ( reftmp[0].class ==  DefLine  || reftmp[0].class ==  InfoLine ) &&
         ( reftmp[1].class ==  DefLine  || reftmp[1].class ==  InfoLine ) &&
         ( reftmp[2].class ==  DefLine  || reftmp[2].class ==  InfoLine )
      @facedialog3l.selection = @selbuffer
      @facedialog3l.ref = reftmp
      @facedialog3l.csys = csystmp
      text0 = @facedialog3l.csys.info[2].to_s
      text1 = @facedialog3l.ref[0].info[0].info[2].to_s + "." + @facedialog3l.ref[0].info[2].to_s
      text2 = @facedialog3l.ref[1].info[0].info[2].to_s + "." + @facedialog3l.ref[1].info[2].to_s
      text3 = @facedialog3l.ref[2].info[0].info[2].to_s + "." + @facedialog3l.ref[2].info[2].to_s
      @facedialog3l.reftext.text = text0 + ", " + text1 + ", " + text2 + ", " + text3
      @facedialog3l.okButton.setDefault
      @facedialog3l.okButton.setFocus
      @facedialog3l.show(PLACEMENT_CURSOR)
   elsif reftmp.size == 4 && 
         ( reftmp[0].class ==  DefLine  || reftmp[0].class ==  InfoLine ) &&
         ( reftmp[1].class ==  DefLine  || reftmp[1].class ==  InfoLine ) &&
         ( reftmp[2].class ==  DefLine  || reftmp[2].class ==  InfoLine ) &&
         ( reftmp[3].class ==  InfoLine || reftmp[3].class ==  DefLine  )
      @facedialog4l.selection = @selbuffer
      @facedialog4l.ref = reftmp
      @facedialog4l.csys = csystmp
      text0 = @facedialog4l.csys.info[2].to_s
      text1 = @facedialog4l.ref[0].info[0].info[2].to_s + "." + @facedialog4l.ref[0].info[2].to_s
      text2 = @facedialog4l.ref[1].info[0].info[2].to_s + "." + @facedialog4l.ref[1].info[2].to_s
      text3 = @facedialog4l.ref[2].info[0].info[2].to_s + "." + @facedialog4l.ref[2].info[2].to_s
      text4 = @facedialog4l.ref[3].info[0].info[2].to_s + "." + @facedialog4l.ref[3].info[2].to_s
      @facedialog4l.reftext.text = text0 + ", " + text1 + ", " + text2 + ", " + text3 + ", " + text4 
      @facedialog4l.okButton.setDefault
      @facedialog4l.okButton.setFocus
      @facedialog4l.show(PLACEMENT_CURSOR)
   else
      FXMessageBox.information(self,MBOX_OK,"Information",
         "Reference is needed for faces.\nSelect 1 point, 1 face or 1-4 lines.")
   end 
end

[Source]

# File discretizer.rb, line 2512
def onHideSelected
   begin
   @selbuffer.each do |selected|
      selected.visible ? selected.hide: nil 
   end
   rescue
      FXMessageBox.information(self,MBOX_OK,"Information",
         "Hide selected failed for some reason")
      return 0
   end
   @viewer.update
end

[Source]

# File discretizer.rb, line 2555
def onInletCreate
   #@result = openfoambcno(@selbuffer, @objects)
   #string = "Created inlet on face no: "
   #@result.each do |tmp|
   #   string += "#{tmp}, "
   #end
   #unselectall
   #FXMessageBox.information(self, MBOX_OK, "Info", string)
   tmpface = getfaces(@selbuffer)
   string = ""
   if tmpface != nil
      tmpface.each do |tmp|
         if tmp.info[0] == tmp.info[1]
            # only if viewerobj and parent are the same
            string += ", #{tmp.info[2].to_s}"
         else
            # this should be if the face is contained in a cube
            string += ", #{tmp.info[0].info[2]}.#{tmp.info[2].to_s}"
         end
      end
      @bcinletdialog.ref = tmpface
      @bcinletdialog.reftext.text = string[2,string.length]
      # calculate the normal on the first face
      xnorm1, ynorm1, znorm1 = faceNormal( tmpface[0] )
      @bcinletdialog.xvec.text = xnorm1.to_s
      @bcinletdialog.yvec.text = ynorm1.to_s
      @bcinletdialog.zvec.text = znorm1.to_s
      @bcinletdialog.okButton.setDefault
      @bcinletdialog.okButton.setFocus
      @bcinletdialog.show(PLACEMENT_CURSOR)
   else
      FXMessageBox.information(self,MBOX_OK,"Information", "Reference is needed for boundaries.\nSelect one or more faces.")
   end
end

[Source]

# File discretizer.rb, line 1780
   def onLineCreate
      # extract selected csys
      csystmp, reftmp = getcsys(@selbuffer)
      if reftmp.size == 1 && reftmp[0].class == InfoPoint
         @linedialog1p.csys = csystmp
         @linedialog1p.ref = reftmp[0]
         @linedialog1p.selection = @selbuffer
         @linedialog1p.reftext.text = "#{@linedialog1p.csys.info[2].to_s}, #{@linedialog1p.ref.info[2].to_s}"
         @linedialog1p.okButton.setDefault
         @linedialog1p.okButton.setFocus
         @linedialog1p.show(PLACEMENT_CURSOR)
      elsif reftmp.size == 2 && reftmp[0].class == InfoPoint && reftmp[1].class == InfoPoint
         @linedialog2p.csys = csystmp
         @linedialog2p.ref = reftmp
         @linedialog2p.selection = @selbuffer
         @linedialog2p.reftext.text = "#{@linedialog2p.csys.info[2].to_s}, #{@linedialog2p.ref[0].info[2].to_s}, #{@linedialog2p.ref[1].info[2].to_s}"
         @linedialog2p.okButton.setDefault
         @linedialog2p.okButton.setFocus
         @linedialog2p.show(PLACEMENT_CURSOR)
      else
         FXMessageBox.information(self,MBOX_OK,"Information",
            "Reference is needed for lines.\nSelect 1 or 2 points")
      end
??
end

[Source]

# File discretizer.rb, line 2042
def onModify
   if @selbuffer.size < 1 
      return 0
   end
   if @selbuffer.last.info[0].class == InfoCube1p
      puts "modify cube"
      @modifycube1p.setdefault
      @modifycube1p.selection = @selbuffer.last.info[0]
      @modifycube1p.csys = @modifycube1p.selection.csys
      @modifycube1p.ref = @modifycube1p.selection.ref
      table2modifycube1p(@modifycube1p.selection.row.to_i, @table, @modifycube1p)
      # point could be from a higher level object
      @modifycube1p.reftext.text = "#{@modifycube1p.csys.info[2].to_s}, #{@modifycube1p.ref.info[2].to_s}"
      @modifycube1p.show(PLACEMENT_SCREEN)
      @modifycube1p.okButton.setDefault
      @modifycube1p.okButton.setFocus
   elsif @selbuffer.last.info[0].class == InfoCube1f
      puts "modify cube 1f"
      @modifycube1f.setdefault
      @modifycube1f.selection = @selbuffer.last.info[0]
      @modifycube1f.csys = @modifycube1f.selection.csys
      @modifycube1f.ref = @modifycube1f.selection.ref
      table2modifycube1f(@modifycube1f.selection.row.to_i, @table, @modifycube1f)
      @modifycube1f.reftext.text = "#{@modifycube1f.csys.info[2].to_s}, #{@modifycube1f.ref.info[0].info[2].to_s}.#{@modifycube1f.ref.info[2].to_s}"
      @modifycube1f.show(PLACEMENT_SCREEN)
      @modifycube1f.okButton.setDefault
      @modifycube1f.okButton.setFocus
   elsif @selbuffer.last.info[0].class == InfoCube2f
      puts "modify cube 2f"
      @modifycube2f.setdefault
      @modifycube2f.selection = @selbuffer.last.info[0]
      @modifycube2f.csys = @modifycube2f.selection.csys
      @modifycube2f.ref = @modifycube2f.selection.ref
      table2modifycube2f(@modifycube2f.selection.row.to_i, @table, @modifycube2f)
      @modifycube2f.reftext.text = "#{@modifycube2f.csys.info[2].to_s}, #{
              @modifycube2f.ref[0].info[0].info[2].to_s}.#{@modifycube2f.ref[0].info[2].to_s}, #{
              @modifycube2f.ref[1].info[0].info[2].to_s}.#{@modifycube2f.ref[1].info[2].to_s}"
      @modifycube2f.show(PLACEMENT_SCREEN)
      @modifycube2f.okButton.setDefault
      @modifycube2f.okButton.setFocus
   elsif @selbuffer.last.class == Csys
      if @selbuffer.last.info[2].to_s == "csys0"
         @modifycsysdefault.selection = @selbuffer
         @modifycsysdefault.size.text = @modifycsysdefault.selection.last.size.to_s
         @modifycsysdefault.okButton.setDefault
         @modifycsysdefault.okButton.setFocus
         @modifycsysdefault.show(PLACEMENT_CURSOR)
      else 
      @modifycsys0p.selection = @selbuffer
      @modifycsys0p.setdefault
      table2csysdialog0p(@modifycsys0p.selection.last.row.to_i, @table, @modifycsys0p)
      @modifycsys0p.okButton.setDefault
      @modifycsys0p.okButton.setFocus
      @modifycsys0p.show(PLACEMENT_CURSOR)
      end
   elsif @selbuffer.last.class == InfoPoint && @selbuffer.last.info[0] == @selbuffer.last.info[1]
      @modifypoint.selection = @selbuffer.last
      @modifypoint.setdefault
      table2pointdialog(@modifypoint.selection.row.to_i,@table,  @modifypoint)
      @modifypoint.reftext.text = @modifypoint.selection.csys.info[2].to_s
      @modifypoint.okButton.setDefault
      @modifypoint.okButton.setFocus 
      @modifypoint.show(PLACEMENT_CURSOR)
   elsif @selbuffer.last.class == InfoLine
      case @selbuffer.last.reftype
         when "2p"
            # setdefault, csys, ref
            @modifyline2p.setdefault
            @modifyline2p.selection = @selbuffer.last
            @modifyline2p.csys = @modifyline2p.selection.csys
            @modifyline2p.ref = @modifyline2p.selection.ref
            table2modifyline2p(@modifyline2p.selection.row.to_i, @table, @modifyline2p)
            @modifyline2p.reftext.text = "#{@modifyline2p.csys.info[2].to_s}, #{@modifyline2p.ref[0].info[2].to_s}, #{@modifyline2p.ref[1].info[2].to_s}"
            @modifyline2p.show(PLACEMENT_SCREEN)
            @modifyline2p.okButton.setDefault
            @modifyline2p.okButton.setFocus
         when "1p"
            # setdefault, csys, ref
            @modifyline1p.setdefault
            @modifyline1p.selection = @selbuffer.last
            @modifyline1p.csys = @modifyline1p.selection.csys
            @modifyline1p.ref = @modifyline1p.selection.ref
            table2modifyline1p(@modifyline1p.selection.row.to_i, @table, @modifyline1p)
            @modifyline1p.reftext.text = "#{@modifyline1p.csys.info[2].to_s}, #{@modifyline1p.ref.info[2].to_s}"
            @modifyline1p.show(PLACEMENT_SCREEN)
            @modifyline1p.okButton.setDefault
            @modifyline1p.okButton.setFocus
      end
??
   elsif @selbuffer.last.class == InfoFace
      if @selbuffer.last.reftype == "1p"
         @modifyface1p.setdefault
         @modifyface1p.selection = @selbuffer.last
         @modifyface1p.ref = @modifyface1p.selection.ref
         @modifyface1p.csys = @modifyface1p.selection.csys
         table2modifyface1p(@modifyface1p.selection.row, @table, @modifyface1p)
         @modifyface1p.reftext.text = "#{@modifyface1p.csys.info[2].to_s}, #{@modifyface1p.ref.info[2].to_s}"
         @modifyface1p.okButton.setDefault
         @modifyface1p.okButton.setFocus
         @modifyface1p.show(PLACEMENT_CURSOR)
      elsif @selbuffer.last.reftype == "1l"
         @modifyface1l.setdefault
         @modifyface1l.selection = @selbuffer.last
         @modifyface1l.ref = @modifyface1l.selection.ref
         @modifyface1l.csys = @modifyface1l.selection.csys
         table2modifyface1l(@modifyface1l.selection.row, @table, @modifyface1l)
         @modifyface1l.reftext.text = "#{@modifyface1l.csys.info[2].to_s}, #{@modifyface1l.ref.info[2].to_s}"
         @modifyface1l.okButton.setDefault
         @modifyface1l.okButton.setFocus
         @modifyface1l.show(PLACEMENT_CURSOR)
      elsif @selbuffer.last.reftype == "2l"
         @modifyface2l.setdefault
         @modifyface2l.selection = @selbuffer.last
         @modifyface2l.ref = @modifyface2l.selection.ref
         @modifyface2l.csys = @modifyface2l.selection.csys
         @modifyface2l.reftext.text = "#{@modifyface2l.csys.info[2].to_s}, #{@modifyface2l.ref[0].info[2].to_s}, #{@modifyface2l.ref[1].info[2].to_s}"
         table2modifyface2l(@modifyface2l.selection.row, @table, @modifyface2l)
         @modifyface2l.okButton.setDefault
         @modifyface2l.okButton.setFocus
         @modifyface2l.show(PLACEMENT_CURSOR)
      else
         FXMessageBox.information(self,MBOX_OK,"Information",
            "There is currently nothing selected\nor object properties not possible to change")
      end
   elsif @selbuffer.last.class == FutureRadius
      puts "futureradius"
      @modifyfutureline.setdefault
      @modifyfutureline.selection = @selbuffer.last
      @modifyfutureline.csys = @modifyfutureline.selection.csys
      table2modifyfutureline(@modifyfutureline.selection.row, @table, @modifyfutureline)
      @modifyfutureline.reftext.text = "#{@modifyfutureline.selection.csys.info[2].to_s}, #{@modifyfutureline.selection.ref.info[2].to_s}"
      @modifyfutureline.okButton.setDefault
      @modifyfutureline.okButton.setFocus
      @modifyfutureline.show(PLACEMENT_CURSOR)
   elsif @selbuffer.last.class == FutureFace
      puts "future face"
      @modifyface1f.setdefault
      @modifyface1f.selection = @selbuffer.last
      @modifyface1f.ref = @modifyface1f.selection.ref
      table2modifyface1f(@modifyface1f.selection.row, @table, @modifyface1f)
      @modifyface1f.reftext.text = "#{@modifyface1f.ref.info[2].to_s}"
      @modifyface1f.okButton.setDefault
      @modifyface1f.okButton.setFocus
      @modifyface1f.show(PLACEMENT_CURSOR)
   elsif @selbuffer.last.class == OpenFoamBoundary
      puts "modify bc"
      tmpsel = @selbuffer.last
      string = ""
      tmpsel.ref.each do |tmp|
         if tmp.info[0] == tmp.info[1]
            # only if viewerobj and parent are the same
            string += ", #{tmp.info[2].to_s}"
         else
            # this should be if the face is contained in a cube
            string += ", #{tmp.info[0].info[2]}.#{tmp.info[2].to_s}"
         end
      end
      case tmpsel.bctype
         when "INLET"
            @modifybcinletdialog.setdefault
            @modifybcinletdialog.ref = tmpsel.ref
            @modifybcinletdialog.reftext.text = string[2,string.length]
            xvel1 = tmpsel.xvel.to_f
            yvel1 = tmpsel.yvel.to_f
            zvel1 = tmpsel.zvel.to_f
            velmag1 = vectLength( [ xvel1, yvel1, zvel1 ] )
            @modifybcinletdialog.velmag.text = velmag1.to_s
            @modifybcinletdialog.xvec.text = ( xvel1 / velmag1 ).to_s
            @modifybcinletdialog.yvec.text = ( yvel1 / velmag1 ).to_s
            @modifybcinletdialog.zvec.text = ( zvel1 / velmag1 ).to_s
            @modifybcinletdialog.turbk.text = @selbuffer.last.k.to_s
            @modifybcinletdialog.turbepsilon.text = @selbuffer.last.epsilon.to_s
            @modifybcinletdialog.okButton.setDefault
            @modifybcinletdialog.okButton.setFocus
            @modifybcinletdialog.show(PLACEMENT_CURSOR)
         when "OUTLET"
            @modifybcoutletdialog.setdefault
            @modifybcoutletdialog.pressure.text = tmpsel.p.to_s
            @modifybcoutletdialog.ref = tmpsel.ref
            @modifybcoutletdialog.reftext.text = string[2,string.length]
            @modifybcoutletdialog.show(PLACEMENT_CURSOR)
      end
   else
     FXMessageBox.information(self,MBOX_OK,"Information",
         "There is currently nothing selected\nor object properties not possible to change")
   end   
end

[Source]

# File discretizer.rb, line 1321
      def onModifyInlet
         getApp().beginWaitCursor()
         @modifybcinletdialog.hide
         bc = @selbuffer.last
         unselectall
         bc.xvel = @modifybcinletdialog.xvel.text
         bc.yvel = @modifybcinletdialog.yvel.text
         bc.zvel = @modifybcinletdialog.zvel.text
         bc.k = @modifybcinletdialog.turbk.text
         bc.epsilon = @modifybcinletdialog.turbepsilon.text
         bc.update
         write2table(@table, bc.row, bc)
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 1335
      def onModifyOutlet
         getApp().beginWaitCursor()
         @modifybcoutletdialog.hide
         bc = @selbuffer.last
         unselectall
         bc.p = @modifybcoutletdialog.pressure.text
         bc.update
         write2table(@table, bc.row, bc)
         getApp().endWaitCursor()
      end

Modify coordinate system.

[Source]

# File discretizer.rb, line 836
      def onModifycsys
         getApp().beginWaitCursor()
         @modifycsys0p.hide
         @modifycsys0p.selection.last.xpos = @modifycsys0p.xpos.text.to_f
         @modifycsys0p.selection.last.ypos = @modifycsys0p.ypos.text.to_f
         @modifycsys0p.selection.last.zpos = @modifycsys0p.zpos.text.to_f
         @modifycsys0p.selection.last.xrot = @modifycsys0p.xrot.text.to_f
         @modifycsys0p.selection.last.yrot = @modifycsys0p.yrot.text.to_f
         @modifycsys0p.selection.last.zrot = @modifycsys0p.zrot.text.to_f
         @modifycsys0p.selection.last.csystype = @modifycsys0p.csystype.value
         @modifycsys0p.selection.last.size = @modifycsys0p.size.text.to_f
         unselectall
         @modifycsys0p.selection.last.update
         write2table(@table, @modifycsys0p.selection.last.row, @modifycsys0p.selection.last)
         updateobjects
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 824
      def onModifycsysdefault
         getApp().beginWaitCursor()
         @modifycsysdefault.hide
         @modifycsysdefault.selection.last.size = @modifycsysdefault.size.text.to_f
         unselectall
         updateobjects
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 1172
      def onModifycube1f
         # puts "modify 1f cube"
         getApp().beginWaitCursor()
         @modifycube1f.hide
         @modifycube1f.selection.xvec = @modifycube1f.xvec.text.to_f
         @modifycube1f.selection.yvec = @modifycube1f.yvec.text.to_f
         @modifycube1f.selection.zvec = @modifycube1f.zvec.text.to_f
         @modifycube1f.selection.meshnum = @modifycube1f.meshnum.text.to_i
         @modifycube1f.selection.refupdate
         write2table(@table, @modifycube1f.selection.row, @modifycube1f.selection)
         unselectall
         updateobjects
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 1153
      def onModifycube1p
         # puts "modify 1p cube"
         getApp().beginWaitCursor()
         @modifycube1p.hide
         @modifycube1p.selection.xlength = @modifycube1p.xlength.text.to_f
         @modifycube1p.selection.ylength = @modifycube1p.ylength.text.to_f
         @modifycube1p.selection.zlength = @modifycube1p.zlength.text.to_f
         @modifycube1p.selection.meshx = @modifycube1p.meshx.text.to_i
         @modifycube1p.selection.meshy = @modifycube1p.meshy.text.to_i
         @modifycube1p.selection.meshz = @modifycube1p.meshz.text.to_i
         @modifycube1p.selection.refupdate
         write2table(@table, @modifycube1p.selection.row, @modifycube1p.selection)
         unselectall
         updateobjects
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 1189
      def onModifycube2f
         # puts "modify 2f cube"
         getApp().beginWaitCursor()
         @modifycube2f.hide
         @modifycube2f.selection.twist = @modifycube2f.twist.text.to_i
         @modifycube2f.selection.flipdir = @modifycube2f.flipdir.text.to_i
         @modifycube2f.selection.meshnum = @modifycube2f.meshnum.text.to_i
         @modifycube2f.selection.refupdate
         write2table(@table, @modifycube2f.selection.row, @modifycube2f.selection)
         unselectall
         updateobjects
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 1222
      def onModifyface1f
         getApp().beginWaitCursor()
         @modifyface1f.hide
         @modifyface1f.selection.xlength = @modifyface1f.xlength.text.to_f
         @modifyface1f.selection.ylength = @modifyface1f.ylength.text.to_f
         @modifyface1f.selection.xpos = @modifyface1f.xpos.text.to_f
         @modifyface1f.selection.ypos = @modifyface1f.ypos.text.to_f
         @modifyface1f.selection.refattr = @modifyface1f.refattr.text.to_i
         @modifyface1f.selection.adjust = @modifyface1f.adjust
         @modifyface1f.selection.update
         @modifyface1f.selection.parent.recreate
         write2table(@table, @modifyface1f.selection.row, @modifyface1f.selection)
         unselectall
         #updateobjects
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 1205
      def onModifyface1l
         getApp().beginWaitCursor()
         @modifyface1l.hide
         @selbuffer.last.xvec = @modifyface1l.xvec.text.to_f
         @selbuffer.last.yvec = @modifyface1l.yvec.text.to_f
         @selbuffer.last.zvec = @modifyface1l.zvec.text.to_f
         @selbuffer.last.meshnum = @modifyface1l.meshnum.text.to_i
         removeallimesh
         @selbuffer.last.update
         write2table(@table, @selbuffer.last.row, @selbuffer.last)
         unselectall
         updateobjects
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 1132
      def onModifyface1p
         getApp().beginWaitCursor()
         @modifyface1p.hide
         @selbuffer.last.xlength = @modifyface1p.xlength.text.to_f
         @selbuffer.last.ylength = @modifyface1p.ylength.text.to_f
         @selbuffer.last.xrot = 0.0
         @selbuffer.last.yrot = 0.0
         @selbuffer.last.zrot = 0.0
         @selbuffer.last.meshx = @modifyface1p.meshx.text.to_i
         @selbuffer.last.meshy = @modifyface1p.meshy.text.to_i
         @selbuffer.last.plane = @modifyface1p.plane.to_s
         removeallimesh
         @selbuffer.last.update
         write2table(@table, @selbuffer.last.row, @selbuffer.last)
         unselectall
         updateobjects
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 1241
      def onModifyface2l
         getApp().beginWaitCursor()
         @modifyface2l.hide
         @selbuffer.last.meshnum = @modifyface2l.meshnum.text.to_i
         @selbuffer.last.flipdir = @modifyface2l.flipdir.to_i
         unselectall
         removeallimesh
         updateobjects
         write2table(@table, @modifyface2l.selection.row,@modifyface2l.selection)
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 920
      def onModifyfutureline
         getApp().beginWaitCursor()
         @modifyfutureline.hide
         @modifyfutureline.selection.radius = @modifyfutureline.radius.text.to_f
         @modifyfutureline.selection.refattr = @modifyfutureline.refattr.text.to_i
         @modifyfutureline.selection.axis = @modifyfutureline.axis.to_s
         @modifyfutureline.selection.xaxis = @modifyfutureline.xaxis.to_f
         @modifyfutureline.selection.yaxis = @modifyfutureline.yaxis.to_f
         @modifyfutureline.selection.zaxis = @modifyfutureline.zaxis.to_f
         @modifyfutureline.selection.update
         updateobjects
         write2table(@table, @modifyfutureline.selection.row, @modifyfutureline.selection)
         unselectall
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 905
      def onModifyline1p
         getApp().beginWaitCursor()
         @modifyline1p.hide
         @selbuffer.last.xvec = @modifyline1p.xvec.text.to_f
         @selbuffer.last.yvec = @modifyline1p.yvec.text.to_f
         @selbuffer.last.zvec = @modifyline1p.zvec.text.to_f
         @selbuffer.last.meshnum = @modifyline1p.meshnum.text.to_i
         updateobjects
         write2table(@table, @selbuffer.last.row,@selbuffer.last)
         unselectall
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 951
      def onModifyline2p
         getApp().beginWaitCursor()
         @modifyline2p.hide
         @selbuffer.last.meshnum = @modifyline2p.meshnum.text.to_i
         @selbuffer.last.flipdir = @modifyline2p.flipdir.to_i
         unselectall
         updateobjects
         write2table(@table, @modifyline2p.selection.row,@modifyline2p.selection)
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 868
      def onModifypoint
         getApp().beginWaitCursor()
         @modifypoint.hide
         if @selbuffer[0].class == InfoPoint 
            @selbuffer[0].xpos = @modifypoint.xpos.text.to_f 
            @selbuffer[0].ypos = @modifypoint.ypos.text.to_f 
            @selbuffer[0].zpos = @modifypoint.zpos.text.to_f 
            updateobjects
            write2table(@table, @selbuffer[0].row.to_i, @selbuffer[0])
         end
         unselectall
         getApp().endWaitCursor()
      end

[Source]

# File discretizer.rb, line 2589
def onOutletCreate
   #@result = openfoambcno(@selbuffer, @objects)
   #string = "Created outlet on face no: "
   #@result.each do |tmp|
   #   string += "#{tmp}, "
   #end
   #unselectall
   #FXMessageBox.information(self, MBOX_OK, "Info", string)
   tmpface = getfaces(@selbuffer)
   string = ""
   if tmpface != nil
      tmpface.each do |tmp|
         if tmp.info[0] == tmp.info[1]
            # only if viewerobj and parent are the same
            string += ", #{tmp.info[2].to_s}"
         else
            # this should be if the face is contained in a cube
            string += ", #{tmp.info[0].info[2]}.#{tmp.info[2].to_s}"
         end
      end
      @bcoutletdialog.ref = tmpface
      @bcoutletdialog.reftext.text = string[2,string.length]
      @bcoutletdialog.okButton.setDefault
      @bcoutletdialog.okButton.setFocus
      @bcoutletdialog.show(PLACEMENT_CURSOR)
   else
      FXMessageBox.information(self,MBOX_OK,"Information", "Reference is needed for boundaries.\nSelect one or more faces.")
   end
end

[Source]

# File discretizer.rb, line 2037
def onPerspectiveDlg
   @perspectivedialog.show
   @perspectivedialog.cancelButton.setDefault
   @perspectivedialog.cancelButton.setFocus 
end

[Source]

# File discretizer.rb, line 1769
   def onPointCreate
      # points can have only reference to coordinate systems
      # extract selected csys
      csystmp, reftmp = getcsys(@selbuffer)
      @pointdialog.selection = csystmp
      @pointdialog.ref = csystmp
      @pointdialog.reftext.text = @pointdialog.selection.info[2]
      @pointdialog.okButton.setDefault
      @pointdialog.okButton.setFocus 
      @pointdialog.show(PLACEMENT_CURSOR)
   end

[Source]

# File discretizer.rb, line 4067
   def onQueryMenu(sender, sel, event)
      # puts self.class GLViewWindow
      # ptr will point to my viewer object...
      pane = FXMenuPane.new(self)
      csysCreate = FXMenuCommand.new(pane, "Create csys\t\tCreate a coordinate system.", nil, sender)
      csysCreate.connect(SEL_COMMAND){ onCsysCreate }
      FXMenuSeparator.new(pane)
      pointCreate = FXMenuCommand.new(pane, "Create point\t\tCreate a reference point x,y,z.", nil, sender)
      pointCreate.connect(SEL_COMMAND){ onPointCreate }
      lineCreate = FXMenuCommand.new(pane, "Create line\t\tCreate a line.", nil, sender)
      lineCreate.connect(SEL_COMMAND){ onLineCreate }
      faceCreate = FXMenuCommand.new(pane, "Create face\t\tCreate a mesh face.", nil, sender)
      faceCreate.connect(SEL_COMMAND){ onFaceCreate }
      cubeCreate = FXMenuCommand.new(pane, "Create cube\t\tCreate a mesh cube.", nil, sender)
      cubeCreate.connect(SEL_COMMAND){ onCubeCreate }
      FXMenuSeparator.new(pane)
      FXMenuCommand.new(pane, "&Front\t\tFront view.", nil, sender,FXGLViewer::ID_FRONT)
      FXMenuCommand.new(pane, "&Back\t\tBack view.", nil, sender, FXGLViewer::ID_BACK)
      FXMenuCommand.new(pane, "&Left\t\tLeft view.", nil, sender, FXGLViewer::ID_LEFT)
      FXMenuCommand.new(pane, "&Right\t\tRight view.", nil, sender, FXGLViewer::ID_RIGHT)
      FXMenuCommand.new(pane, "&Top\t\tTop view.", nil, sender, FXGLViewer::ID_TOP)
      FXMenuCommand.new(pane, "&Bottom\t\tBottom view.", nil, sender, FXGLViewer::ID_BOTTOM)
      FXMenuSeparator.new(pane)
      FXMenuCommand.new(pane, "F&it\t\tFit to view.", nil, sender, FXGLViewer::ID_FITVIEW)
      FXMenuCommand.new(pane, "R&eset\t\tReset all viewing parameters", nil, sender, FXGLViewer::ID_RESETVIEW)