discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Default green: Now you see it, now you don't

M
mikeonenine@web.de
Wed, Sep 6, 2023 8:03 PM

The default green changes to default gold with linear_extrude. That looks a bit naff when other differenced surfaces remain green. Try activating and cancelling linear_extrude (second line from last) in the example below.

$fn=100;
l=35;
$vpr=([ -30, 45, 0 ]); // Isometric$vpt=([ 0, -l/2+3, 0 ]); $vpd=200;
module conrod(diff)
difference()
{
offset(-5)
offset(5)
{
circle(5-diff);
translate([0,-l,0])
circle(9-diff);
hull()
{
circle(5-1.0-diff);
translate([0,-l,0])
circle(9-3-diff);
}}
circle(5-1.5+diff);
translate([0,-l,0])
circle(9-2+diff);
}
//linear_extrude(6, center=true)
conrod(diff=0);   
Is there a solution other than subtracting a minimally enlarged object where the green disappears?

BTW, is it possible to format code to reduce line spacing?

The default green changes to default gold with linear_extrude. That looks a bit naff when other differenced surfaces remain green. Try activating and cancelling linear_extrude (second line from last) in the example below. ``` $fn=100; ``` ``` l=35; ``` ``` $vpr=([ -30, 45, 0 ]); // Isometric$vpt=([ 0, -l/2+3, 0 ]); $vpd=200; ``` ``` module conrod(diff) ``` ``` difference() ``` ``` { ``` ``` offset(-5) ``` ``` offset(5) ``` ``` { ``` ``` circle(5-diff); ``` ``` translate([0,-l,0]) ``` ``` circle(9-diff); ``` ``` hull() ``` ``` { ``` ``` circle(5-1.0-diff); ``` ``` translate([0,-l,0]) ``` ``` circle(9-3-diff); ``` ``` }} ``` ``` circle(5-1.5+diff); ``` ``` translate([0,-l,0]) ``` ``` circle(9-2+diff); ``` ``` } ``` ``` //linear_extrude(6, center=true) ``` ``` conrod(diff=0); ``` ###### Is there a solution other than subtracting a minimally enlarged object where the green disappears? BTW, is it possible to format code to reduce line spacing?
JB
Jordan Brown
Wed, Sep 6, 2023 8:50 PM

On 9/6/2023 1:03 PM, mikeonenine@web.de wrote:

The default green changes to default gold with linear_extrude. That
looks a bit naff when other differenced surfaces remain green. Try
activating and cancelling linear_extrude (second line from last) in
the example below.

What is happening is that without the linear_extrude it's a 2D object,
which is simulated in the previewer as a one-unit-thick 3D object, and
the green on the cut-away parts takes effect.  With the linear_extrude,
the 2D shape is fully resolved into all-new polygons and all traces of
how it was created are lost; the linear_extrude generates an entirely
new polyhedron.

You could do the difference in 3D instead of 2D, and the green would
remain, but that's a lot slower.

OpenSCAD has only very limited abilities to color different faces of an
object differently.

BTW, is it possible to format code to reduce line spacing?

If you're posting via e-mail, it depends entirely on your mail client. 
You want to end up with either plain text mail (which is boring but the
formatting is very predictable) or HTML mail with your program wrapped
in <pre>.  (There are other HTML variants, but that's the simplest.)  In
Thunderbird, I tell it to set a paragraph as "preformatted", and often I
indent it.

difference() {
    cube(10, center=true);
    sphere(7);
}

If you're posting via the Empathy web page, it looks like the "Type"
pulldown will let you format a paragraph as code.  The "<>" button may
also be useful.

On 9/6/2023 1:03 PM, mikeonenine@web.de wrote: > > The default green changes to default gold with linear_extrude. That > looks a bit naff when other differenced surfaces remain green. Try > activating and cancelling linear_extrude (second line from last) in > the example below. > What is happening is that without the linear_extrude it's a 2D object, which is simulated in the previewer as a one-unit-thick 3D object, and the green on the cut-away parts takes effect.  With the linear_extrude, the 2D shape is fully resolved into all-new polygons and all traces of how it was created are lost; the linear_extrude generates an entirely new polyhedron. You could do the difference in 3D instead of 2D, and the green would remain, but that's a lot slower. OpenSCAD has only very limited abilities to color different faces of an object differently. > BTW, is it possible to format code to reduce line spacing? > If you're posting via e-mail, it depends entirely on your mail client.  You want to end up with either plain text mail (which is boring but the formatting is very predictable) or HTML mail with your program wrapped in <pre>.  (There are other HTML variants, but that's the simplest.)  In Thunderbird, I tell it to set a paragraph as "preformatted", and often I indent it. difference() { cube(10, center=true); sphere(7); } If you're posting via the Empathy web page, it looks like the "Type" pulldown will let you format a paragraph as code.  The "<>" button may also be useful.
M
mikeonenine@web.de
Wed, Sep 6, 2023 9:51 PM

Jordan Brown wrote:

With the linear_extrude, the 2D shape is fully resolved into all-new polygons and all traces of how it was created are lost; the linear_extrude generates an entirely new polyhedron.

OK. Got it.

You could do the difference in 3D instead of 2D, and the green would remain, but that's a lot slower.

I had to use 2D to be able to use offset() to blend the big end and small end into the shank.

often I indent it.

difference() {
    cube(10, center=true);
    sphere(7);
}
Formating in the x-direction seems to be the standard here, but I prefer the y-direction. It makes the code longer, but it allows a wider viewport.
If you're posting via the Empathy web page, 
it looks like the "Type" pulldown will let you format a paragraph as code.  

The "<>" button may
also be useful.

I like the pink, it’s rather cute! But copying code out of OpenSCAD and pasting it here still increases the spacing, so a reader has to scroll for miles and miles, unless the code is reworked line by line.

So, those are my gripes for today. We live in an imperfect world!

Jordan Brown wrote: > With the linear_extrude, the 2D shape is fully resolved into all-new polygons and all traces of how it was created are lost; the linear_extrude generates an entirely new polyhedron. OK. Got it. > You could do the difference in 3D instead of 2D, and the green would remain, but that's a lot slower. I had to use 2D to be able to use offset() to blend the big end and small end into the shank. > often I indent it. > > ``` > difference() { > cube(10, center=true); > sphere(7); > } > ``` ###### Formating in the x-direction seems to be the standard here, but I prefer the y-direction. It makes the code longer, but it allows a wider viewport. ``` If you're posting via the Empathy web page, it looks like the "Type" pulldown will let you format a paragraph as code.  ``` `The "<>" button may `\ `also be useful.` I like the pink, it’s rather cute! But copying code out of OpenSCAD and pasting it here still increases the spacing, so a reader has to scroll for miles and miles, unless the code is reworked line by line. So, those are my gripes for today. We live in an imperfect world! ######