discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

vanishing polyhedra on difference?

BB
Bruno Boettcher
Sat, Jul 20, 2019 3:32 PM

Hello,

so my previous question was stupid enough :D so i went into looking to
achieve the desired result directly by using the polyhedrons, and here's
the next dumb question:

if you activate the difference on line 36, everything vanishes :(
why?? (same for union BTW....)

l = 3;
dlu = 1.4;
dlo = 2.9;
w= 30;
h= 11.5;
uo = 9;
uxo = 25;
uxu = 27;

module einschubForm(untereBr,obereBr,absend,absanf,abshoehe,hoehe,breite)
{
obVerjBreite = (obereBr-untereBr)*abshoehe/hoehe+untereBr;
polyhedron(
points=[[-untereBr,0,0], [untereBr,0,0], [untereBr,breite,0],
[-untereBr,breite,0], //unteres Rechteck
[-obereBr,0,hoehe],[obereBr,0,hoehe],
[obVerjBreite,breite,abshoehe],[-obVerjBreite,breite,abshoehe]    //oberes
Rechteck
,[-obVerjBreite,absanf,hoehe], [-obVerjBreite,absend, abshoehe],
[obVerjBreite,absend, abshoehe], [obVerjBreite,absanf,hoehe] //Absenkung
,[-untereBr,absanf,0], [-untereBr,absend, 0], [untereBr,absend, 0],
[untereBr,absanf,0]
],

  faces=[
  [0,3,2,1], //unten
  [5,4,0,1], //stirn links
  [1,2,6,10,11,5], //hinten
  [2,3,7,6], //stirn rechts
  [0,4,8,9,7,3], //vorne
  [4,5,11,8], [8,11,10,9], [9,10,6,7]  //oben
  ]
  );

}

posx = 11.1;
posy = 0;
posz = 1.71;
translate([posx,posy,posz])
{
//difference()
//{
einschubForm(dlu,dlo,uxu,uxo,uo,h,w);
color("blue") translate([1,1.5,1])scale(v = [1, .9, .8])
einschubForm(dlu,dlo,uxu,uxo,uo,h,w);
//}
}

--
ciao
Bruno

---==========
http://nohkumado.eu/, http://bboett.free.frhttp://aikido.nohkumado.eu/,
http://bboett.free.fr
http://aikido.zorn.free.fr

Hello, so my previous question was stupid enough :D so i went into looking to achieve the desired result directly by using the polyhedrons, and here's the next dumb question: if you activate the difference on line 36, everything vanishes :( why?? (same for union BTW....) l = 3; dlu = 1.4; dlo = 2.9; w= 30; h= 11.5; uo = 9; uxo = 25; uxu = 27; module einschubForm(untereBr,obereBr,absend,absanf,abshoehe,hoehe,breite) { obVerjBreite = (obereBr-untereBr)*abshoehe/hoehe+untereBr; polyhedron( points=[[-untereBr,0,0], [untereBr,0,0], [untereBr,breite,0], [-untereBr,breite,0], //unteres Rechteck [-obereBr,0,hoehe],[obereBr,0,hoehe], [obVerjBreite,breite,abshoehe],[-obVerjBreite,breite,abshoehe] //oberes Rechteck ,[-obVerjBreite,absanf,hoehe], [-obVerjBreite,absend, abshoehe], [obVerjBreite,absend, abshoehe], [obVerjBreite,absanf,hoehe] //Absenkung ,[-untereBr,absanf,0], [-untereBr,absend, 0], [untereBr,absend, 0], [untereBr,absanf,0] ], faces=[ [0,3,2,1], //unten [5,4,0,1], //stirn links [1,2,6,10,11,5], //hinten [2,3,7,6], //stirn rechts [0,4,8,9,7,3], //vorne [4,5,11,8], [8,11,10,9], [9,10,6,7] //oben ] ); } posx = 11.1; posy = 0; posz = 1.71; translate([posx,posy,posz]) { //difference() //{ einschubForm(dlu,dlo,uxu,uxo,uo,h,w); color("blue") translate([1,1.5,1])scale(v = [1, .9, .8]) einschubForm(dlu,dlo,uxu,uxo,uo,h,w); //} } -- ciao Bruno =========================================== http://nohkumado.eu/, <http://bboett.free.fr>http://aikido.nohkumado.eu/, <http://bboett.free.fr> http://aikido.zorn.free.fr
TP
Torsten Paul
Sat, Jul 20, 2019 3:47 PM

On 20.07.19 17:32, Bruno Boettcher wrote:

if you activate the difference on line 36, everything vanishes :(
why?? (same for union BTW....)

The polyhedron is inside out, all faces have the points listed
in reverse order.

See: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_model_showing_up_with_F5_but_not_F6?

ciao,
Torsten.

On 20.07.19 17:32, Bruno Boettcher wrote: > if you activate the difference on line 36, everything vanishes :( > why?? (same for union BTW....) The polyhedron is inside out, all faces have the points listed in reverse order. See: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_model_showing_up_with_F5_but_not_F6? ciao, Torsten.
AC
A. Craig West
Sat, Jul 20, 2019 3:50 PM

I did some experimenting with that, as long as it is consistent, openscad
does the right thing. Not sure if the two polyhedra need to be consistent
with each other though

On Sat, 20 Jul 2019, 11:48 Torsten Paul, Torsten.Paul@gmx.de wrote:

On 20.07.19 17:32, Bruno Boettcher wrote:

if you activate the difference on line 36, everything vanishes :(
why?? (same for union BTW....)

I did some experimenting with that, as long as it is consistent, openscad does the right thing. Not sure if the two polyhedra need to be consistent with each other though On Sat, 20 Jul 2019, 11:48 Torsten Paul, <Torsten.Paul@gmx.de> wrote: > On 20.07.19 17:32, Bruno Boettcher wrote: > > if you activate the difference on line 36, everything vanishes :( > > why?? (same for union BTW....) > > The polyhedron is inside out, all faces have the points listed > in reverse order. > > See: > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_model_showing_up_with_F5_but_not_F6 > ? > > ciao, > Torsten. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
BB
Bruno Boettcher
Sat, Jul 20, 2019 4:01 PM

ok! thanks!
heh, understood the doc inversely....
ciao
Bruno

Am Sa., 20. Juli 2019 um 17:48 Uhr schrieb Torsten Paul <Torsten.Paul@gmx.de

:

On 20.07.19 17:32, Bruno Boettcher wrote:

if you activate the difference on line 36, everything vanishes :(
why?? (same for union BTW....)

ok! thanks! heh, understood the doc inversely.... ciao Bruno Am Sa., 20. Juli 2019 um 17:48 Uhr schrieb Torsten Paul <Torsten.Paul@gmx.de >: > On 20.07.19 17:32, Bruno Boettcher wrote: > > if you activate the difference on line 36, everything vanishes :( > > why?? (same for union BTW....) > > The polyhedron is inside out, all faces have the points listed > in reverse order. > > See: > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_model_showing_up_with_F5_but_not_F6 > ? > > ciao, > Torsten. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > -- ciao Bruno =========================================== http://nohkumado.eu/, <http://bboett.free.fr>http://aikido.nohkumado.eu/, <http://bboett.free.fr> http://aikido.zorn.free.fr
TP
Torsten Paul
Sat, Jul 20, 2019 4:01 PM

On 20.07.19 17:50, A. Craig West wrote:

I did some experimenting with that, as long as it is consistent,
openscad does the right thing. Not sure if the two polyhedra
need to be consistent with each other though 

The underlying library doing the CSG operations (libCGAL) might
randomly do the right thing. Relying on that may end in trouble
at any time with any changes of the environment (e.g. changing
to a different machine, using a different OpenSCAD build, or
maybe just because the OS is running for more than 6 days without
reboot).

The expected winding order of polyhedron faces is defined,
anything else may work but the result is in general completely
undefined. So my advice is to always use the winding documented
order.

ciao,
Torsten.

On 20.07.19 17:50, A. Craig West wrote: > I did some experimenting with that, as long as it is consistent, > openscad does the right thing. Not sure if the two polyhedra > need to be consistent with each other though  The underlying library doing the CSG operations (libCGAL) might randomly do the right thing. Relying on that may end in trouble at any time with any changes of the environment (e.g. changing to a different machine, using a different OpenSCAD build, or maybe just because the OS is running for more than 6 days without reboot). The expected winding order of polyhedron faces is defined, anything else may work but the result is in general completely undefined. So my advice is to always use the winding documented order. ciao, Torsten.
A
arnholm@arnholm.org
Sat, Jul 20, 2019 4:28 PM

On 2019-07-20 17:50, A. Craig West wrote:

I did some experimenting with that, as long as it is consistent,
openscad does the right thing.

The face normal defines the direction of void ("out of material"). In
case of an inverted polyhedron with normal pointing inside the volume,
the material is infinite in all directions except inside the polyhedron
volume. One should always make sure a polyhedron is properly defined.

Carsten Arnholm

On 2019-07-20 17:50, A. Craig West wrote: > I did some experimenting with that, as long as it is consistent, > openscad does the right thing. The face normal defines the direction of void ("out of material"). In case of an inverted polyhedron with normal pointing inside the volume, the material is infinite in all directions except inside the polyhedron volume. One should always make sure a polyhedron is properly defined. Carsten Arnholm