Export mesh node coordinates
Hello,
I have a rather unusual problem: I have a mesh and I would like to import the coordinates of the nodes into MATLAB. Does anyone have an idea how I can do it?
I tried exporting the mesh as a .FEM file but I am not familiar with the structure of the file format and I don't know how to convert the information into Cartesian coordinates. I saw that the file contains information about the grid, as well as about the elements I have. Are just the grid coordinates relevant for my task?
Answers
-
Try this script:
*clearmark nodes 1 *createmarkpanel nodes 1 'Select Nodes to export' set nodes [hm_getmark nodes 1] *clearmark nodes 1 set myhmfile [hm_info hmfilename] set myhmdir [file dirname $myhmfile] set output [format '%s/nodes.txt' $myhmdir] set dat [open $output w] foreach node $nodes { set x [hm_getentityvalue NODES $node 'x' 0] set y [hm_getentityvalue NODES $node 'y' 0] set z [hm_getentityvalue NODES $node 'z' 0] puts $dat [format '%d %0.8E %0.8E %0.8E' $node $x $y $z] } close $dat;
You got a file 'nodes.txt' which contains some thing like:
819 1.27000000E+002 2.13755242E+001 -1.27000000E+002 1014 1.08141272E+002 2.13755242E+001 -1.27000000E+002 1073 1.12855954E+002 2.13755242E+001 -1.27000000E+002 1132 1.17570636E+002 2.13755242E+001 -1.27000000E+002 1191 1.22285318E+002 2.13755242E+001 -1.27000000E+002 1212 8.70000000E+001 1.84771784E+001 -1.27000000E+002 1238 9.39972259E+001 0.00000000E+000 -8.06734225E+001 1239 9.39972259E+001 0.00000000E+000 -8.80258870E+001 1240 9.39972259E+001 0.00000000E+000 -9.53783515E+001 1241 9.39972259E+001 0.00000000E+000 -1.02730816E+002 1242 9.39972259E+001 0.00000000E+000 -1.10083280E+002 1243 9.39972259E+001 0.00000000E+000 -1.18541640E+002
You can modify the output format (line puts $dat [.....])
HTH,
0 -
I think one can also use the Matrix browser (Tools->Matrix Browser) to output (and even modify) nodal coordinates.
0 -
Q.Nguyen-Dai said:
Try this script:
*clearmark nodes 1 *createmarkpanel nodes 1 'Select Nodes to export' set nodes [hm_getmark nodes 1] *clearmark nodes 1 set myhmfile [hm_info hmfilename] set myhmdir [file dirname $myhmfile] set output [format '%s/nodes.txt' $myhmdir] set dat [open $output w] foreach node $nodes { set x [hm_getentityvalue NODES $node 'x' 0] set y [hm_getentityvalue NODES $node 'y' 0] set z [hm_getentityvalue NODES $node 'z' 0] puts $dat [format '%d %0.8E %0.8E %0.8E' $node $x $y $z] } close $dat;
You got a file 'nodes.txt' which contains some thing like:
819 1.27000000E+002 2.13755242E+001 -1.27000000E+002 1014 1.08141272E+002 2.13755242E+001 -1.27000000E+002 1073 1.12855954E+002 2.13755242E+001 -1.27000000E+002 1132 1.17570636E+002 2.13755242E+001 -1.27000000E+002 1191 1.22285318E+002 2.13755242E+001 -1.27000000E+002 1212 8.70000000E+001 1.84771784E+001 -1.27000000E+002 1238 9.39972259E+001 0.00000000E+000 -8.06734225E+001 1239 9.39972259E+001 0.00000000E+000 -8.80258870E+001 1240 9.39972259E+001 0.00000000E+000 -9.53783515E+001 1241 9.39972259E+001 0.00000000E+000 -1.02730816E+002 1242 9.39972259E+001 0.00000000E+000 -1.10083280E+002 1243 9.39972259E+001 0.00000000E+000 -1.18541640E+002
You can modify the output format (line puts $dat [.....])
HTH,
cann't find myhmfile ?
why is that
0 -
AlperK said:
I think one can also use the Matrix browser (Tools->Matrix Browser) to output (and even modify) nodal coordinates.
THERE IS NOTHING CONTAIN INSIDES THE MATRIX BROWSER ?
0