The Siemens Community Catalyst program was co-created with our community to acknowledge technology leaders who consistently contribute to the Siemens Community. Nominations are accepted on a rolling basis.
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..
Join us for a Community Conversation where we'll discuss practical approaches to analyzing complex electromagnetic models using hybrid solver techniques. This session will provide a general overview of how different computational methods can be combined within a single simulation to address models containing varied…
Join us for a community conversation to explore how different modeling approaches in Simcenter PSIM can help engineers simulate power electronics systems while balancing accuracy, simulation speed, and design insight. What you'll learn: Power transistor modeling : Thermal and high fidelity models Protection component…