Hi Matthias,
I would like to know if it is possible to create a text file with a Ruby script. My idea is to get a summary of parameters and calculations at the end of the macro execution.
Example:
Project name: xxxx
Area: yyyy
CD: zzzz
....
Thanks in advance for your answer.
Eric
Comments
Outputting a text file from Ruby can be done in several ways -- search google for other examples if the below doesn't suit.
I will also note that there is a relatively easy way to just get a hash with all of the variables in it. So, if in your code you've calculated project_name, area, cd, ..., then you run this code to generate a hash with everything you want, then output it to txt file.
I used the following code that it perfectly works for my need:
summaryfile = 'C:\Users\xxxxh\KLayout\Rep_travail\Template\Summary.txt'
File.open(summaryfile, 'w') do |out|
out << "Project name: #{project_name.text} \n"
out << "Design area : #{area} \n"
out << "CD: #{cd} \n"