discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Cross section and colors

D
dbvanhorn
Sat, Mar 4, 2017 3:17 AM

I have a number of parts in an exploded view, and I'm using difference with a
cube to create a cutaway.
Unfortunately the sliced faces of the parts are all the same green color.

Is there a way to preserve the part color?

Is there a better way to get a cross section that will preserve the color?
I thought about applying the color after the cross sectioning but that would
be a bit of a pain to apply and then remove for each part.

--
View this message in context: http://forum.openscad.org/Cross-section-and-colors-tp20721.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I have a number of parts in an exploded view, and I'm using difference with a cube to create a cutaway. Unfortunately the sliced faces of the parts are all the same green color. Is there a way to preserve the part color? Is there a better way to get a cross section that will preserve the color? I thought about applying the color after the cross sectioning but that would be a bit of a pain to apply and then remove for each part. -- View this message in context: http://forum.openscad.org/Cross-section-and-colors-tp20721.html Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Sat, Mar 4, 2017 4:05 AM

Green color appears after F6 for all surfaces that belongs to a subtracted
object. If you use intersection, the surface is represented in yellow
though. To have parts rendered and colored by color() use the operator
render() and F5. Hope it helps.

2017-03-04 0:17 GMT-03:00 dbvanhorn kc6ete@gmail.com:

I have a number of parts in an exploded view, and I'm using difference
with a
cube to create a cutaway.
Unfortunately the sliced faces of the parts are all the same green color.

Is there a way to preserve the part color?

Is there a better way to get a cross section that will preserve the color?
I thought about applying the color after the cross sectioning but that
would
be a bit of a pain to apply and then remove for each part.

--
View this message in context: http://forum.openscad.org/
Cross-section-and-colors-tp20721.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

Green color appears after F6 for all surfaces that belongs to a subtracted object. If you use intersection, the surface is represented in yellow though. To have parts rendered and colored by color() use the operator render() and F5. Hope it helps. 2017-03-04 0:17 GMT-03:00 dbvanhorn <kc6ete@gmail.com>: > I have a number of parts in an exploded view, and I'm using difference > with a > cube to create a cutaway. > Unfortunately the sliced faces of the parts are all the same green color. > > Is there a way to preserve the part color? > > Is there a better way to get a cross section that will preserve the color? > I thought about applying the color after the cross sectioning but that > would > be a bit of a pain to apply and then remove for each part. > > > > -- > View this message in context: http://forum.openscad.org/ > Cross-section-and-colors-tp20721.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 >
NH
nop head
Sat, Mar 4, 2017 11:54 AM

You can colour just the cut surface as it is the colour of the negative
operand of the difference, but again they will all be the same colour. I
think you need to cut each object separately to get a multicoloured cross
section.

On 4 March 2017 at 04:05, Ronaldo Persiano rcmpersiano@gmail.com wrote:

Green color appears after F6 for all surfaces that belongs to a subtracted
object. If you use intersection, the surface is represented in yellow
though. To have parts rendered and colored by color() use the operator
render() and F5. Hope it helps.

2017-03-04 0:17 GMT-03:00 dbvanhorn kc6ete@gmail.com:

I have a number of parts in an exploded view, and I'm using difference
with a
cube to create a cutaway.
Unfortunately the sliced faces of the parts are all the same green color.

Is there a way to preserve the part color?

Is there a better way to get a cross section that will preserve the color?
I thought about applying the color after the cross sectioning but that
would
be a bit of a pain to apply and then remove for each part.

