discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

color extends beyond the given object

BE
Bob Ewart
Thu, Nov 10, 2022 8:46 PM

I am trying to do a 2 color print with the second color being a section
through the middle of the first.

In this example the main object is a cube(20) and the section is rotated
and is larger than the main object.  The first color is the difference
between the main object and the overlay, the second is the intersection
of the two.

When I color the second part with green and combining the two I was
expecting to see the two parts in different colors.  What I got is:

The image on the left should be a natural color cube with the green
section through the middle.

--

Bob

I am trying to do a 2 color print with the second color being a section through the middle of the first. In this example the main object is a cube(20) and the section is rotated and is larger than the main object.  The first color is the difference between the main object and the overlay, the second is the intersection of the two. When I color the second part with green and combining the two I was expecting to see the two parts in different colors.  What I got is: The image on the left should be a natural color cube with the green section through the middle. -- Bob
RW
Raymond West
Thu, Nov 10, 2022 10:49 PM

when you combine two coloured objects, to make a single object, it takes
the colour of the last object in the list, afaik. If you want to see
separate colours, then make the insert a bit smaller, say, so it does
not touch the cube to make a single object.

translate([-22,0,0]) {
//color("red")
    extruder0();
   //color("red")
   color("green")
 //  scale([0.99,0.99,0.99])
   extruder1();
   color("red")
    extruder0();
}

remove the comments, move the parts around, see what happens.

On 10/11/2022 20:46, Bob Ewart wrote:

I am trying to do a 2 color print with the second color being a
section through the middle of the first.

In this example the main object is a cube(20) and the section is
rotated and is larger than the main object.  The first color is the
difference between the main object and the overlay, the second is the
intersection of the two.

When I color the second part with green and combining the two I was
expecting to see the two parts in different colors.  What I got is:

The image on the left should be a natural color cube with the green
section through the middle.

--
Bob


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

