iFuser

        toplevel .wem-v-1

        #frame .wem-v-1.fr1 -borderwidth 1 -relief solid
        #pack .wem-v-1.fr1 -padx 1 -pady 1 -anchor nw

        #label .wem-v-1.fr1.l1 -text "Select Line >>>>>>>>>>>>>>>>>>>>>"
        #pack .wem-v-1.fr1.l1 -padx 1 -pady 1 -anchor nw

        #button .wem-v-1.fr1.b1 -text LINE -bg gray65 -command Pick_line
        #pack .wem-v-1.fr1.b1 -side right 


        #frame .wem-v-1.fr2 -borderwidth 1 -relief solid
        #pack .wem-v-1.fr2 -padx 2 -pady 2 -anchor nw

        #label .wem-v-1.fr2.l2 -text "Select Node -- For Straight Mesh Only"
        #pack .wem-v-1.fr2.l2 -padx 2 -pady 2 -anchor nw

        #button .wem-v-1.fr2.b2 -text NODE -bg gray65 -command Pick_node
        #pack .wem-v-1.fr2.b2 -side right 


        frame .wem-v-1.fr3 -borderwidth 1 -relief solid
        pack .wem-v-1.fr3 -padx 2 -pady 2 -anchor nw

        label .wem-v-1.fr3.l3 -text "Enter Weld Size >>>>>>>>>>>>>>>> " 
        pack .wem-v-1.fr3.l3 -padx 2 -pady 2 -anchor nw

        entry .wem-v-1.fr3.e3 -textvariable weldsize 
        pack .wem-v-1.fr3.e3 -padx 2 -pady 2 -anchor nw


        frame .wem-v-1.fr4 -borderwidth 1 -relief solid
        pack .wem-v-1.fr4 -padx 2 -pady 2 -anchor nw

        label .wem-v-1.fr4.l4 -text "Enter Element Size >>>>>>>>>>>>>> " 
        pack .wem-v-1.fr4.l4 -padx 2 -pady 2 -anchor nw

        entry .wem-v-1.fr4.e4s -textvariable size 
        pack .wem-v-1.fr4.e4s -padx 2 -pady 2 -anchor nw


        frame .wem-v-1.fr5 -borderwidth 1 -relief solid
        pack .wem-v-1.fr5 -padx 2 -pady 2 -anchor nw

        button .wem-v-1.fr5.b5s -text "<<< HIT FOR STRAIGHT-MESH >>>" -command straight_mesh -bg grey65
        pack .wem-v-1.fr5.b5s -padx 1 -pady 1 -anchor nw


        frame .wem-v-1.fr6 -borderwidth 1 -relief solid
        pack .wem-v-1.fr6 -padx 2 -pady 2 -anchor nw

        button .wem-v-1.fr6.b6r -text "<<<< HIT FOR RADIAL-MESH >>>> " -command radial_mesh -bg grey65
        pack .wem-v-1.fr6.b6r -padx 1 -pady 1 -anchor nw


        frame .wem-v-1.fr7 -borderwidth 1 -relief solid
        pack .wem-v-1.fr7 -padx 2 -pady 2 -anchor nw

        button .wem-v-1.fr7.b7r -text "<<HIT FOR CYLINDRICAL-MESH >>" -command cylindrical_mesh -bg grey65
        pack .wem-v-1.fr7.b7r -padx 1 -pady 1 -anchor nw


        frame .wem-v-1.fr8 -borderwidth 1 -relief solid
        pack .wem-v-1.fr8 -padx 2 -pady 2 -anchor nw

        label .wem-v-1.fr8.l8 -text "    Codes by Krunal Thakar -- July,11   " -bg yellow 
        pack .wem-v-1.fr8.l8 -padx 2 -pady 2 -anchor nw


