discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

batch processing commands

U
ufomorace
Sat, Sep 19, 2015 9:37 PM

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.

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.
GW
G. Wade Johnson
Sun, Sep 20, 2015 1:35 AM

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 $@ $<

HTH,
G. Wade

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

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 $@ $< HTH, G. Wade -- 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
U
ufomorace
Sun, Sep 20, 2015 6:27 PM

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.

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.
B
bobc
Sun, Sep 20, 2015 9:29 PM

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.

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.
B
bobc
Sun, Sep 20, 2015 9:33 PM

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.

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.
U
ufomorace
Mon, Sep 21, 2015 8:04 AM

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.

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.
U
ufomorace
Mon, Sep 21, 2015 8:35 PM

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'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.
U
ufomorace
Tue, Sep 22, 2015 2:36 AM

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.

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.
U
ufomorace
Tue, Sep 22, 2015 7:41 AM

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.

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.
ST
Shaporev, Timur
Tue, Sep 22, 2015 8:03 AM

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

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