I want to process a list of .scad files in a folder, and i didn't understand
how to do it with command line, please could someone tell me the secret
codes?
--
View this message in context: http://forum.openscad.org/batch-processing-commands-tp13918.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On Sat, 19 Sep 2015 14:37:34 -0700 (MST)
ufomorace ant.stewart@yahoo.com wrote:
I want to process a list of .scad files in a folder, and i didn't
understand how to do it with command line, please could someone tell
me the secret codes?
The simplest of commands for one file would be:
openscad -o file.stl file.scad
You could repeat this using whatever looping construct is available in
your shell. (For windows, it's been so long I can't remember the
syntax.) For bash, you could do
for f in *.scad; do openscad -o ${f/scad/stl} $f; done
Personally, I use a Makefile with an appropriate rule for converting
any .scad file into a .stl.
%.stl: %.scad
$(OPENSCAD) -o $@ $<
A development process that involves any amount of tedium will
eventually be done poorly or not at all.
-- Matt Blodgett's First Law of Software Development
Thanks, i will figure it out and i will write it on the wiki if i can.
Ant
--
View this message in context: http://forum.openscad.org/batch-processing-commands-tp13918p13928.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
If it helps, equivalent in a Windows batch fiile is :
for %%f in (*.scad) do echo openscad -o %%~nf.stl %%f
--
View this message in context: http://forum.openscad.org/batch-processing-commands-tp13918p13931.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
That should be
for %%f in (*.scad) do openscad -o %%~nf.stl %%f
of course.
--
View this message in context: http://forum.openscad.org/batch-processing-commands-tp13918p13932.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
oh my god awesome. i will write that to the wiki and to various resources. i
was going to take at least an hour of learning a new code to find that line
\8D/
--
View this message in context: http://forum.openscad.org/batch-processing-commands-tp13918p13947.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I'll change to a new email soon, save from the pop routing errors.
in the end i had a .bat file with text:
for %%f in (*.scad) do openscad -o %%~nf.stl %%f
written in it, and i had to set the PATH using this else it didnt recognize
openscad:
*** GUIDE FOR SETTING WINDOWS PATH ENTRIES FOR CMD.EXE:***
Start the System Control Panel applet (Start - Settings - Control Panel -
System).
Select the Advanced tab.
Click the Environment Variables button.
Under System Variables, select Path, then click Edit.
You'll see a list of folders, as this example for my system shows:
C:\Program Files\Windows Resource
Kits\Tools;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program
Files\Support Tools;C:\Program Files\Common Files\Roxio
Shared\DLLShared;C:\Program Files\Common Files\Ulead Systems\MPEG;C:\Program
Files\Intel\DMIX;C:\Program Files\Executive Software\Diskeeper;C:\Program
Files\Bonjour;C:\Program Files\QuickTime\QTSystem;C:\Program Files\Misc
You can add additional folders that you want to include in searches. I add a
"C:\program files\misc" entry into which I place my standalone utilities,
instead of copying them into C:\windows. Click OK.
You'll need to restart the processes (e.g., command prompt) that use the
system path to see the added folders.
--
View this message in context: http://forum.openscad.org/batch-processing-commands-tp13918p13949.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I ran the command on some files from kit wallace's website for a test and
about 1/3rd of the .scad files were processed.
So i ran it on a couple of dozen of my .scad files and only 1/20 files was
processed. If i run the program without the -o command, it opens 20 windows
at once, all of them have empty code windows except for one of them that had
one line of code in it.
--
View this message in context: http://forum.openscad.org/batch-processing-commands-tp13918p13950.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
ok it seems like it's working although perhaps it's not totally there, here
is what i did:
had to rename all the files with spaces " " to "_" because cmd.exe didn't
see them,
to do that:
1/ run powershell.exe from system3d/windowspowershell or just the run
console
2/ type cd "D:\my dir\batch dir"
3/ do this powershell command: Dir | Rename-Item –NewName { $.name
–replace “ “,”” }
4/ then run the script from a .bat file... FOR %%f in (*.scad) DO openscad
-o %%_nf.stl %%f
we can also write batch files from powershell for windows it's the new
cmd.exe since 2009 it has more flexibility and more ledgible, but it's still
an entirely new code so only for those who want to learn powershell syntax.
--
View this message in context: http://forum.openscad.org/batch-processing-commands-tp13918p13953.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
You can put file names in double quotes for spaces and the like,
but I strongly recommend make.
Just my $0.02
From: Discuss [discuss-bounces@lists.openscad.org] on behalf of ufomorace [ant.stewart@yahoo.com]
Sent: 22 September 2015 10:41
To: discuss@lists.openscad.org
Subject: Re: [OpenSCAD] batch processing commands
ok it seems like it's working although perhaps it's not totally there, here
is what i did:
had to rename all the files with spaces " " to "_" because cmd.exe didn't
see them,
to do that:
1/ run powershell.exe from system3d/windowspowershell or just the run
console
2/ type cd "D:\my dir\batch dir"
3/ do this powershell command: Dir | Rename-Item –NewName { $.name
–replace “ “,”” }
4/ then run the script from a .bat file... FOR %%f in (*.scad) DO openscad
-o %%_nf.stl %%f
we can also write batch files from powershell for windows it's the new
cmd.exe since 2009 it has more flexibility and more ledgible, but it's still
an entirely new code so only for those who want to learn powershell syntax.
--
View this message in context: http://forum.openscad.org/batch-processing-commands-tp13918p13953.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
the files would be in a double quotes with a wild card in the current
directory, i don't know if i can write "%THIS_DIR%*.scad" kind of directory
so that the batch file can run on any pc and be a portable windows option
for batch processing scads, for others too, that's the intention. anyways it
works, will see if cmd.exe crashes after 10 files or something, quite
possible. i am after a one click solution for others and myself, not
learning powershell, batch, and makefile just so that i can make my slow
scad files :)
--
View this message in context: http://forum.openscad.org/batch-processing-commands-tp13918p13955.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Better to use Python than shell scripts as they are simpler and more
readable and run on any OS.
On 22 September 2015 at 09:03, Shaporev, Timur tim@auriga.com wrote:
You can put file names in double quotes for spaces and the like,
but I strongly recommend make.
Just my $0.02
From: Discuss [discuss-bounces@lists.openscad.org] on behalf of ufomorace
[ant.stewart@yahoo.com]
Sent: 22 September 2015 10:41
To: discuss@lists.openscad.org
Subject: Re: [OpenSCAD] batch processing commands
ok it seems like it's working although perhaps it's not totally there, here
is what i did:
had to rename all the files with spaces " " to "_" because cmd.exe didn't
see them,
to do that:
1/ run powershell.exe from system3d/windowspowershell or just the run
console
2/ type cd "D:\my dir\batch dir"
3/ do this powershell command: Dir | Rename-Item –NewName { $.name
–replace “ “,”” }
4/ then run the script from a .bat file... FOR %%f in (*.scad) DO openscad
-o %%_nf.stl %%f
we can also write batch files from powershell for windows it's the new
cmd.exe since 2009 it has more flexibility and more ledgible, but it's
still
an entirely new code so only for those who want to learn powershell syntax.
--
View this message in context:
http://forum.openscad.org/batch-processing-commands-tp13918p13953.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
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
No need to rename files, just use:
FOR %%f in (*.scad) DO openscad -o "%%_nf.stl" "%%f"
make and python are great if you already have them installed, but overkill
in this case.
--
View this message in context: http://forum.openscad.org/batch-processing-commands-tp13918p13957.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
+1
On 2015-09-22 03:03, Shaporev, Timur wrote:
You can put file names in double quotes for spaces and the like,
but I strongly recommend make.
Just my $0.02
From: Discuss [discuss-bounces@lists.openscad.org] on behalf of
ufomorace [ant.stewart@yahoo.com]
Sent: 22 September 2015 10:41
To: discuss@lists.openscad.org
Subject: Re: [OpenSCAD] batch processing commands
ok it seems like it's working although perhaps it's not totally there,
here
is what i did:
had to rename all the files with spaces " " to "_" because cmd.exe
didn't
see them,
to do that:
1/ run powershell.exe from system3d/windowspowershell or just the run
console
2/ type cd "D:\my dir\batch dir"
3/ do this powershell command: Dir | Rename-Item –NewName { $.name
–replace “ “,”” }
4/ then run the script from a .bat file... FOR %%f in (*.scad) DO
openscad
-o %%_nf.stl %%f
we can also write batch files from powershell for windows it's the new
cmd.exe since 2009 it has more flexibility and more ledgible, but it's
still
an entirely new code so only for those who want to learn powershell
syntax.
--
View this message in context:
http://forum.openscad.org/batch-processing-commands-tp13918p13953.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
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
make intended to save time and it may really save lot of time in some
situations.
On 22.09.2015 13:33, bobc wrote:
No need to rename files, just use:
FOR %%f in (*.scad) DO openscad -o "%%_nf.stl" "%%f"
make and python are great if you already have them installed, but overkill
in this case.
--
View this message in context: http://forum.openscad.org/batch-processing-commands-tp13918p13957.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
make intended to save time and it may really save lot of time in some
situations.
Yes, although that only works if make knows about all the dependencies.
Otherwise a simple Makefile will only work when changing the top level
scad file.
In theory OpenSCAD can write the dependency information to make it work
in the general case, but I've never tried that yet.
ciao,
Torsten.
I used to write dependencies manually :-)
On 22.09.2015 17:26, Torsten Paul wrote:
make intended to save time and it may really save lot of time in some
situations.
Yes, although that only works if make knows about all the dependencies.
Otherwise a simple Makefile will only work when changing the top level
scad file.
In theory OpenSCAD can write the dependency information to make it work
in the general case, but I've never tried that yet.
ciao,
Torsten.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Could you describe your new workflow with batch processing Tim? I have been
busy with complicated projects in OpenSCAD and have come up with a workflow
that makes sense to me, but I am keen to learn any real programmers' best
practice.
I currently have a split like this:
Any comments or suggestions on this, and how I could fit in batch processing
where I need it?
Cheers,
Alex
-----Original Message-----
From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of Tim
V. Shaporev
Sent: 22 September 2015 16:03
To: discuss@lists.openscad.org
Subject: Re: [OpenSCAD] batch processing commands
I used to write dependencies manually :-)
On 22.09.2015 17:26, Torsten Paul wrote:
make intended to save time and it may really save lot of time in some
situations.
Yes, although that only works if make knows about all the dependencies.
Otherwise a simple Makefile will only work when changing the top level
scad file.
In theory OpenSCAD can write the dependency information to make it
work in the general case, but I've never tried that yet.
ciao,
Torsten.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
To be frank, I am just making analogy with C language workflow:
i.e. output .stl file depends on the relevant .scad file AND all its
dependencies - I guess the dependencies list includes the global
parameters file, include files, imported .stl-s and the like.
If that .stl should be generated with the same makefile earlier - this
is Ok, make can handle it.
I am not aware about details of your current workflow to say something
more detailed :-(
On 22.09.2015 18:13, Alex Gibson wrote:
Could you describe your new workflow with batch processing Tim? I have been
busy with complicated projects in OpenSCAD and have come up with a workflow
that makes sense to me, but I am keen to learn any real programmers' best
practice.
I currently have a split like this:
Any comments or suggestions on this, and how I could fit in batch processing
where I need it?
Cheers,
Alex
-----Original Message-----
From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of Tim
V. Shaporev
Sent: 22 September 2015 16:03
To: discuss@lists.openscad.org
Subject: Re: [OpenSCAD] batch processing commands
I used to write dependencies manually :-)
On 22.09.2015 17:26, Torsten Paul wrote:
make intended to save time and it may really save lot of time in some
situations.
Yes, although that only works if make knows about all the dependencies.
Otherwise a simple Makefile will only work when changing the top level
scad file.
In theory OpenSCAD can write the dependency information to make it
work in the general case, but I've never tried that yet.
ciao,
Torsten.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
On 22.09.2015 14:25, Tim V. Shaporev wrote:
make intended to save time and it may really save lot of time in some
situations.
Beware, make can act strange when fed with paths or file names
containing blanks, non-ASCII characters or reserved characters like
ampersands or braces. This problem seems to be worse when using make on
non unix systems, btw. In hugin (http://hugin.sourceforge.net/), make
has been used for generating panoramas from multiple input images, but
it had to be replaced with a processor of our own in order to overcome
these problems.
With kind regards
Stefan Peter