Dear all,
Is is possible to fill with a given color the volume given by the
intersection between two solid 3D objects in OpenSCAD? For example, I would
like the intersection between the two spheres in the example to be in blue.
color([1,0,0,0.5]) translate([0.5,0,0]) sphere(1,$fn=100);
color([1,0,0,0.5]) translate([2,0,0]) sphere(1,$fn=100);
Tank you for your help.
--
Sent from: http://forum.openscad.org/
Yes, sort of.
color("blue") intersection() {
translate([0.5,0,0]) sphere(1,$fn=100);
translate([2,0,0]) sphere(1,$fn=100);
}
color([1,0,0,0.5]) translate([0.5,0,0]) sphere(1,$fn=100);
color([1,0,0,0.5]) translate([2,0,0]) sphere(1,$fn=100);
On 2 May 2018 at 13:26, Aleandro michele.roma@hotmail.it wrote:
Dear all,
Is is possible to fill with a given color the volume given by the
intersection between two solid 3D objects in OpenSCAD? For example, I would
like the intersection between the two spheres in the example to be in blue.
color([1,0,0,0.5]) translate([0.5,0,0]) sphere(1,$fn=100);
color([1,0,0,0.5]) translate([2,0,0]) sphere(1,$fn=100);
Tank you for your help.
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Thank you. This colors in blue only one of the two 'lenses' that form the
surface of the intersection. Is there a way to color the entire surface?
best,
--
Sent from: http://forum.openscad.org/
The entire intersection is blue when viewed on its own. It shows up blue if
you make the spheres more transparent.
The reason it looks different when viewed through one sphere compared to
the other is the due to the lighting. When viewed from the side away from
the light the blue is darker and doesn't show as well through the red.
Also you can only see one sphere through the other due to the order they
are drawn.
On 2 May 2018 at 16:24, Aleandro michele.roma@hotmail.it wrote:
Thank you. This colors in blue only one of the two 'lenses' that form the
surface of the intersection. Is there a way to color the entire surface?
best,
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
This might give you some visual idea:
module obj1() sphere(1,$fn=100);
module obj2() translate([1.5,0,0]) obj1();
module inter() intersection() {obj1();obj2(2);}
color("gold")
{
translate( [-0.3,0,0] )
difference() {obj1();inter();}
translate( [0.3,0,0] )
difference() {obj2();inter();}
}
color("blue")inter();
$ Runsun Pan, PhD $ libs: scadx , doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), editor of choice: CudaText ( OpenSCAD lexer ); $ Tips ; $ Snippets
--
Sent from: http://forum.openscad.org/