How to create two node sets on a same plane of a cylinder using tcl
Hello,
I am trying to create two node sets on a cylinder for plotting nodal contours, as shown below.
I am trying to automate this using tcl and wanted to see if it's possible.
If I select nodes by plane, it is selecting both sides of the cylinder. The only way I think it is possible is to mask one side first, create a set, reverse mask and do other side. any other approaches are welcome.
PS: I tried to capture the hwc code using hwc console but it does not show any selection commands but rather showing node iDs after selection. I think I am looking for something like *createmark element 'by box' and +Y or -Y region.
Best Answer
-
Hi,
Try this one, As input, You have to define a plane(N1, N2, N3)
Hope this works for You,
For further updates and clarification please let me know.
1
Answers
-
Hi,
Try this one, As input, You have to define a plane(N1, N2, N3)
Hope this works for You,
For further updates and clarification please let me know.
1 -
Hypermesh User said:
Hi,
Try this one, As input, You have to define a plane(N1, N2, N3)
Hope this works for You,
For further updates and clarification please let me know.
Thank you very much. That worked.
I made some slight modifications at the beginning of the code to automate the plane selection.
#GET_THE_PLANE_FROM_USER # #set plane [hm_getplanepanel "Please define a plane"] #foreach {nx ny nz} [lindex [lindex $plane 0] 0] {} #foreach {bx by bz} [lindex [lindex $plane 0] 1] {} set bx 1 set by 1 set bz 0 set nx 0 set ny 0 set nz 2 #CREATE_NODE_MARK_USING_PLANE hm_createmark nodes 1 "on plane" "$bx $by $bz $nx $ny $nz .5 1 1"
Could you please explain the steps. when you have time. Thank you!
0 -
Ash Ahamed said:
Thank you very much. That worked.
I made some slight modifications at the beginning of the code to automate the plane selection.
#GET_THE_PLANE_FROM_USER # #set plane [hm_getplanepanel "Please define a plane"] #foreach {nx ny nz} [lindex [lindex $plane 0] 0] {} #foreach {bx by bz} [lindex [lindex $plane 0] 1] {} set bx 1 set by 1 set bz 0 set nx 0 set ny 0 set nz 2 #CREATE_NODE_MARK_USING_PLANE hm_createmark nodes 1 "on plane" "$bx $by $bz $nx $ny $nz .5 1 1"
Could you please explain the steps. when you have time. Thank you!
Hi,
Just it separates the list of nodes that are shared by adjacent elements,
step-1 I randomly pick one node on the list of Nodes on the plane,
step -2_loop start
step-2 I get the adjacent elements attached to that randomly picked node.
step - 3 I filter common nodes shared between the nodes of adjacent elements. now I get the three nodes on one side.
step -4 I changed the randomly picked node by the filtered nodes. loop continues.
step_5 Loop continues until it selects all nodes on one side.
Once I filtered the one side nodes it's easy to create a two-set.
Also, it looks some little time to run(but working), we can change the algorithm a little bit to take less iteration to filter nodes to make it faster.
Hope You will mark this as the correct answer It motivates me to help others.
1 -
Hypermesh User said:
Hi,
Just it separates the list of nodes that are shared by adjacent elements,
step-1 I randomly pick one node on the list of Nodes on the plane,
step -2_loop start
step-2 I get the adjacent elements attached to that randomly picked node.
step - 3 I filter common nodes shared between the nodes of adjacent elements. now I get the three nodes on one side.
step -4 I changed the randomly picked node by the filtered nodes. loop continues.
step_5 Loop continues until it selects all nodes on one side.
Once I filtered the one side nodes it's easy to create a two-set.
Also, it looks some little time to run(but working), we can change the algorithm a little bit to take less iteration to filter nodes to make it faster.
Hope You will mark this as the correct answer It motivates me to help others.
Thank you very much
0 -
Another approach would be to loop through all nodes and check the coordinates. +y coordinate—>set1, -y—>set2. (based on your image)0