Today, I have two ways I do my scripts:
Use a program I've written to generate the scripts from Excel, where I do
my calculations. This makes for awkward script programming when I want to do
something complicated, but it allows me to use the measurements as input for
a parts list when I'm going to buy stuff when building the object.
Use Excel to simply generate a few seed measurements variables into a
script which I include in the main script, then script normally and do the
calculations in the script. Neater scripting, but doesn't allow me to export
the calculated values in a sample way, so I can't generate the parts lists.
I would like to work according to #2, but that would require duplicating a
lot of calculations (with all the errors that'll bring). However, if there
was a simple way to export some variables, it would be doable.
Basically, something like (for example):
writefile("c:\temp\myfile.txt", myvar); //Appends variable to file, creating
the file if needed
writefile("c:\temp\myfile.txt", myothervar);
Which would result in (assuming values 1 and 2):
myvar=1
myothervar=2
This, of course, would be easy to handle in further processing stages.
Of course, some command to delete a file would also be needed.
Basically, OpenSCAD is great when it works alone, but when you have to put
it in a larger process, some means of connecting things together is needed.
--
View this message in context: http://forum.openscad.org/Writing-to-files-tp21005.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I just use echo and then post process the output with python.
On 23 March 2017 at 11:48, Troberg troberg.anders@gmail.com wrote:
Today, I have two ways I do my scripts:
Use a program I've written to generate the scripts from Excel, where I
do
my calculations. This makes for awkward script programming when I want to
do
something complicated, but it allows me to use the measurements as input
for
a parts list when I'm going to buy stuff when building the object.
Use Excel to simply generate a few seed measurements variables into a
script which I include in the main script, then script normally and do the
calculations in the script. Neater scripting, but doesn't allow me to
export
the calculated values in a sample way, so I can't generate the parts lists.
I would like to work according to #2, but that would require duplicating a
lot of calculations (with all the errors that'll bring). However, if there
was a simple way to export some variables, it would be doable.
Basically, something like (for example):
writefile("c:\temp\myfile.txt", myvar); //Appends variable to file,
creating
the file if needed
writefile("c:\temp\myfile.txt", myothervar);
Which would result in (assuming values 1 and 2):
myvar=1
myothervar=2
This, of course, would be easy to handle in further processing stages.
Of course, some command to delete a file would also be needed.
Basically, OpenSCAD is great when it works alone, but when you have to put
it in a larger process, some means of connecting things together is needed.
--
View this message in context: http://forum.openscad.org/
Writing-to-files-tp21005.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Is there a way to redirect the echo output to a file, or do I have to do the
copy-paste dance?
--
View this message in context: http://forum.openscad.org/Writing-to-files-tp21005p21045.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
If you are using the GUI, the later.
You could try the command line
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_OpenSCAD_in_a_command_line_environment
.
Admin - PM me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Writing-to-files-tp21005p21046.html
Sent from the OpenSCAD mailing list archive at Nabble.com.