Challenge

Week - 10 - Creating the midline and spot weld

AIM: Creating the midline and spot weld using TCL/TK Commands

OBJECTIVE:

Part A:

  • Create a macro to calculate the midline of a given tubular component
  • Select one end of the lines using line by path
  • Similarly, select the other ends using line by path option
  • Now calculate midline for each pair
  • Combine all these midlines to create a single midline.

Part B:

  • Create a macro to create spot welds
  • Select source nodes by the path from the user
  • Select target nodes by the path from the user
  • Create 1D spot welds for each node pair inappropriate component

PROCEDURE:

  • CREATING MID-LINE FOR SELECTED LINES.
  • CREATING SPOT WELD.

CREATING MID-LINE FOR SELECTED LINES:

For a surface like a hollow cylinder, the 1D element is created while FEA analysis. For those entities, it’s important to have a mid-line to create elements.

  • GET LIST:
    • Entities are selected by the user by the command “createlistbypathpanel”.
    • This creates a list of selected entities (here lines) in the selected order.
    • Firsts set of lines are saved as a source and the second set of lines stored as a target.
  • START LOOP:
    • “Foreach” loop has been initiated and lists are assigned to variables.
  • CREATE MID-LINE:
    • Midline is created for a pair of marked lines by using the command “*linescreatemidline”.
    • Created lines ID save in a different variable.
  • COMBINE:
    • New lines ID is appending to a variable.
    • By using combine “*linecombine” new line and previous line combined.

When loop gets completed new mid-line will be created and each line connects to form a single line.

Code

*createlistbypathpanel lines 1
set lines_1 [hm_getlist lines 1]
*createlistbypathpanel lines 2
set lines_2 [hm_getlist lines 2]


set a1 {}

foreach i $lines_1 j $lines_2 {

*createlist lines 1 $i
*createlist lines 2 $j
*linescreatemidline 1 1 2 2
*createmark lines 1 -1
set a [hm_getmark lines 1]
lappend a1 $a
}
set b [llength $a1]
set b1 [lindex $a1 0]
puts "$b1"
for { set n 1} {$n < $b } {incr n} {
set b2 [lindex $a1 $n]
puts "$b2"
*linecombine $b1 $b2 0
*createmark line 1 -1
set b1 [hm_getmark lines 1]
}

CREATING SPOT WELD:

Spot weld is a permanent joint between metals. In hypermesh, components can be connected by various connections methods. E.g., Weld, bold, etc, For weld it classified as spot, seam, quad.

For spot weld, connectors are created on nodes between components.

  • GET NODE LIST:
    • Node list for weld location is got by command “createlistbypathpanel”.
  • “Foreach” loop has been initiated
  • CREATE Rigids:
    • Connectors for spot weld has been created by command *rigid node1 node2 dofs
    • Inputs for this command are,
      • node 1
      • node 2
      • DOF 123456
  • If the condition is implemented to execute for each loop  only if the no of primary nodes and target nodes is equal or else popup appear stating that "no of nodes were not equal"  

Code

*clearmarkall 1 *clearmarkall 2
#source nodes
*createlistbypathpanel nodes 1
set s_nodes [hm_getlist nodes 1]
#target nodes
*createlistbypathpanel nodes 2
set t_nodes [hm_getlist nodes 2]
#rbe2

if [llength $s_nodes]==[llength $t_nodes ] {
foreach i $s_nodes j $t_nodes {
*rigid $i $j 123456
}
} else {
tk_messageBox -message "no of nodes were not equal" -icon warning -type ok
}

RESULT:

  • Midline has been generated by using macro for tubular components.
  • Spot weld has been created by using macro for the user defined node list.
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.