discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

batch processing commands

U
ufomorace
Tue, Sep 22, 2015 8:22 AM

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.

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.
NH
nop head
Tue, Sep 22, 2015 8:29 AM

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

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 >
B
bobc
Tue, Sep 22, 2015 10:33 AM

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.

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.
G
gwadej@anomaly.org
Tue, Sep 22, 2015 10:59 AM

+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

+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
TV
Tim V. Shaporev
Tue, Sep 22, 2015 12:25 PM

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. 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 >
TP
Torsten Paul
Tue, Sep 22, 2015 2:26 PM

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.

> 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.
TV
Tim V. Shaporev
Tue, Sep 22, 2015 3:03 PM

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

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 >
AG
Alex Gibson
Tue, Sep 22, 2015 3:13 PM

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:

  1. Library files I use all the time in 3 groups:
    SCAD I have made
    SCAD I have borrowed from others :)
    STLS
  2. Global parameters file, which contains:
    Include/use commands to bring in the above
    All my project specific measurements
    Tolerance/Fudge factors
    variables I may change
  3. Sub-assembly files
    Intermediate calculated parameters
    Modules for each component in the sub-assembly
    2D rendering for any laser cut parts
  4. Final assembly
    Include files for the components above
    Call the modules from the sub-assemblies, in colour where
    appropriate.

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

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: 1) Library files I use all the time in 3 groups: SCAD I have made SCAD I have borrowed from others :) STLS 2) Global parameters file, which contains: Include/use commands to bring in the above All my project specific measurements Tolerance/Fudge factors variables I may change 3) Sub-assembly files Intermediate calculated parameters Modules for each component in the sub-assembly 2D rendering for any laser cut parts 4) Final assembly Include files for the components above Call the modules from the sub-assemblies, in colour where appropriate. 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 > _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
TV
Tim V. Shaporev
Tue, Sep 22, 2015 3:26 PM

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:

  1. Library files I use all the time in 3 groups:
    SCAD I have made
    SCAD I have borrowed from others :)
    STLS
  2. Global parameters file, which contains:
    Include/use commands to bring in the above
    All my project specific measurements
    Tolerance/Fudge factors
    variables I may change
  3. Sub-assembly files
    Intermediate calculated parameters
    Modules for each component in the sub-assembly
    2D rendering for any laser cut parts
  4. Final assembly
    Include files for the components above
    Call the modules from the sub-assemblies, in colour where
    appropriate.

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: > > 1) Library files I use all the time in 3 groups: > SCAD I have made > SCAD I have borrowed from others :) > STLS > 2) Global parameters file, which contains: > Include/use commands to bring in the above > All my project specific measurements > Tolerance/Fudge factors > variables I may change > 3) Sub-assembly files > Intermediate calculated parameters > Modules for each component in the sub-assembly > 2D rendering for any laser cut parts > 4) Final assembly > Include files for the components above > Call the modules from the sub-assemblies, in colour where > appropriate. > > 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 >> > > > _______________________________________________ > 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 >
SP
Stefan Peter
Tue, Sep 22, 2015 3:50 PM

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

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