discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Multiple objects in a file

NH
nop head
Sun, Jan 30, 2022 4:44 PM

I am designing a multi-material printer but I won't need any support in
OpenSCAD and probably not in a slicer. I will add a material property to my
STL module. All my stls get exported automatically anyway. I will probably
get my framework to slice each bit separately and then merge the g-code
with tool changes using a simple bit of Python.

On Sun, 30 Jan 2022 at 16:29, Jordan Brown openscad@jordan.maileater.net
wrote:

I keep thinking about multi-color / multi-material support.  It seems like
such support will want to operate in a couple of modes, either exporting to
a multi-object format like 3MF or exporting multiple STLs in one shot.  Now
if only I had the free time...


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I am designing a multi-material printer but I won't need any support in OpenSCAD and probably not in a slicer. I will add a material property to my STL module. All my stls get exported automatically anyway. I will probably get my framework to slice each bit separately and then merge the g-code with tool changes using a simple bit of Python. On Sun, 30 Jan 2022 at 16:29, Jordan Brown <openscad@jordan.maileater.net> wrote: > I keep thinking about multi-color / multi-material support. It seems like > such support will want to operate in a couple of modes, either exporting to > a multi-object format like 3MF or exporting multiple STLs in one shot. Now > if only I had the free time... > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Sun, Jan 30, 2022 4:51 PM

On 1/30/2022 8:44 AM, nop head wrote:

I am designing a multi-material printer but I won't need any support
in OpenSCAD and probably not in a slicer. I will add a material
property to my STL module. All my stls get exported automatically
anyway. I will probably get my framework to slice each bit separately
and then merge the g-code with tool changes using a simple bit of Python.

Need support in OpenSCAD?  No.  Would be nice?  Yes.

Ideally, you could say

color("red") cube(10);
translate([0,0,10]) color("blue") cube(10);

and OpenSCAD would produce a file (or files) directly suitable for
handing to a multi-material slicer.

On 1/30/2022 8:44 AM, nop head wrote: > I am designing a multi-material printer but I won't need any support > in OpenSCAD and probably not in a slicer. I will add a material > property to my STL module. All my stls get exported automatically > anyway. I will probably get my framework to slice each bit separately > and then merge the g-code with tool changes using a simple bit of Python. *Need* support in OpenSCAD?  No.  Would be nice?  Yes. Ideally, you could say color("red") cube(10); translate([0,0,10]) color("blue") cube(10); and OpenSCAD would produce a file (or files) directly suitable for handing to a multi-material slicer.
DP
David Phillip Oster
Sun, Jan 30, 2022 7:22 PM

If I have 3 modules, all in one file and I want to generate separate STLs
for each module, I use something like:

foo = (undef == foo) ? 0 : foo;

module switch(n) {  children([n]); }

switch(foo){

all();

part1();

part2();

part3();

}

and a command line like:

/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -Dfoo=1 def.scad -o
part1.stl

/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -Dfoo=2 def.scad -o
part2.stl

/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -Dfoo=3 def.scad -o
part3.stl

Obviously, that command line would be in a for loop in a shell script.

If I have 3 modules, all in one file and I want to generate separate STLs for each module, I use something like: foo = (undef == foo) ? 0 : foo; module switch(n) { children([n]); } switch(foo){ all(); part1(); part2(); part3(); } and a command line like: /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -Dfoo=1 def.scad -o part1.stl /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -Dfoo=2 def.scad -o part2.stl /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -Dfoo=3 def.scad -o part3.stl Obviously, that command line would be in a for loop in a shell script.
NH
nop head
Sun, Jan 30, 2022 7:57 PM

But the fact that two components of the design are different colors is
part of the design, no?

Not really. I colour printed parts in my design contrasting colours to be
able to see where one part ends and another starts. I start with RepRap
green and if there is a mating part it is coloured red and then blue, etc.

[image: image.png]

When I printed it it was all one colour but I don't even remember what it
was. Most likely black,  whatever ABS I had loaded at the time on the
machine I used to print it. It doesn't matter what colour it is, the design
will still function but it matters that it isn't PLA or TPU. I might print
the next one in transparent PC.

On Sun, 30 Jan 2022 at 19:22, David Phillip Oster <
davidphilliposter@gmail.com> wrote:

If I have 3 modules, all in one file and I want to generate separate STLs
for each module, I use something like:

foo = (undef == foo) ? 0 : foo;

module switch(n) {  children([n]); }

switch(foo){

all();

part1();

part2();

part3();

}

and a command line like:

/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -Dfoo=1 def.scad -o
part1.stl

/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -Dfoo=2 def.scad -o
part2.stl

/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -Dfoo=3 def.scad -o
part3.stl

Obviously, that command line would be in a for loop in a shell script.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

> > But the fact that two components of the design are different colors is > part of the design, no? Not really. I colour printed parts in my design contrasting colours to be able to see where one part ends and another starts. I start with RepRap green and if there is a mating part it is coloured red and then blue, etc. [image: image.png] When I printed it it was all one colour but I don't even remember what it was. Most likely black, whatever ABS I had loaded at the time on the machine I used to print it. It doesn't matter what colour it is, the design will still function but it matters that it isn't PLA or TPU. I might print the next one in transparent PC. On Sun, 30 Jan 2022 at 19:22, David Phillip Oster < davidphilliposter@gmail.com> wrote: > If I have 3 modules, all in one file and I want to generate separate STLs > for each module, I use something like: > > foo = (undef == foo) ? 0 : foo; > > > module switch(n) { children([n]); } > > > switch(foo){ > > all(); > > part1(); > > part2(); > > part3(); > > } > > and a command line like: > > /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -Dfoo=1 def.scad -o > part1.stl > > /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -Dfoo=2 def.scad -o > part2.stl > > /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -Dfoo=3 def.scad -o > part3.stl > > > Obviously, that command line would be in a for loop in a shell script. > > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
M
MichaelAtOz
Mon, Jan 31, 2022 12:03 AM

But the fact that two components of the design are different colors is part of the design, no?

Not really.

Some people use OpenSCAD for art or decorative objects, not just functional objects.

I've been hoping for multi/colour/material support for a long time, but realise it's not on the horizon.

--
This email has been checked for viruses by AVG.
https://www.avg.com

But the fact that two components of the design are different colors is part of the design, no? Not really. Some people use OpenSCAD for art or decorative objects, not just functional objects. I've been hoping for multi/colour/material support for a long time, but realise it's not on the horizon. -- This email has been checked for viruses by AVG. https://www.avg.com
JS
Jesse Schobben
Mon, Jan 31, 2022 12:46 PM

It's not quite direct OpenSCAD support, but you could use a shell script
to export individual colors one by one, and then combine the result into
a colored 3mf.

Sometime ago I made a script that does this (see
https://github.com/jschobben/colorscad). As long as you avoid boolean
ops on multiple colors (or just apply color to the boolean op), output
should look like the preview.

Would be nice of course to have that supported in OpenSCAD itself, but I
guess it isn't all that straightforward to do it in a clean way.

On 30-1-2022 17:51, Jordan Brown wrote:

On 1/30/2022 8:44 AM, nop head wrote:

I am designing a multi-material printer but I won't need any support
in OpenSCAD and probably not in a slicer. I will add a material
property to my STL module. All my stls get exported automatically
anyway. I will probably get my framework to slice each bit separately
and then merge the g-code with tool changes using a simple bit of Python.

Need support in OpenSCAD?  No.  Would be nice?  Yes.

Ideally, you could say

 color("red") cube(10);
 translate([0,0,10]) color("blue") cube(10);

and OpenSCAD would produce a file (or files) directly suitable for
handing to a multi-material slicer.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

It's not quite direct OpenSCAD support, but you could use a shell script to export individual colors one by one, and then combine the result into a colored 3mf. Sometime ago I made a script that does this (see https://github.com/jschobben/colorscad). As long as you avoid boolean ops on multiple colors (or just apply color to the boolean op), output should look like the preview. Would be nice of course to have that supported in OpenSCAD itself, but I guess it isn't all that straightforward to do it in a clean way. On 30-1-2022 17:51, Jordan Brown wrote: > On 1/30/2022 8:44 AM, nop head wrote: >> I am designing a multi-material printer but I won't need any support >> in OpenSCAD and probably not in a slicer. I will add a material >> property to my STL module. All my stls get exported automatically >> anyway. I will probably get my framework to slice each bit separately >> and then merge the g-code with tool changes using a simple bit of Python. > > *Need* support in OpenSCAD?  No.  Would be nice?  Yes. > > Ideally, you could say > > color("red") cube(10); > translate([0,0,10]) color("blue") cube(10); > > and OpenSCAD would produce a file (or files) directly suitable for > handing to a multi-material slicer. > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
NH
nop head
Mon, Jan 31, 2022 3:48 PM

I haven't written a shell script since I came across Python. It can do
anything a shell script does with a simpler syntax and runs on all
platforms.

On Mon, 31 Jan 2022 at 13:34, Jesse Schobben openscad@js3.nl wrote:

It's not quite direct OpenSCAD support, but you could use a shell script
to export individual colors one by one, and then combine the result into a
colored 3mf.

Sometime ago I made a script that does this (see
https://github.com/jschobben/colorscad). As long as you avoid boolean ops
on multiple colors (or just apply color to the boolean op), output should
look like the preview.

Would be nice of course to have that supported in OpenSCAD itself, but I
guess it isn't all that straightforward to do it in a clean way.

On 30-1-2022 17:51, Jordan Brown wrote:

On 1/30/2022 8:44 AM, nop head wrote:

I am designing a multi-material printer but I won't need any support in
OpenSCAD and probably not in a slicer. I will add a material property to my
STL module. All my stls get exported automatically anyway. I will probably
get my framework to slice each bit separately and then merge the g-code
with tool changes using a simple bit of Python.

Need support in OpenSCAD?  No.  Would be nice?  Yes.

Ideally, you could say

color("red") cube(10);
translate([0,0,10]) color("blue") cube(10);

and OpenSCAD would produce a file (or files) directly suitable for handing
to a multi-material slicer.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I haven't written a shell script since I came across Python. It can do anything a shell script does with a simpler syntax and runs on all platforms. On Mon, 31 Jan 2022 at 13:34, Jesse Schobben <openscad@js3.nl> wrote: > It's not quite direct OpenSCAD support, but you could use a shell script > to export individual colors one by one, and then combine the result into a > colored 3mf. > > Sometime ago I made a script that does this (see > https://github.com/jschobben/colorscad). As long as you avoid boolean ops > on multiple colors (or just apply color to the boolean op), output should > look like the preview. > > Would be nice of course to have that supported in OpenSCAD itself, but I > guess it isn't all that straightforward to do it in a clean way. > > On 30-1-2022 17:51, Jordan Brown wrote: > > On 1/30/2022 8:44 AM, nop head wrote: > > I am designing a multi-material printer but I won't need any support in > OpenSCAD and probably not in a slicer. I will add a material property to my > STL module. All my stls get exported automatically anyway. I will probably > get my framework to slice each bit separately and then merge the g-code > with tool changes using a simple bit of Python. > > > *Need* support in OpenSCAD? No. Would be nice? Yes. > > Ideally, you could say > > color("red") cube(10); > translate([0,0,10]) color("blue") cube(10); > > and OpenSCAD would produce a file (or files) directly suitable for handing > to a multi-material slicer. > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >