Node (dot) in the middle of element (TCL?)
Hello everyone!
I have 3D tetra mesh and in the middle of any particular element of the mesh I have a dot.
It seems that this dot means nothing, couldn't find any information about it.
But for my project I need to get coordinates of those dots, without coordinates of the mesh.
As an example we can get .txt file with coordinates of elements of the mesh.
What I need to get is the same .txt file with coordinates but with coordinates of those dots only.
Should I use some TCL commands or is there any way to do that?
Very grateful for any help!
Answers
-
Here's a simple script to show you coordinates of centroid for each element:
*createmarkpanel elems 1 'Select Elems' set my_elems [hm_getmark elems 1] puts ' Eid; Center_X ; Center_Y ; Center_Z ;' foreach eid $my_elems { set cx [hm_getvalue element id=$eid dataname=centerx] set cy [hm_getvalue element id=$eid dataname=centery] set cz [hm_getvalue element id=$eid dataname=centerz] puts [format '%6d; %12.5E ; %12.5E ; %12.5E ;' $eid $cx $cy $cz] } *clearmark elems 1;
0 -
@Q.Nguyen-Dai
Thanks a lot, this script solves the problem.Just one question.
Command Window shows just last 100 output strings but I habe a big model.
Is there any way to see whole output or any command to write the output in txt file?
0 -
Here's another script with output to file (*_centroid.csv within the same folder as your HM model):
*createmarkpanel elems 1 'Select Elems' set my_elems [hm_getmark elems 1] set myhmfile [hm_info hmfilename] set myhmdir [file dirname $myhmfile] set myhmbasename [file rootname [file tail $myhmfile]] set filename [format '%s_centroid.csv' $myhmbasename] set filename [file join $myhmdir $filename]; set output [open $filename 'w'] puts $output ' Eid; Center_X ; Center_Y ; Center_Z ;' foreach eid $my_elems { set cx [hm_getvalue element id=$eid dataname=centerx] set cy [hm_getvalue element id=$eid dataname=centery] set cz [hm_getvalue element id=$eid dataname=centerz] puts $output [format '%6d; %12.5E ; %12.5E ; %12.5E ;' $eid $cx $cy $cz] } close $output; *clearmark elems 1;
0 -
@Q.Nguyen-Dai
Thank you very much!
That what I was looking for!0