when you combine two coloured objects, to make a single object, it takes the colour of the last object in the list, afaik. If you want to see separate colours, then make the insert a bit smaller, say, so it does not touch the cube to make a single object. translate([-22,0,0]) { //color("red")     extruder0();    //color("red")    color("green")  //  scale([0.99,0.99,0.99])    extruder1();    color("red")     extruder0(); } remove the comments, move the parts around, see what happens. On 10/11/2022 20:46, Bob Ewart wrote: > > I am trying to do a 2 color print with the second color being a > section through the middle of the first. > > In this example the main object is a cube(20) and the section is > rotated and is larger than the main object.  The first color is the > difference between the main object and the overlay, the second is the > intersection of the two. > > When I color the second part with green and combining the two I was > expecting to see the two parts in different colors.  What I got is: > > The image on the left should be a natural color cube with the green > section through the middle. > > -- > Bob > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
BC
Bob Carter
Fri, Nov 11, 2022 9:16 AM

I have a number of coloured assembly diagrams - that I produce by exporting the individual parts as STL files then importing and colouring them in a separate assembly scad file…

Love to know if there was an easier way - but this works for me.

On 10 Nov 2022, at 22:49, Raymond West raywest@raywest.com wrote:

when you combine two coloured objects, to make a single object, it takes the colour of the last object in the list, afaik. If you want to see separate colours, then make the insert a bit smaller, say, so it does not touch the cube to make a single object.

translate([-22,0,0]) {
//color("red")
extruder0();
//color("red")
color("green")
//  scale([0.99,0.99,0.99])
extruder1();
color("red")
extruder0();
}

remove the comments, move the parts around, see what happens.

On 10/11/2022 20:46, Bob Ewart wrote:

I am trying to do a 2 color print with the second color being a section through the middle of the first.

In this example the main object is a cube(20) and the section is rotated and is larger than the main object.  The first color is the difference between the main object and the overlay, the second is the intersection of the two.

When I color the second part with green and combining the two I was expecting to see the two parts in different colors.  What I got is:

<test_overlap.png>

The image on the left should be a natural color cube with the green section through the middle.

--
Bob


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


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

I have a number of coloured assembly diagrams - that I produce by exporting the individual parts as STL files then importing and colouring them in a separate assembly scad file… Love to know if there was an easier way - but this works for me. > On 10 Nov 2022, at 22:49, Raymond West <raywest@raywest.com> wrote: > > when you combine two coloured objects, to make a single object, it takes the colour of the last object in the list, afaik. If you want to see separate colours, then make the insert a bit smaller, say, so it does not touch the cube to make a single object. > > translate([-22,0,0]) { > //color("red") > extruder0(); > //color("red") > color("green") > // scale([0.99,0.99,0.99]) > extruder1(); > color("red") > extruder0(); > } > > remove the comments, move the parts around, see what happens. > > On 10/11/2022 20:46, Bob Ewart wrote: >> I am trying to do a 2 color print with the second color being a section through the middle of the first. >> >> In this example the main object is a cube(20) and the section is rotated and is larger than the main object. The first color is the difference between the main object and the overlay, the second is the intersection of the two. >> >> When I color the second part with green and combining the two I was expecting to see the two parts in different colors. What I got is: >> >> <test_overlap.png> >> >> The image on the left should be a natural color cube with the green section through the middle. >> >> -- >> Bob >> >> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
NH
nop head
Fri, Nov 11, 2022 10:34 AM

You can use render() instead of exporting and importing the STL. I do that
for assembly views in the GUI but when making assembly diagrams from the
command line I know the STLS have been created first, so I do import them
to speed things up.

On Fri, 11 Nov 2022 at 09:17, Bob Carter caggius@gmail.com wrote:

I have a number of coloured assembly diagrams - that I produce by
exporting the individual parts as STL files then importing and colouring
them in a separate assembly scad file…

Love to know if there was an easier way - but this works for me.

On 10 Nov 2022, at 22:49, Raymond West raywest@raywest.com wrote:

when you combine two coloured objects, to make a single object, it takes
the colour of the last object in the list, afaik. If you want to see
separate colours, then make the insert a bit smaller, say, so it does not
touch the cube to make a single object.

translate([-22,0,0]) {
//color("red")
extruder0();
//color("red")
color("green")
//  scale([0.99,0.99,0.99])
extruder1();
color("red")
extruder0();
}

remove the comments, move the parts around, see what happens.
On 10/11/2022 20:46, Bob Ewart wrote:

I am trying to do a 2 color print with the second color being a section
through the middle of the first.

In this example the main object is a cube(20) and the section is rotated
and is larger than the main object.  The first color is the difference
between the main object and the overlay, the second is the intersection of
the two.

When I color the second part with green and combining the two I was
expecting to see the two parts in different colors.  What I got is:

<test_overlap.png>

The image on the left should be a natural color cube with the green
section through the middle.

Bob


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


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

You can use render() instead of exporting and importing the STL. I do that for assembly views in the GUI but when making assembly diagrams from the command line I know the STLS have been created first, so I do import them to speed things up. On Fri, 11 Nov 2022 at 09:17, Bob Carter <caggius@gmail.com> wrote: > I have a number of coloured assembly diagrams - that I produce by > exporting the individual parts as STL files then importing and colouring > them in a separate assembly scad file… > > Love to know if there was an easier way - but this works for me. > > > On 10 Nov 2022, at 22:49, Raymond West <raywest@raywest.com> wrote: > > when you combine two coloured objects, to make a single object, it takes > the colour of the last object in the list, afaik. If you want to see > separate colours, then make the insert a bit smaller, say, so it does not > touch the cube to make a single object. > > translate([-22,0,0]) { > //color("red") > extruder0(); > //color("red") > color("green") > // scale([0.99,0.99,0.99]) > extruder1(); > color("red") > extruder0(); > } > > remove the comments, move the parts around, see what happens. > On 10/11/2022 20:46, Bob Ewart wrote: > > I am trying to do a 2 color print with the second color being a section > through the middle of the first. > > In this example the main object is a cube(20) and the section is rotated > and is larger than the main object. The first color is the difference > between the main object and the overlay, the second is the intersection of > the two. > > When I color the second part with green and combining the two I was > expecting to see the two parts in different colors. What I got is: > > <test_overlap.png> > > The image on the left should be a natural color cube with the green > section through the middle. > -- > > Bob > > > > > _______________________________________________ > 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 > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
BE
Bob Ewart
Fri, Nov 11, 2022 11:05 AM

Thanks nop head  -- render does the trick;

render() extruder0();
color("green") render() extruder1();

shows the insert in color without distorting the geometry.

--
Bob

On 11/11/22 05:34, nop head wrote:

You can use render() instead of exporting and importing the STL. I do
that for assembly views in the GUI but when making assembly diagrams
from the command line I know the STLS have been created first, so I do
import them to speed things up.

On Fri, 11 Nov 2022 at 09:17, Bob Carter caggius@gmail.com wrote:

 I have a number of coloured assembly diagrams - that I produce by
 exporting the individual parts as STL files then importing and
 colouring them in a separate assembly scad file…

 Love to know if there was an easier way - but this works for me.
 On 10 Nov 2022, at 22:49, Raymond West <raywest@raywest.com> wrote:

 when you combine two coloured objects, to make a single object,
 it takes the colour of the last object in the list, afaik. If you
 want to see separate colours, then make the insert a bit smaller,
 say, so it does not touch the cube to make a single object.

 translate([-22,0,0]) {
 //color("red")
     extruder0();
    //color("red")
    color("green")
  //  scale([0.99,0.99,0.99])
    extruder1();
    color("red")
     extruder0();
 }

 remove the comments, move the parts around, see what happens.

 On 10/11/2022 20:46, Bob Ewart wrote:
 I am trying to do a 2 color print with the second color being a
 section through the middle of the first.

 In this example the main object is a cube(20) and the section is
 rotated and is larger than the main object.  The first color is
 the difference between the main object and the overlay, the
 second is the intersection of the two.

 When I color the second part with green and combining the two I
 was expecting to see the two parts in different colors.  What I
 got is:

 <test_overlap.png>

 The image on the left should be a natural color cube with the
 green section through the middle.

 -- 
 Bob



 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email todiscuss-leave@lists.openscad.org
 _______________________________________________
 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

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

Thanks nop head  -- render does the trick; render() extruder0(); color("green") render() extruder1(); shows the insert in color without distorting the geometry. -- Bob On 11/11/22 05:34, nop head wrote: > You can use render() instead of exporting and importing the STL. I do > that for assembly views in the GUI but when making assembly diagrams > from the command line I know the STLS have been created first, so I do > import them to speed things up. > > On Fri, 11 Nov 2022 at 09:17, Bob Carter <caggius@gmail.com> wrote: > > I have a number of coloured assembly diagrams - that I produce by > exporting the individual parts as STL files then importing and > colouring them in a separate assembly scad file… > > Love to know if there was an easier way - but this works for me. > > >> On 10 Nov 2022, at 22:49, Raymond West <raywest@raywest.com> wrote: >> >> when you combine two coloured objects, to make a single object, >> it takes the colour of the last object in the list, afaik. If you >> want to see separate colours, then make the insert a bit smaller, >> say, so it does not touch the cube to make a single object. >> >> translate([-22,0,0]) { >> //color("red") >>     extruder0(); >>    //color("red") >>    color("green") >>  //  scale([0.99,0.99,0.99]) >>    extruder1(); >>    color("red") >>     extruder0(); >> } >> >> remove the comments, move the parts around, see what happens. >> >> On 10/11/2022 20:46, Bob Ewart wrote: >>> >>> I am trying to do a 2 color print with the second color being a >>> section through the middle of the first. >>> >>> In this example the main object is a cube(20) and the section is >>> rotated and is larger than the main object.  The first color is >>> the difference between the main object and the overlay, the >>> second is the intersection of the two. >>> >>> When I color the second part with green and combining the two I >>> was expecting to see the two parts in different colors.  What I >>> got is: >>> >>> <test_overlap.png> >>> >>> The image on the left should be a natural color cube with the >>> green section through the middle. >>> >>> -- >>> Bob >>> >>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email todiscuss-leave@lists.openscad.org >> _______________________________________________ >> 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 > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
AM
Adrian Mariano
Fri, Nov 11, 2022 1:19 PM

BOSL2 has some features for giving better control of color.  However, for
them to work your objects have to be "attachable" which requires some extra
effort.

BOSL2 supplies a recolor() module that changes the color of the children,
and a color_this() module that colors at one level, with color reverting in
the children.  See below for examples.

https://github.com/revarbat/BOSL2/wiki/color.scad#module-recolor

On Fri, Nov 11, 2022 at 6:05 AM Bob Ewart jinnicky@bobsown.net wrote:

Thanks nop head  -- render does the trick;

render() extruder0();
color("green") render() extruder1();

shows the insert in color without distorting the geometry.

--
Bob

On 11/11/22 05:34, nop head wrote:

You can use render() instead of exporting and importing the STL. I do that
for assembly views in the GUI but when making assembly diagrams from the
command line I know the STLS have been created first, so I do import them
to speed things up.

On Fri, 11 Nov 2022 at 09:17, Bob Carter caggius@gmail.com wrote:

I have a number of coloured assembly diagrams - that I produce by
exporting the individual parts as STL files then importing and colouring
them in a separate assembly scad file…

Love to know if there was an easier way - but this works for me.

On 10 Nov 2022, at 22:49, Raymond West raywest@raywest.com wrote:

when you combine two coloured objects, to make a single object, it takes
the colour of the last object in the list, afaik. If you want to see
separate colours, then make the insert a bit smaller, say, so it does not
touch the cube to make a single object.

translate([-22,0,0]) {
//color("red")
extruder0();
//color("red")
color("green")
//  scale([0.99,0.99,0.99])
extruder1();
color("red")
extruder0();
}

remove the comments, move the parts around, see what happens.
On 10/11/2022 20:46, Bob Ewart wrote:

I am trying to do a 2 color print with the second color being a section
through the middle of the first.

In this example the main object is a cube(20) and the section is rotated
and is larger than the main object.  The first color is the difference
between the main object and the overlay, the second is the intersection of
the two.

When I color the second part with green and combining the two I was
expecting to see the two parts in different colors.  What I got is:

<test_overlap.png>

The image on the left should be a natural color cube with the green
section through the middle.

Bob


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


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


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

BOSL2 has some features for giving better control of color. However, for them to work your objects have to be "attachable" which requires some extra effort. BOSL2 supplies a recolor() module that changes the color of the children, and a color_this() module that colors at one level, with color reverting in the children. See below for examples. https://github.com/revarbat/BOSL2/wiki/color.scad#module-recolor On Fri, Nov 11, 2022 at 6:05 AM Bob Ewart <jinnicky@bobsown.net> wrote: > Thanks nop head -- render does the trick; > > render() extruder0(); > color("green") render() extruder1(); > > shows the insert in color without distorting the geometry. > > > -- > Bob > > > On 11/11/22 05:34, nop head wrote: > > You can use render() instead of exporting and importing the STL. I do that > for assembly views in the GUI but when making assembly diagrams from the > command line I know the STLS have been created first, so I do import them > to speed things up. > > On Fri, 11 Nov 2022 at 09:17, Bob Carter <caggius@gmail.com> wrote: > >> I have a number of coloured assembly diagrams - that I produce by >> exporting the individual parts as STL files then importing and colouring >> them in a separate assembly scad file… >> >> Love to know if there was an easier way - but this works for me. >> >> >> On 10 Nov 2022, at 22:49, Raymond West <raywest@raywest.com> wrote: >> >> when you combine two coloured objects, to make a single object, it takes >> the colour of the last object in the list, afaik. If you want to see >> separate colours, then make the insert a bit smaller, say, so it does not >> touch the cube to make a single object. >> >> translate([-22,0,0]) { >> //color("red") >> extruder0(); >> //color("red") >> color("green") >> // scale([0.99,0.99,0.99]) >> extruder1(); >> color("red") >> extruder0(); >> } >> >> remove the comments, move the parts around, see what happens. >> On 10/11/2022 20:46, Bob Ewart wrote: >> >> I am trying to do a 2 color print with the second color being a section >> through the middle of the first. >> >> In this example the main object is a cube(20) and the section is rotated >> and is larger than the main object. The first color is the difference >> between the main object and the overlay, the second is the intersection of >> the two. >> >> When I color the second part with green and combining the two I was >> expecting to see the two parts in different colors. What I got is: >> >> <test_overlap.png> >> >> The image on the left should be a natural color cube with the green >> section through the middle. >> -- >> >> Bob >> >> >> >> >> _______________________________________________ >> 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 >> >> >> _______________________________________________ >> 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 > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >