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 on how High-Performance Computing (HPC) and Simcenter PSIM work together to meet the increasing demands of modern power electronics simulation. During this one-hour technical session, you'll discover how leveraging HPC can speed up simulations, improve scalability, and empower engineers…
Join us for a community conversation on accelerating your motor simulation workflow with Simcenter Simlab. In this beginner-friendly session, we'll introduce the platform's automated model-building capabilities and show how easy it is to set up your first electric motor analysis. You'll see the basic steps of geometry…
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…