TCL scripts for importing nodes and elements from csv files
Hi guys! I am a new Hyperworks user and have some basic questions. Now I have 3 csv files and I want to import/read them and build a FEM model based on them. Here is an example.
node.csv stores the node coordinates.
0,0,0
1,0,0
2,0,0
3,0,0
0,1,0
1,1,0
2,1,0
0,2,0
1,2,0
0,3,0
quad.csv stores the node numbers for quadrilateral elements.
1,2,6,5
2,3,7,6
8,5,6,9
tri.csv stores the node numbers for triangular elements.
3,4,7
10,8,9
9,6,7
The attached image shows the model built in Ansys including 3 quad elements and 3 tri elements. I believe it can be done by simple TCL scripts in Hyperworks but I totally got lost when I read the coding tutorial. Can anyone help me with this? Thanks in advance.
Best Answer
-
Some ideas to make a script:
- Read node.csv & create nodes with the command "*createnode"
- Read quad.csv & tri.csv and create elements with the command "*createelement"
Here's my "Proof of concept": put 3 CSV files + script in the same directory & run macro. See attached zip file.
0
Answers
-
A simple script (in any language) to read CSV files and output to HMASCII format is doable. You can import HMASCII into Hypermesh later.
0 -
Here's my program to test under Windows console: (in attachment)
Import "output.hmascii" into Hypermesh:
1 -
Q.Nguyen-Dai said:
Here's my program to test under Windows console: (in attachment)
Import "output.hmascii" into Hypermesh:
Thanks for your prompt response! Unfortunately I'm using the student version Hyperworks. It won't allow me to import *.HMASCII files. Your program can be helpful for those doing a similar job with full license.
0 -
Some ideas to make a script:
- Read node.csv & create nodes with the command "*createnode"
- Read quad.csv & tri.csv and create elements with the command "*createelement"
Here's my "Proof of concept": put 3 CSV files + script in the same directory & run macro. See attached zip file.
0 -
Q.Nguyen-Dai said:
Some ideas to make a script:
- Read node.csv & create nodes with the command "*createnode"
- Read quad.csv & tri.csv and create elements with the command "*createelement"
Here's my "Proof of concept": put 3 CSV files + script in the same directory & run macro. See attached zip file.
Thank you! I successfully made a TCL script with *createnode and *createelement.
0