How to write a CSV file after getting all connector coordinates and linked comps id.

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

How to write a CSV file after getting all connector coordinates and linked comps id.

I have written following code:

*createmark connectors 1 all
set ce_list [ hm_getmark connectors 1];
foreach CE_L $ce_list {
set coordi [hm_ce_getcords $CE_L]
set LKD [hm_ce_getlinkentities $CE_L comps]
puts $coordi 
puts $LKD

puts 'The coordinates of connector is $coordi and its linked components are $LKD'

}

 

 

Now, I have to write a CSV file, so that I can call all those in different profiles

Answers

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited March 2018

    Hi Jouher,

    Your code should look something like below: 

     

    set str_wrfilename {c:\test.csv};
    set f_id [open $str_wrfilename w+]

    *createmark connectors 1 all
    set ce_list [ hm_getmark connectors 1];
    foreach CE_L $ce_list {
        set coordi [hm_ce_getcords $CE_L]
        set LKD [hm_ce_getlinkentities $CE_L comps]
        puts $f_id '[set coordi],[set LKD]'
    }
     close $f_id