proc straight_mesh {} {

        variable size
        variable weldsize
        variable lineid0
        variable nodeid2

#proc Pick_line {} {

        #global lineid0

        #*clearmark lines 1
        #*createmarkpanel lines 1 "Select line"
        #set lineid0 [hm_getmark lines 1]

        #}

#proc Pick_node {} {

        #global nodeid2

        #*clearmark lines 1
        #*createlistpanel nodes 1 "select a node on surface on which mesh is to be generated"
         #set nodeid2 [ hm_getlist node 1 ]

        #}



        *createmarkpanel lines 1 "select the line"
        set lineid0 [ hm_getmark lines 1 ]
        set linelength [ hm_linelength $lineid0  ]


        set number [expr $linelength/$size]
        set count [expr round  ($number) ]
        set nodecount [expr $count+1]

        *createmark lines 2 $lineid0 
        *nodecreateonlines lines 2 $nodecount 0 0

        *createlistpanel nodes 1 "select a node on surface on which mesh is to be generated"
        set nodeid2 [ hm_getlist node 1 ]


        *clearmark nodes 1 
        *createmark nodes 1 "-4" 
        set nodeid0 [ hm_getmark nodes 1 ]

        *clearmark nodes 1 
        *createmark nodes 1 "-3"
        set nodeid1 [ hm_getmark nodes 1 ] 
        *clearmark nodes 1 
        *createmark nodes 1 $nodeid0
        *systemcreate 1 0 $nodeid0 x $nodeid1 xy $nodeid2
        *createmark systems 1  "-1"
        set sysid0 [ hm_getmark systems 1 ]

        *createmark nodes 1 $nodeid0
        *duplicatemark nodes 1 25
        *createmark nodes 1 "-1"
        set nodeid1 [ hm_getmark nodes 1 ]
        *createvector 2 0.0000 1.0000 0.0000
        *translatemarkwithsystem nodes 1 2 $weldsize -1 $nodeid0
        *createlist nodes 1 $nodeid0 $nodeid1
        *linecreatefromnodes 1 1 0.0 0.0 0.0
        *clearmark lines 1
        *createmark lines 1 "-1" 
        set lineid2 [hm_getmark lines 1]
        #*vectorcreate_twonode $nodeid0 $nodeid1
        *nodecleartempmark


        set CompCheck [catch {hm_entityinfo id Component "iTemp_macro"}];
          if [expr $CompCheck != 1] {
                     *currentcollector components "iTemp_macro"
          } else {

                *collectorcreateonly components "iTemp_macro" "" 7
          }
        *elementsizeset $size 
        *createmark lines 1 $lineid0  
        *linemesh_preparedata lines 1 0 
        *linemesh_saveparameters 0 $count 0 0  
        *linemesh_savedata 1 5 0 



        set CompCheck [catch {hm_entityinfo id Component "iWELD"}];
          if [expr $CompCheck != 1] {
                     *currentcollector components "iWELD"
          } else {

                *collectorcreateonly components "iWELD" "" 14
          }

        *createmark elements 1 "by collector" "iTemp_macro"
        *createlist lines 2 $lineid2
        *createlist nodes 2
        *createplane 1 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 
        *linedragelements 1 2 2 1 1 0 0 1

        *createmark components 1  "iTemp_macro"
        *deletemark components 1  



        *clearmark nodes 1
        *createmark nodes 1 "-1"
        set nodeid11 [hm_getmark nodes 1]
        *createmark nodes 1 $nodeid11
        *duplicatemark nodes 1 27

        *clearmark nodes 1
        *createmark nodes 1 "-$nodecount"
        set nodeid12 [hm_getmark nodes 1]
        *createmark nodes 1 $nodeid12
        *duplicatemark nodes 1 28
        set nodeid13 [hm_getmark nodes 1]
        *clearmark nodes 1


        #*createlist nodes 1 $nodeid11 $nodeid12
        #*linecreatefromnodes 1 1 0.0 0.0 0.0
        *clearmark lines 1
        *createmark lines 1 $lineid0
        *duplicatemark lines 1 
        #*createmark lines 1
        set dupline [hm_getmark lines 1]
        *clearmark lines 1
        *createmark lines 1 $dupline
        *createvector 2 0.0000 1.0000 0.0000
        *translatemarkwithsystem lines 1 2 $weldsize $sysid0 $nodeid0
        set lineid3 [hm_getmark lines 1]
        *clearmark lines 1

        set CompCheck [catch {hm_entityinfo id Component "iTemp_macroA"}];
          if [expr $CompCheck != 1] {
                     *currentcollector components "iTemp_macroA"
          } else {

                *collectorcreateonly components "iTemp_macroA" "" 7
          }
        *elementsizeset $size 
        *createmark lines 1 $dupline  
        *linemesh_preparedata lines 1 0 
        *linemesh_saveparameters 0 $count 0 0  
        *linemesh_savedata 1 5 0 



        *createmark nodes 1 $nodeid13
        *clearmark vectors 1
        *createvector 1         0.0000 1.0000 0.0000
        *createmark systems 1 $sysid0

        if { $weldsize > 0 } { 
                *translatemarkwithsystem nodes 1 1 20 $sysid0 0 
           }

        if { $weldsize < 0 } { 
                *translatemarkwithsystem nodes 1 1 -20 $sysid0 0 
           }


        *createlist nodes 1 $nodeid12 $nodeid13
        *linecreatefromnodes 1 1 0.0 0.0 0.0
        *createmark lines 1 "-1"
        set lineid4 [hm_getmark lines 1]
        *clearmark lines 1

        set CompCheck [catch {hm_entityinfo id Component "iEVAL"}];
          if [expr $CompCheck != 1] {
                     *currentcollector components "iEVAL"
          } else {

                *collectorcreateonly components "iEVAL" "" 8
          }
        *createmark elements 1 "by collector" "iTemp_macroA"
        *createlist lines 2 $lineid4
        *createlist nodes 2
        *createplane 1 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 
        *linedragelements 1 2 2 1 1 0 0 1

        *createmark components 1  "iTemp_macroA"
        *deletemark components 1
        *nodecleartempmark

        #*createmark lines 1 "by components" "iWELD" "iEVAL" 
        #*deletemark lines 1
        *createmark systems 1 "displayed" 
        *deletemark systems 1

        *clearmark nodes 1
        *clearmark lines 1
        *clearlist nodes 1
        *clearlist lines 1
        *clearmark surfaces 1

}

                                                #----##----#
                                                #----##----#
                                                #----##----#
                                                #----##----#

