how to read a csv file and create nodes from coordinates

Jouher_20929
Jouher_20929 Altair Community Member
edited October 2020 in Community Q&A

I have written a CSV file. Now i have to read the file, create nodes at each coordinates, get created node ids.

 

set dir [tk_chooseDirectory \
        -initialdir ~ -title 'Choose a directory']
cd $dir
set fp [open '$dir/Connectors_comp.csv' w+]

*createmark connectors 1 all
set ce_list [ hm_getmark connectors 1];


puts $fp 'connector id,connector coordinates,linked comps id'

foreach CE_L $ce_list {

puts $fp '$CE_L,[hm_ce_getcords $CE_L],[hm_ce_getlinkentities $CE_L comps]'


}
close $fp

Answers