--
View this message in context: http://forum.openscad.org/Cros
s-section-and-colors-tp20721.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 colour just the cut surface as it is the colour of the negative operand of the difference, but again they will all be the same colour. I think you need to cut each object separately to get a multicoloured cross section. On 4 March 2017 at 04:05, Ronaldo Persiano <rcmpersiano@gmail.com> wrote: > Green color appears after F6 for all surfaces that belongs to a subtracted > object. If you use intersection, the surface is represented in yellow > though. To have parts rendered and colored by color() use the operator > render() and F5. Hope it helps. > > 2017-03-04 0:17 GMT-03:00 dbvanhorn <kc6ete@gmail.com>: > >> I have a number of parts in an exploded view, and I'm using difference >> with a >> cube to create a cutaway. >> Unfortunately the sliced faces of the parts are all the same green color. >> >> Is there a way to preserve the part color? >> >> Is there a better way to get a cross section that will preserve the color? >> I thought about applying the color after the cross sectioning but that >> would >> be a bit of a pain to apply and then remove for each part. >> >> >> >> -- >> View this message in context: http://forum.openscad.org/Cros >> s-section-and-colors-tp20721.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 > >
D
dbvanhorn
Sat, Mar 4, 2017 8:43 PM

I was afraid of that.  The model is currently in a dozen files.

I suppose I could put a flag in the dimensions file to trigger the cutaway
before I assemble them in the top level file.

--
View this message in context: http://forum.openscad.org/Cross-section-and-colors-tp20721p20738.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I was afraid of that. The model is currently in a dozen files. I suppose I could put a flag in the dimensions file to trigger the cutaway before I assemble them in the top level file. -- View this message in context: http://forum.openscad.org/Cross-section-and-colors-tp20721p20738.html Sent from the OpenSCAD mailing list archive at Nabble.com.
D
dbvanhorn
Sat, Mar 4, 2017 9:23 PM

Ok, I implemented that, but the cut edges are still colored by something that
ends up in a awful looking moire pattern that shifts when I rotate.

//In the dimensions file, I have:
CrossSection = true;

// Example of how I am clipping the parts.  No color is applied in the part
files
module Front(){
difference(){
FrontFull();
if (CrossSection == true){
HalfClip(); // a large box, tall in Z with one face centered on X=0
}
}// end of difference
}// end of module

// So each part is individually clipped in it's own file

// In the main assembly file I apply color.

Explode = 1;

module Assembly(){
union(){
translate([0,0,Explode4]){color ([0.9,0.9,0.9]) Back();}
translate([0,0,Explode
3]){color ([0.9,0.1,0.1]) Fill();}
translate([0,0,Explode*2]){color ([0.0,0.0,0.5]) Ring();}
translate ([0,0,Explode]) {color ([0.0,0.5,0.0]) Front();}
color([0.5,0.0,0.0]) Nose();
}// end of union
}// end of module

// No clipping done at the top level where I apply the color.

Assembly();

--
View this message in context: http://forum.openscad.org/Cross-section-and-colors-tp20721p20745.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Ok, I implemented that, but the cut edges are still colored by something that ends up in a awful looking moire pattern that shifts when I rotate. //In the dimensions file, I have: CrossSection = true; // Example of how I am clipping the parts. No color is applied in the part files module Front(){ difference(){ FrontFull(); if (CrossSection == true){ HalfClip(); // a large box, tall in Z with one face centered on X=0 } }// end of difference }// end of module // So each part is individually clipped in it's own file // In the main assembly file I apply color. Explode = 1; module Assembly(){ union(){ translate([0,0,Explode*4]){color ([0.9,0.9,0.9]) Back();} translate([0,0,Explode*3]){color ([0.9,0.1,0.1]) Fill();} translate([0,0,Explode*2]){color ([0.0,0.0,0.5]) Ring();} translate ([0,0,Explode]) {color ([0.0,0.5,0.0]) Front();} color([0.5,0.0,0.0]) Nose(); }// end of union }// end of module // No clipping done at the top level where I apply the color. Assembly(); -- View this message in context: http://forum.openscad.org/Cross-section-and-colors-tp20721p20745.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Sun, Mar 5, 2017 12:22 AM

I always render() before applying colour to avoid interference between
negative objects.

On 4 March 2017 at 21:23, dbvanhorn kc6ete@gmail.com wrote:

Ok, I implemented that, but the cut edges are still colored by something
that
ends up in a awful looking moire pattern that shifts when I rotate.