proc cylindrical_mesh {} {

        variable size
        variable weldsize
        variable lineid0
        variable nodeid2

        *createlistpanel lines 1 "select the line"
        set lineid0 [ hm_getlist lines 1 ]
        set linelength [ hm_linelength $lineid0  ]

        *clearmark lines 1
        *createmark lines 1 $lineid0
        set circ [hm_getmark lines 1]
        *nodecreateonlines lines 1 4 0 0
        *createmark nodes 1 "-1" 
        set nodeid0 [hm_getmark nodes 1]
        *clearmark nodes 1
        *createmark nodes 1 "-2" 
        set nodeid1 [hm_getmark nodes 1]
        *clearmark nodes 1
        *createmark nodes 1 "-3" 
        set nodeid2 [hm_getmark nodes 1]
        *clearmark nodes 1
        *createmark nodes 1 "-4" 
        set nodeid3 [hm_getmark nodes 1]
        *clearmark nodes 1
        *createcenternode $nodeid0 $nodeid1 $nodeid2
        *createmark nodes 1 "-1"
        set nodeidcen [hm_getmark nodes 1]
        *clearmark nodes 1
        *createmark nodes 1 $nodeid0 $nodeid1 $nodeid2 $nodeid3  
        *nodemarkcleartempmark 1 


        set number [expr $linelength/$size]
        set count [expr round  ($number) ]
        set nodecount [expr $count+1]

        *createmark lines 2 $lineid0 
        *nodecreateonlines lines 2 $nodecount 0 0

        *clearmark nodes 1
        *createmark nodes 1 "-4" 
        set nodeid101 [ hm_getmark nodes 1 ]

        *clearmark nodes 1 
        *createmark nodes 1 "-3"
        set nodeid102 [ hm_getmark nodes 1 ] 
        *clearmark nodes 1

        *createmark nodes 1 $nodeidcen
        *systemcreate 1 1 $nodeidcen "x-axis" $nodeid101 "xy plane" $nodeid102 
        *createmark systems 1 "-1"
        set sysid1 [hm_getmark systems 1]

        set CompCheck [catch {hm_entityinfo id Component "iTemp_macroR"}];
          if [expr $CompCheck != 1] {
                     *currentcollector components "iTemp_macroR"
          } else {

                *collectorcreateonly components "iTemp_macroR" "" 7
          }
                *deleteelementsmode 0


        *clearmark systems 1
        *clearmark vectors 1
        *createmark nodes 1 $nodeid102  
        *duplicatemark nodes 1
        *createmark nodes 1 "-1"
        set nodeid103 [hm_getmark nodes 1] 
        *createvector 1 0 0 1 
        *createmark systems 1 $sysid1 
        *translatemarkwithsystem nodes 1 1 $weldsize $sysid1 0 

        *clearlist nodes 1
        *clearmark lines 1
        *createlist nodes 1 $nodeid102 $nodeid103
        *linecreatefromnodes 1 1 0.0 0.0 0.0
        *createmark lines 1 "-1"
        set lineid101 [hm_getmark lines 1]
        *clearmark lines 1


        *elementsizeset $size 
        *createmark lines 1 $lineid0  
        *linemesh_preparedata lines 1 0 
        *linemesh_saveparameters 0 $count 0 0  
        *linemesh_savedata 1 5 0 


        set CompCheck [catch {hm_entityinfo id Component "iWELDR"}];
          if [expr $CompCheck != 1] {
                     *currentcollector components "iWELDR"
          } else {

                *collectorcreateonly components "iWELDR" "" 14
          }


        *createmark elements 1 "by collector" "iTemp_macroR"
        *createlist lines 2 $lineid101
        *createlist nodes 2
        *createplane 1 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 
        *linedragelements 1 2 2 1 1 0 0 1

        *createmark components 1  "iTemp_macroR"
        *deletemark components 1 

        *clearmark nodes 1
        *createmark nodes 1 "-1"
        set nodeid105 [hm_getmark nodes 1]
        *duplicatemark nodes 1 "-1"
        set nodeid106 [hm_getmark nodes 1]


        *clearmark nodes 1
        *createmark nodes 1 $nodeid106
        *clearmark systems 1
        *clearmark vectors 1
        *createvector 1 0 0 1 
        *createmark systems 1 $sysid1

        if { $weldsize > 0 } { 
                *translatemarkwithsystem nodes 1 1 20 $sysid1 0 
           }

        if { $weldsize < 0 } { 
                *translatemarkwithsystem nodes 1 1 -20 $sysid1 0 
           }

        set CompCheck [catch {hm_entityinfo id Component "iTemp_macroR"}];
          if [expr $CompCheck != 1] {
                     *currentcollector components "iTemp_macroR"
          } else {

                *collectorcreateonly components "iTemp_macroR" "" 7
          }


        *clearlist nodes 1
        *clearmark lines 1
        *createlist nodes 1 $nodeid105 $nodeid106
        *linecreatefromnodes 1 1 0.0 0.0 0.0
        *createmark lines 1 "-1"
        set lineid105 [hm_getmark lines 1]
        *clearmark lines 1


        *createmark lines 1 $lineid0
        *duplicatemark lines 1 
        #*createmark lines 1
        set duplineR [hm_getmark lines 1]
        *clearmark lines 1
        *createmark lines 1 $duplineR
        *createvector 2 0 0 1
        *translatemarkwithsystem lines 1 2 $weldsize $sysid1 0
        set lineid106 [hm_getmark lines 1]
        *clearmark lines 1



        *elementsizeset $size 
        *createmark lines 1 $duplineR  
        *linemesh_preparedata lines 1 0 
        *linemesh_saveparameters 0 $count 0 0  
        *linemesh_savedata 1 5 0 

        set CompCheck [catch {hm_entityinfo id Component "iEVALR"}];
          if [expr $CompCheck != 1] {
                     *currentcollector components "iEVALR"
          } else {

                *collectorcreateonly components "iEVALR" "" 8
          }



        *createmark elements 1 "by collector" "iTemp_macroR"
        *createlist lines 2 $lineid105
        *createlist nodes 2
        *createplane 1 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 
        *linedragelements 1 2 2 1 1 0 0 1


        *createmark components 1  "iTemp_macroR"
        *deletemark components 1 


        *createmark systems 1  "displayed"
        *deletemark systems 1

        *nodecleartempmark

}

                                                #----##----#
                                                #----##----#
                                                #----##----#
                                                #----##----#

proc radial_mesh {} {

        tk_messageBox -title "wem" -message "DEBUGGING IS IN PROGRESS.....REPENT FOR INCONVENIENCE.     "

}