Create Element sets Reading External CSV File

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi

I am very New to Scripting. I need to create Element sets in Hypermesh by reading External CSV File. I need to create say two element sets SET A and SET B. and the CSV file has 12 elements separated by Delimiter $

SET A Elements in CSV FILE

=================

1,2,3

4,5,6

$

SET B Elements in CSV FILE

=================

7,8,9

10,11,12

$

Can you please help me how to read CSV file and Create SET_A and SET_B and move the elements to respective sets

I appreciate the help on this

thanks and regards

Srini

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2011

    I tried using the FOllowing Code

    set types {

    {{csv Files} {.csv} }

    }

    set fname [tk_getOpenFile -filetypes $types]

    set fname 'c:/temp.csv'

    *createmark(elements,1)

    *entitysetcreate('Set_A',elements,1)

    *elementtype(104,1)

    *createmark(elements,1) 20-23

    *movemark(elements,1,'Set_A')

    *entitysetupdate('Set_A',elements,1)