//In the dimensions file, I have:
CrossSection = true;

// Example of how I am clipping the parts.  No color is applied in the part
files
module Front(){
difference(){
FrontFull();
if (CrossSection == true){
HalfClip(); // a large box, tall in Z with one face centered on X=0
}
}// end of difference
}// end of module

// So each part is individually clipped in it's own file

// In the main assembly file I apply color.

Explode = 1;

module Assembly(){
union(){
translate([0,0,Explode4]){color ([0.9,0.9,0.9]) Back();}
translate([0,0,Explode
3]){color ([0.9,0.1,0.1]) Fill();}
translate([0,0,Explode*2]){color ([0.0,0.0,0.5]) Ring();}
translate ([0,0,Explode]) {color ([0.0,0.5,0.0]) Front();}
color([0.5,0.0,0.0]) Nose();
}// end of union
}// end of module

// No clipping done at the top level where I apply the color.

Assembly();

--
View this message in context: http://forum.openscad.org/
Cross-section-and-colors-tp20721p20745.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

I always render() before applying colour to avoid interference between negative objects. On 4 March 2017 at 21:23, dbvanhorn <kc6ete@gmail.com> wrote: > Ok, I implemented that, but the cut edges are still colored by something > that > ends up in a awful looking moire pattern that shifts when I rotate. > > > //In the dimensions file, I have: > CrossSection = true; > > > > // Example of how I am clipping the parts. No color is applied in the part > files > module Front(){ > difference(){ > FrontFull(); > if (CrossSection == true){ > HalfClip(); // a large box, tall in Z with one face centered on X=0 > } > }// end of difference > }// end of module > > // So each part is individually clipped in it's own file > > > // In the main assembly file I apply color. > > Explode = 1; > > module Assembly(){ > union(){ > translate([0,0,Explode*4]){color ([0.9,0.9,0.9]) Back();} > translate([0,0,Explode*3]){color ([0.9,0.1,0.1]) Fill();} > translate([0,0,Explode*2]){color ([0.0,0.0,0.5]) Ring();} > translate ([0,0,Explode]) {color ([0.0,0.5,0.0]) Front();} > color([0.5,0.0,0.0]) Nose(); > }// end of union > }// end of module > > // No clipping done at the top level where I apply the color. > > Assembly(); > > > > -- > View this message in context: http://forum.openscad.org/ > Cross-section-and-colors-tp20721p20745.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 >
D
dbvanhorn
Sun, Mar 5, 2017 1:30 AM

I don't quite understand what you mean.

Like this, on each part?

module part(){
render();
difference(){
PartFull();
if (CrossSection == true){
HalfClip(); //
}

--
View this message in context: http://forum.openscad.org/Cross-section-and-colors-tp20721p20755.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I don't quite understand what you mean. Like this, on each part? module part(){ render(); difference(){ PartFull(); if (CrossSection == true){ HalfClip(); // } -- View this message in context: http://forum.openscad.org/Cross-section-and-colors-tp20721p20755.html Sent from the OpenSCAD mailing list archive at Nabble.com.
GF
Greg Frost
Sun, Mar 5, 2017 4:42 AM

You can't put the semicolon after the render() or it won't apply to the following object.

On 5 Mar 2017, at 12:00 pm, dbvanhorn kc6ete@gmail.com wrote:

I don't quite understand what you mean.

Like this, on each part?

module part(){
render();
difference(){
PartFull();
if (CrossSection == true){
HalfClip(); //
}

--
View this message in context: http://forum.openscad.org/Cross-section-and-colors-tp20721p20755.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't put the semicolon after the render() or it won't apply to the following object. > On 5 Mar 2017, at 12:00 pm, dbvanhorn <kc6ete@gmail.com> wrote: > > I don't quite understand what you mean. > > Like this, on each part? > > module part(){ > render(); > difference(){ > PartFull(); > if (CrossSection == true){ > HalfClip(); // > } > > > > -- > View this message in context: http://forum.openscad.org/Cross-section-and-colors-tp20721p20755.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