Cross section and colors

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Cross section and colors

dbvanhorn
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.
Reply | Threaded
Open this post in threaded view
|

Re: Cross section and colors

Ronaldo
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 <[hidden email]>:
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Cross section and colors

nophead
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 <[hidden email]> 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 <[hidden email]>:
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Cross section and colors

dbvanhorn
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.
Reply | Threaded
Open this post in threaded view
|

Re: Cross section and colors

dbvanhorn
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();
Reply | Threaded
Open this post in threaded view
|

Re: Cross section and colors

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

On 4 March 2017 at 21:23, dbvanhorn <[hidden email]> 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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Cross section and colors

dbvanhorn
I don't quite understand what you mean.

Like this, on each part?

module part(){
    render();
    difference(){
        PartFull();
if (CrossSection == true){
    HalfClip(); //
}
Reply | Threaded
Open this post in threaded view
|

Re: Cross section and colors

Greg Frost
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 <[hidden email]> 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
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org