🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

TCL scripts for importing nodes and elements from csv files

User: "JZ_21971"
Altair Community Member
Updated by JZ_21971

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. 

image

Find more posts tagged with

Sort by:
1 - 5 of 51
    User: "QuyNguyenDai"
    Altair Community Member
    Updated by QuyNguyenDai

    A simple script (in any language) to read CSV files and output to HMASCII format is doable. You can import HMASCII into Hypermesh later.

    User: "QuyNguyenDai"
    Altair Community Member
    Updated by QuyNguyenDai

    Here's my program to test under Windows console: (in attachment)

    Import "output.hmascii" into Hypermesh:

    image

     

     

    User: "JZ_21971"
    Altair Community Member
    OP
    Updated by JZ_21971

    Here's my program to test under Windows console: (in attachment)

    Import "output.hmascii" into Hypermesh:

    image

     

     

    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.

    User: "QuyNguyenDai"
    Altair Community Member
    Accepted Answer
    Updated by QuyNguyenDai

    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.

     

    User: "JZ_21971"
    Altair Community Member
    OP
    Updated by JZ_21971

    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.