A program to recognize and reward our most engaged community members
Hi all,
Can we write tcl variables to a excel file.
Thanks ,
Mahes
Hi Mahes,
Can you please elaborate on this, what variables are you trying to export as csv?
Hi George,
for example I have a comp id 1
I wanna get the info about the component and write to a excel file.
Thanks,
Hi
Switch model browser to 'component view' mode, right click on browser and select 'export' to csv file
Or, in utility tab, click 'component table' and select File > export to csv file
Hi tinh
I need to do in macro...the above thing is just a example.
Ok it is like this
set fpt [open c:/sample.csv w]
fconfigure $fpt -encoding uft-8
puts $fpt 'comp id,comp name,thickness'
foreach compid {1 2 3 4 5} {
puts $fpt '$compid,[hm_getentityvalue comps $compid name 1 -byid],[hm_getthickness comps $compid]'
}
close $fpt
You should use csv package with commands ::csv::join and ::csv::split to handle strings with special characters
Ok it is like this set fpt [open c:/sample.csv w] fconfigure $fpt -encoding uft-8 puts $fpt 'comp id,comp name,thickness' foreach compid {1 2 3 4 5} { puts $fpt '$compid,[hm_getentityvalue comps $compid name 1 -byid],[hm_getthickness comps $compid]' } close $fpt You should use csv package with commands ::csv::join and ::csv::split to handle strings with special characters
Thanks tinh.
I will try thiz champ
Hi tinh,
@tinh
for using fconfigure , uft is there any package I need to import
mahes
No, you don't.
it is for case you have unicode characters in data, example compnáme
Thanks tinh..