Week - 10 - Creating the midline and spot weld
Report Week - 10 - Creating the midline and spot weld
Objective: finish creating the midline and spot weld task
Problem Statement:
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
Tcl command explanation:
Part A:
*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]
}
Part B:
*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
}
Conclusion:task is finished by above code