Week - 10 - Creating the midline and spot weld
Aim:
To create a code that performs creating midline
To create a code that performs creating spot welds
Objective:
Create a macro to calculate the midline of a given tubular component and combine all the midlines to create a single midline.
Create a macro to create 1D spot weld for each node pair inappropriate component.
Code:
Part A:
*createlistbypathpanel lines 1 "Select the source lines by path"
set source [hm_getlist lines 1]
*createlistbypathpanel lines 2 "Select the target lines by path"
set target [hm_getlist lines 2]
foreach i $source j $target {
*linescreatemidline 1 1 2 2
*linecombine $i $j 1
}
Part B:
*clearmarkall 1
*createlistbypathpanel nodes 1 "Select the source nodes by path"
set source [hm_getlist nodes 1]
*createlistbypathpanel nodes 2 "Select the target nodes by path"
set target [hm_getlist nodes 2]
foreach i $source j $target {
*elementtype 5 1
*rigid $i $j 123456
}
Procedure and Code explanation:
Part A - Midline:
*Createlistbypathpanel command is used to select the entities by using entity panel. This creates a list of selected entities in a way we select the order. Line list will be selected.
The first set of lines are saved as a source and the second set of lines are saved as a target.
foreach loop is used to create midline for a each source lines and target lines and then the lists are assigned to variables.
*linescreatemidline is used to create misline. Midline is created for between source lines and target lines.
Part B - Spot weld:
*Createlistbypathpanel command is used to select the entities by using entity panel. This creates a list of selected entities in a way we select the order. Node list for weld location will be selected.
The first set of nodes are saved as a source and the second set of nodes are saved as a target.
And then foreach loop is used to create weld for each source nodes and target nodes
To create rigid *rigid node 1 node 2 dof command is used. Inputs are node 1 i.e.source node, node 2 i.e.target node and dof 123456
Output:
Part A:



Part B:




Conclusion:
Sucessfully created a macro created that performs creating midline and also created a macro that performs creating spot welds for user defined node list.