discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

STL processing....

RW
Rogier Wolff
Sun, Jan 7, 2024 9:45 PM

On Sun, Jan 07, 2024 at 10:31:26PM +0100, Rogier Wolff via Discuss wrote:

It's easy for my read-possibly-process-write STL files program to
randomize the triangle list. I might try that.

Even easier is to just move ONE triangle. I moved the one triangle
that my program reported as "zero area" to the back. (last position in
the file). Now meshlab doesn't crash!

LOG: 0 All files opened in 644 msec
LOG: 2 Successfully removed 21772 t-vertices
LOG: 0 Applied filter Remove T-Vertices by Edge Collapse in 322 msec

(opening the ascii STL takes about twice as long as binary (and many
times faster than my program! I don't give a F***!). )

Apparently it finds many more than my zero-area triangle criterium
finds. But the "offending" triangle seems to have been the one that I
moved....

But Nope. The "T vertices removed" version does not cause openscad
to process it correctly with difference () ...

Roger.

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

On Sun, Jan 07, 2024 at 10:31:26PM +0100, Rogier Wolff via Discuss wrote: > It's easy for my read-possibly-process-write STL files program to > randomize the triangle list. I might try that. Even easier is to just move ONE triangle. I moved the one triangle that my program reported as "zero area" to the back. (last position in the file). Now meshlab doesn't crash! LOG: 0 All files opened in 644 msec LOG: 2 Successfully removed 21772 t-vertices LOG: 0 Applied filter Remove T-Vertices by Edge Collapse in 322 msec (opening the ascii STL takes about twice as long as binary (and many times faster than my program! I don't give a F***!). ) Apparently it finds many more than my zero-area triangle criterium finds. But the "offending" triangle seems to have been the one that I moved.... But Nope. The "T vertices removed" version does not cause openscad to process it correctly with difference () ... Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.
TP
Torsten Paul
Sun, Jan 7, 2024 10:33 PM

On 07.01.24 22:45, Rogier Wolff via Discuss wrote:

LOG: 0 Applied filter Remove T-Vertices by Edge Collapse in 322 msec

Edge collapse sounds wrong. FAQ says Edge flip.

Reflecting on the name, the edge flip might not work for the "all
points same" case. If all other triangles are connected correctly,
it could be ok to just remove it.

ciao,
Torsten.

On 07.01.24 22:45, Rogier Wolff via Discuss wrote: > LOG: 0 Applied filter Remove T-Vertices by Edge Collapse in 322 msec Edge collapse sounds wrong. FAQ says Edge *flip*. Reflecting on the name, the edge flip might not work for the "all points same" case. If all other triangles are connected correctly, it could be ok to just remove it. ciao, Torsten.
L
larry
Mon, Jan 8, 2024 1:46 AM

On Sun, 2024-01-07 at 22:15 +0100, Rogier Wolff via Discuss wrote:

On Sun, Jan 07, 2024 at 09:37:40PM +0100, Torsten Paul via Discuss
wrote:

On 07.01.24 21:29, Rogier Wolff via Discuss wrote:

Could a single zero-area-triangle cause this?

Yes.

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

I think the reason with CGAL is that it's not possible to determine
if a point is on a specific side of that triangle.

Note that this also applies to triangles with all points on
a single line, so really zero-area, not necessarily all three
points too close together.

Am I correct that I can "fix" this by deleting this triangle and
splitting the triangle that uses the longest edge of this one
into two
smaller ones? (change in nr of triangles: none.)

Meshlab calls that fix "Remove T-Vertices by Edge-Flip", there
might be some explanation under that name.

AH! Ok! I have meshlab, and someone on the internet recommended using
2 of the filters to "repair" STLs. Duh! Probably most of the filters
would have some effect on SOME STLs and his just happened to be fixed
by those two. But I wasn't about to go trying all 30-ish filters...

I like to run an STL through https://www.formware.co/onlinestlrepair
before using Meshlab. It usually works for me.

Thanks for pointing out the right one for me.
....

Meshlab tells me:

LOG: 0 All files opened in 351 msec
meshlab: ./vcglib/vcg/simplex/face/pos.h:196: void
vcg::face::Pos<FaceType>::FlipF() [with FaceType = CFaceO]: Assertion
`f->FFp(z)->FFp(f->FFi(z))==f' failed.
Abort (core dumped)

That's not good, right? :-)

Might have to write it myself after all.

        Roger.

On Sun, 2024-01-07 at 22:15 +0100, Rogier Wolff via Discuss wrote: > On Sun, Jan 07, 2024 at 09:37:40PM +0100, Torsten Paul via Discuss > wrote: > > On 07.01.24 21:29, Rogier Wolff via Discuss wrote: > > > Could a single zero-area-triangle cause this? > > > > Yes. > > > > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_imported_STL_file_appearing_with_F5_but_not_F6 > > ? > > > > I think the reason with CGAL is that it's not possible to determine > > if a point is on a specific side of that triangle. > > > > Note that this also applies to triangles with all points on > > a single line, so really zero-area, not necessarily all three > > points too close together. > > > > > Am I correct that I can "fix" this by deleting this triangle and > > > splitting the triangle that uses the longest edge of this one > > > into two > > > smaller ones? (change in nr of triangles: none.) > > > > Meshlab calls that fix "Remove T-Vertices by Edge-Flip", there > > might be some explanation under that name. > > AH! Ok! I have meshlab, and someone on the internet recommended using > 2 of the filters to "repair" STLs. Duh! Probably most of the filters > would have some effect on SOME STLs and his just happened to be fixed > by those two. But I wasn't about to go trying all 30-ish filters... I like to run an STL through https://www.formware.co/onlinestlrepair before using Meshlab. It usually works for me. > Thanks for pointing out the right one for me. > .... > > Meshlab tells me: > > LOG: 0 All files opened in 351 msec > meshlab: ./vcglib/vcg/simplex/face/pos.h:196: void > vcg::face::Pos<FaceType>::FlipF() [with FaceType = CFaceO]: Assertion > `f->FFp(z)->FFp(f->FFi(z))==f' failed. > Abort (core dumped) > > That's not good, right? :-) > > Might have to write it myself after all. > >         Roger. >
RW
Rogier Wolff
Mon, Jan 8, 2024 8:22 AM

On Sun, Jan 07, 2024 at 07:46:36PM -0600, larry via Discuss wrote:

On Sun, 2024-01-07 at 22:15 +0100, Rogier Wolff via Discuss wrote:

AH! Ok! I have meshlab, and someone on the internet recommended using
2 of the filters to "repair" STLs. Duh! Probably most of the filters
would have some effect on SOME STLs and his just happened to be fixed
by those two. But I wasn't about to go trying all 30-ish filters...

I like to run an STL through https://www.formware.co/onlinestlrepair
before using Meshlab. It usually works for me.

I usually use this one. In this case when Openscad failed to cut off
the bottom half, that's the first I tried. Vertex count cahnged a bit,
but not much more. And no effect on openscad.

Roger. 

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

On Sun, Jan 07, 2024 at 07:46:36PM -0600, larry via Discuss wrote: > On Sun, 2024-01-07 at 22:15 +0100, Rogier Wolff via Discuss wrote: > > AH! Ok! I have meshlab, and someone on the internet recommended using > > 2 of the filters to "repair" STLs. Duh! Probably most of the filters > > would have some effect on SOME STLs and his just happened to be fixed > > by those two. But I wasn't about to go trying all 30-ish filters... > > I like to run an STL through https://www.formware.co/onlinestlrepair > before using Meshlab. It usually works for me. I usually use this one. In this case when Openscad failed to cut off the bottom half, that's the first I tried. Vertex count cahnged a bit, but not much more. And no effect on openscad. Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.
RW
Rogier Wolff
Mon, Jan 8, 2024 8:37 AM

On Mon, Jan 08, 2024 at 09:22:03AM +0100, Rogier Wolff via Discuss wrote:

On Sun, Jan 07, 2024 at 07:46:36PM -0600, larry via Discuss wrote:

On Sun, 2024-01-07 at 22:15 +0100, Rogier Wolff via Discuss wrote:

AH! Ok! I have meshlab, and someone on the internet recommended using
2 of the filters to "repair" STLs. Duh! Probably most of the filters
would have some effect on SOME STLs and his just happened to be fixed
by those two. But I wasn't about to go trying all 30-ish filters...

I like to run an STL through https://www.formware.co/onlinestlrepair
before using Meshlab. It usually works for me.

I usually use this one. In this case when Openscad failed to cut off
the bottom half, that's the first I tried. Vertex count cahnged a bit,
but not much more. And no effect on openscad.

I thought of another experiment just now: What if I difference the STL
with a cube to just see where the problem is located in 3D space?

So I created a cube, and placed it near one of the ends. And then I
came up with the idea to first have NO intersection between the cube
and the object.

difference () {
the_STL (); // mostly near the X axis, from -210 to +230
translate ([-230,0,0]) cube ([20,100,100], center=true);
}

THIS DOES NOT RENDER.

If I remove the cube from the difference statement:

difference () {
the_STL (); // mostly near the X axis, from -210 to +230
//translate ([-230,0,0]) cube ([20,100,100], center=true);
}

it renders instantly. It is when "difference" TRIES to do something
that it messes up the STL.

Roger. 

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

On Mon, Jan 08, 2024 at 09:22:03AM +0100, Rogier Wolff via Discuss wrote: > On Sun, Jan 07, 2024 at 07:46:36PM -0600, larry via Discuss wrote: > > On Sun, 2024-01-07 at 22:15 +0100, Rogier Wolff via Discuss wrote: > > > AH! Ok! I have meshlab, and someone on the internet recommended using > > > 2 of the filters to "repair" STLs. Duh! Probably most of the filters > > > would have some effect on SOME STLs and his just happened to be fixed > > > by those two. But I wasn't about to go trying all 30-ish filters... > > > > I like to run an STL through https://www.formware.co/onlinestlrepair > > before using Meshlab. It usually works for me. > > I usually use this one. In this case when Openscad failed to cut off > the bottom half, that's the first I tried. Vertex count cahnged a bit, > but not much more. And no effect on openscad. I thought of another experiment just now: What if I difference the STL with a cube to just see where the problem is located in 3D space? So I created a cube, and placed it near one of the ends. And then I came up with the idea to first have NO intersection between the cube and the object. difference () { the_STL (); // mostly near the X axis, from -210 to +230 translate ([-230,0,0]) cube ([20,100,100], center=true); } THIS DOES NOT RENDER. If I remove the cube from the difference statement: difference () { the_STL (); // mostly near the X axis, from -210 to +230 //translate ([-230,0,0]) cube ([20,100,100], center=true); } it renders instantly. It is when "difference" TRIES to do something that it messes up the STL. Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.
GS
Guenther Sohler
Mon, Jan 8, 2024 8:43 AM

Roger,

Using a difference with only one object is an NOP, this is why it works
without the cube
if differencing the STL with the cube results  in a FAIl even if the STL
does not touch the cube, it's probably an issue with
internal conversions ...
Are you using Manifold or CGAL ?

On Mon, Jan 8, 2024 at 9:38 AM Rogier Wolff via Discuss <
discuss@lists.openscad.org> wrote:

On Mon, Jan 08, 2024 at 09:22:03AM +0100, Rogier Wolff via Discuss wrote:

On Sun, Jan 07, 2024 at 07:46:36PM -0600, larry via Discuss wrote:

On Sun, 2024-01-07 at 22:15 +0100, Rogier Wolff via Discuss wrote:

AH! Ok! I have meshlab, and someone on the internet recommended using
2 of the filters to "repair" STLs. Duh! Probably most of the filters
would have some effect on SOME STLs and his just happened to be fixed
by those two. But I wasn't about to go trying all 30-ish filters...

I like to run an STL through https://www.formware.co/onlinestlrepair
before using Meshlab. It usually works for me.

I usually use this one. In this case when Openscad failed to cut off
the bottom half, that's the first I tried. Vertex count cahnged a bit,
but not much more. And no effect on openscad.

I thought of another experiment just now: What if I difference the STL
with a cube to just see where the problem is located in 3D space?

So I created a cube, and placed it near one of the ends. And then I
came up with the idea to first have NO intersection between the cube
and the object.

difference () {
the_STL (); // mostly near the X axis, from -210 to +230
translate ([-230,0,0]) cube ([20,100,100], center=true);
}

THIS DOES NOT RENDER.

If I remove the cube from the difference statement:

difference () {
the_STL (); // mostly near the X axis, from -210 to +230
//translate ([-230,0,0]) cube ([20,100,100], center=true);
}

it renders instantly. It is when "difference" TRIES to do something
that it messes up the STL.

     Roger.

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
**
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Roger, Using a difference with only one object is an NOP, this is why it works without the cube if differencing the STL with the cube results in a FAIl even if the STL does not touch the cube, it's probably an issue with internal conversions ... Are you using Manifold or CGAL ? On Mon, Jan 8, 2024 at 9:38 AM Rogier Wolff via Discuss < discuss@lists.openscad.org> wrote: > On Mon, Jan 08, 2024 at 09:22:03AM +0100, Rogier Wolff via Discuss wrote: > > On Sun, Jan 07, 2024 at 07:46:36PM -0600, larry via Discuss wrote: > > > On Sun, 2024-01-07 at 22:15 +0100, Rogier Wolff via Discuss wrote: > > > > AH! Ok! I have meshlab, and someone on the internet recommended using > > > > 2 of the filters to "repair" STLs. Duh! Probably most of the filters > > > > would have some effect on SOME STLs and his just happened to be fixed > > > > by those two. But I wasn't about to go trying all 30-ish filters... > > > > > > I like to run an STL through https://www.formware.co/onlinestlrepair > > > before using Meshlab. It usually works for me. > > > > I usually use this one. In this case when Openscad failed to cut off > > the bottom half, that's the first I tried. Vertex count cahnged a bit, > > but not much more. And no effect on openscad. > > I thought of another experiment just now: What if I difference the STL > with a cube to just see where the problem is located in 3D space? > > So I created a cube, and placed it near one of the ends. And then I > came up with the idea to first have NO intersection between the cube > and the object. > > difference () { > the_STL (); // mostly near the X axis, from -210 to +230 > translate ([-230,0,0]) cube ([20,100,100], center=true); > } > > THIS DOES NOT RENDER. > > If I remove the cube from the difference statement: > > difference () { > the_STL (); // mostly near the X axis, from -210 to +230 > //translate ([-230,0,0]) cube ([20,100,100], center=true); > } > > it renders instantly. It is when "difference" TRIES to do something > that it messes up the STL. > > Roger. > > -- > ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 > ** > ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** > f equals m times a. When your f is steady, and your m is going down > your a is going up. -- Chris Hadfield about flying up the space shuttle. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RW
Raymond West
Mon, Jan 8, 2024 12:19 PM

I can generate an stl from openscad, and import it. If I then create a
cube, it will not render, but the cube does. Not always, just when you
don't want it to. pita!

On 08/01/2024 08:37, Rogier Wolff via Discuss wrote:

On Mon, Jan 08, 2024 at 09:22:03AM +0100, Rogier Wolff via Discuss wrote:

On Sun, Jan 07, 2024 at 07:46:36PM -0600, larry via Discuss wrote:

On Sun, 2024-01-07 at 22:15 +0100, Rogier Wolff via Discuss wrote:

AH! Ok! I have meshlab, and someone on the internet recommended using
2 of the filters to "repair" STLs. Duh! Probably most of the filters
would have some effect on SOME STLs and his just happened to be fixed
by those two. But I wasn't about to go trying all 30-ish filters...
I like to run an STL through https://www.formware.co/onlinestlrepair
before using Meshlab. It usually works for me.
I usually use this one. In this case when Openscad failed to cut off
the bottom half, that's the first I tried. Vertex count cahnged a bit,
but not much more. And no effect on openscad.
I thought of another experiment just now: What if I difference the STL
with a cube to just see where the problem is located in 3D space?

So I created a cube, and placed it near one of the ends. And then I
came up with the idea to first have NO intersection between the cube
and the object.

difference () {
the_STL (); // mostly near the X axis, from -210 to +230
translate ([-230,0,0]) cube ([20,100,100], center=true);
}

THIS DOES NOT RENDER.

If I remove the cube from the difference statement:

difference () {
the_STL (); // mostly near the X axis, from -210 to +230
//translate ([-230,0,0]) cube ([20,100,100], center=true);
}

it renders instantly. It is when "difference" TRIES to do something
that it messes up the STL.

Roger.
I can generate an stl from openscad, and import it. If I then create a cube, it will not render, but the cube does. Not always, just when you don't want it to. pita! On 08/01/2024 08:37, Rogier Wolff via Discuss wrote: > On Mon, Jan 08, 2024 at 09:22:03AM +0100, Rogier Wolff via Discuss wrote: >> On Sun, Jan 07, 2024 at 07:46:36PM -0600, larry via Discuss wrote: >>> On Sun, 2024-01-07 at 22:15 +0100, Rogier Wolff via Discuss wrote: >>>> AH! Ok! I have meshlab, and someone on the internet recommended using >>>> 2 of the filters to "repair" STLs. Duh! Probably most of the filters >>>> would have some effect on SOME STLs and his just happened to be fixed >>>> by those two. But I wasn't about to go trying all 30-ish filters... >>> I like to run an STL through https://www.formware.co/onlinestlrepair >>> before using Meshlab. It usually works for me. >> I usually use this one. In this case when Openscad failed to cut off >> the bottom half, that's the first I tried. Vertex count cahnged a bit, >> but not much more. And no effect on openscad. > I thought of another experiment just now: What if I difference the STL > with a cube to just see where the problem is located in 3D space? > > So I created a cube, and placed it near one of the ends. And then I > came up with the idea to first have NO intersection between the cube > and the object. > > difference () { > the_STL (); // mostly near the X axis, from -210 to +230 > translate ([-230,0,0]) cube ([20,100,100], center=true); > } > > THIS DOES NOT RENDER. > > If I remove the cube from the difference statement: > > difference () { > the_STL (); // mostly near the X axis, from -210 to +230 > //translate ([-230,0,0]) cube ([20,100,100], center=true); > } > > it renders instantly. It is when "difference" TRIES to do something > that it messes up the STL. > > Roger. >
RW
Rogier Wolff
Mon, Jan 8, 2024 12:36 PM

On Mon, Jan 08, 2024 at 12:19:52PM +0000, Raymond West via Discuss wrote:

I can generate an stl from openscad, and import it. If I then create a cube,
it will not render, but the cube does. Not always, just when you don't want
it to. pita!

I tried triggering this with my simple testcube, but was not able to
create a "small" example  where this would happen.

Roger. 

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

On Mon, Jan 08, 2024 at 12:19:52PM +0000, Raymond West via Discuss wrote: > I can generate an stl from openscad, and import it. If I then create a cube, > it will not render, but the cube does. Not always, just when you don't want > it to. pita! I tried triggering this with my simple testcube, but was not able to create a "small" example where this would happen. Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.
RW
Rogier Wolff
Tue, Jan 9, 2024 3:18 PM

On Sun, Jan 07, 2024 at 11:33:00PM +0100, Torsten Paul via Discuss wrote:

On 07.01.24 22:45, Rogier Wolff via Discuss wrote:

LOG: 0 Applied filter Remove T-Vertices by Edge Collapse in 322 msec

Edge collapse sounds wrong. FAQ says Edge flip.

Reflecting on the name, the edge flip might not work for the "all
points same" case. If all other triangles are connected correctly,
it could be ok to just remove it.

First: my checker reads the ascii file. If I understand things
correctly, the binary format uses an array of vertices and then
indexes into that array. You'll end up using 4 bytes instead of 12 so
for the first use you use 4 bytes extra, but if the vertex is used at
least one more time, you'll save space. And every vertex HAS to be
used at least twice. So that is 100% a space saver.

I "deduplicate" in my program "on the fly": Creating an array and then
referencing the vertices by indexing into that array. (maybe a bit in
preparation for simply being able to read the binary).

So if a binary file happens to have two different vertices with the
same coordinates, I wouldn't notice: If they print to the same ascii
representation, I'd always consider them the same.

That said: so far I see a perfectly connected mesh, except for the
three points which are exactly in line. There are some "very small
area" triangles, but none that are exactly zero. The one that was zero
had all three points at the same XY, but different Z.

When I tried fixing that with meshlab it asked me a question I
couldn't answer (some ratio), and then "fixed" WAY more triangles than
what I expected (1).

Ray sent me an STL that has the same issue: you can import it, and
once you simply add a cube, the render simply forgets about the
imported STL. I can't include his STL here for copyright reasons.
Ray says that it was produced by OpenScad.

The file I'm struggling with I also didn't dare publish here for
the same reason. I asked where  it came from and...
https://www.thingiverse.com/thing:6060750
it is public, so you can download it from there if you want to see
it for yourself.

I tried writing some "simple" openscad code that would show the same
behaviour as Ray's STL but was unable to trigger the problem. My STL is
already 3x bigger than Ray's.

Here is my attempt at trying to trigger the issue with an openscad
generated STL file.

// pcb.scad

$fs = .1;
$fa = 2;

if (1) {
//import ("photocellbox.stl");
difference () {
import ("pcb.stl", convexity = 10);
translate ([16,16,5]) cube (12);
}
} else {
difference () {
minkowski () {
cube (20.1);
sphere (3.1);
}
cylinder (d=10.2, h=50);
translate ([10.2,0,10.2]) rotate ([-90,0,0]) cylinder (d=6.2, h=50, center=true);
translate ([0,10.3,10]) rotate ([0,90,0]) cylinder (d=5.3, h=50, center=true);
translate ([14.2,14.1,-10.4]) cylinder (d=8.3, h=50);
translate ([15,15,0]) cube (12.1);
}
}

First run with 0 in the "if", render and save, then run with if (1) and
try to render. This DOES preview "funky". Ah! Fixed. Convexity=10 added.

Roger. 

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

On Sun, Jan 07, 2024 at 11:33:00PM +0100, Torsten Paul via Discuss wrote: > On 07.01.24 22:45, Rogier Wolff via Discuss wrote: > > LOG: 0 Applied filter Remove T-Vertices by Edge Collapse in 322 msec > > Edge collapse sounds wrong. FAQ says Edge *flip*. > > Reflecting on the name, the edge flip might not work for the "all > points same" case. If all other triangles are connected correctly, > it could be ok to just remove it. First: my checker reads the ascii file. If I understand things correctly, the binary format uses an array of vertices and then indexes into that array. You'll end up using 4 bytes instead of 12 so for the first use you use 4 bytes extra, but if the vertex is used at least one more time, you'll save space. And every vertex HAS to be used at least twice. So that is 100% a space saver. I "deduplicate" in my program "on the fly": Creating an array and then referencing the vertices by indexing into that array. (maybe a bit in preparation for simply being able to read the binary). So if a binary file happens to have two different vertices with the same coordinates, I wouldn't notice: If they print to the same ascii representation, I'd always consider them the same. That said: so far I see a perfectly connected mesh, except for the three points which are exactly in line. There are some "very small area" triangles, but none that are exactly zero. The one that was zero had all three points at the same XY, but different Z. When I tried fixing that with meshlab it asked me a question I couldn't answer (some ratio), and then "fixed" WAY more triangles than what I expected (1). Ray sent me an STL that has the same issue: you can import it, and once you simply add a cube, the render simply forgets about the imported STL. I can't include his STL here for copyright reasons. Ray says that it was produced by OpenScad. The file I'm struggling with I also didn't dare publish here for the same reason. I asked where it came from and... https://www.thingiverse.com/thing:6060750 it is public, so you can download it from there if you want to see it for yourself. I tried writing some "simple" openscad code that would show the same behaviour as Ray's STL but was unable to trigger the problem. My STL is already 3x bigger than Ray's. Here is my attempt at trying to trigger the issue with an openscad generated STL file. // pcb.scad $fs = .1; $fa = 2; if (1) { //import ("photocellbox.stl"); difference () { import ("pcb.stl", convexity = 10); translate ([16,16,5]) cube (12); } } else { difference () { minkowski () { cube (20.1); sphere (3.1); } cylinder (d=10.2, h=50); translate ([10.2,0,10.2]) rotate ([-90,0,0]) cylinder (d=6.2, h=50, center=true); translate ([0,10.3,10]) rotate ([0,90,0]) cylinder (d=5.3, h=50, center=true); translate ([14.2,14.1,-10.4]) cylinder (d=8.3, h=50); translate ([15,15,0]) cube (12.1); } } First run with 0 in the "if", render and save, then run with if (1) and try to render. This DOES preview "funky". Ah! Fixed. Convexity=10 added. Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.
TP
Torsten Paul
Tue, Jan 9, 2024 6:26 PM

On 09.01.24 16:18, Rogier Wolff wrote:

So if a binary file happens to have two different vertices with the
same coordinates, I wouldn't notice: If they print to the same ascii
representation, I'd always consider them the same.

That sounds like the total opposite of
https://github.com/openscad/openscad/pull/4855

So the general answer is probably: it depends. Unfortunately.

When I tried fixing that with meshlab it asked me a question I
couldn't answer (some ratio), and then "fixed" WAY more triangles than
what I expected (1).

That is answered in the FAQ: use very high value to prevent model
edges to be modified.

ciao,
Torsten.

On 09.01.24 16:18, Rogier Wolff wrote: > So if a binary file happens to have two different vertices with the > same coordinates, I wouldn't notice: If they print to the same ascii > representation, I'd always consider them the same. That sounds like the total opposite of https://github.com/openscad/openscad/pull/4855 So the general answer is probably: it depends. Unfortunately. > When I tried fixing that with meshlab it asked me a question I > couldn't answer (some ratio), and then "fixed" WAY more triangles than > what I expected (1). That is answered in the FAQ: use very high value to prevent model edges to be modified. ciao, Torsten.