Challenge

Week - 10 - Creating the midline and spot weld

OBJECTIVE

  • To create Marco to generate midline for a tubular component
  • To create Marco to create spot weld for the user-defined node list

CODE

  • 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.

# line list

*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"

*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

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.

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.