discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

dxf and stl import/rendering issue

L
lalbers
Sun, Jan 31, 2016 6:34 PM

I spoke too soon - I get both rendered together as long as the rail is
vertical, when I try to position the bearing on the rail I get:

Rendering Polygon Mesh using CGAL...
ERROR: CGAL error in CGALUtils::applyBinaryOperator union: CGAL ERROR:
assertion violation! Expr: target(s1).vertex()==target(s2).vertex() File:
/opt/mxe/usr/x86_64-w64-mingw32.static/include/CGAL/Nef_3/SNC_FM_decorator.h
Line: 218

I also tried getting the intersection of the STL with a cube that was bigger
than it but it didn't help.

--
View this message in context: http://forum.openscad.org/dxf-and-stl-import-rendering-issue-tp15979p15999.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I spoke too soon - I get both rendered together as long as the rail is vertical, when I try to position the bearing on the rail I get: Rendering Polygon Mesh using CGAL... ERROR: CGAL error in CGALUtils::applyBinaryOperator union: CGAL ERROR: assertion violation! Expr: target(s1).vertex()==target(s2).vertex() File: /opt/mxe/usr/x86_64-w64-mingw32.static/include/CGAL/Nef_3/SNC_FM_decorator.h Line: 218 I also tried getting the intersection of the STL with a cube that was bigger than it but it didn't help. -- View this message in context: http://forum.openscad.org/dxf-and-stl-import-rendering-issue-tp15979p15999.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Sun, Jan 31, 2016 10:40 PM

CGAL is not called all the time in rendering, when t needs to do a boolean it
will be called, hence why each separately is OK.

The carriage STL is bad, it has self intersections
http://forum.openscad.org/file/n16004/td15979.jpg

Netfabb cloud doesn't fix all of them
http://forum.openscad.org/file/n16004/td15979_fixed_1.jpg

A second fix, got the four on the main body, but didn't fix the ones on the
nipple, neither did a third fix.

Meshlab shows
http://forum.openscad.org/file/n16004/td15979_meshlab2.jpg

Needs fixing...


Newly minted Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/dxf-and-stl-import-rendering-issue-tp15979p16004.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

CGAL is not called all the time in rendering, when t needs to do a boolean it will be called, hence why each separately is OK. The carriage STL is bad, it has self intersections <http://forum.openscad.org/file/n16004/td15979.jpg> Netfabb cloud doesn't fix all of them <http://forum.openscad.org/file/n16004/td15979_fixed_1.jpg> A second fix, got the four on the main body, but didn't fix the ones on the nipple, neither did a third fix. Meshlab shows <http://forum.openscad.org/file/n16004/td15979_meshlab2.jpg> Needs fixing... ----- Newly minted Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/dxf-and-stl-import-rendering-issue-tp15979p16004.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Sun, Jan 31, 2016 11:11 PM

Note that when dealing with STLs it is also good to have a look in
View/Thrown-together
You see strange things, pointing to issues.

Original STL:
http://forum.openscad.org/file/n16005/Thrown_together.jpg


Newly minted Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/dxf-and-stl-import-rendering-issue-tp15979p16005.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Note that when dealing with STLs it is also good to have a look in View/Thrown-together You see strange things, pointing to issues. Original STL: <http://forum.openscad.org/file/n16005/Thrown_together.jpg> ----- Newly minted Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/dxf-and-stl-import-rendering-issue-tp15979p16005.html Sent from the OpenSCAD mailing list archive at Nabble.com.
L
lalbers
Sun, Jan 31, 2016 11:28 PM

Thank you very much.  I'm new to all this - just downloaded meshlab and will
see if i can figure out how to fix this STL file.  I don't really need the
zerk fitting on the carriage but it looks cool so if I can save it I will.

I'm curious how the guy with the mac managed to get this to work in openSCAD
without repairing the model

--
View this message in context: http://forum.openscad.org/dxf-and-stl-import-rendering-issue-tp15979p16006.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Thank you very much. I'm new to all this - just downloaded meshlab and will see if i can figure out how to fix this STL file. I don't really need the zerk fitting on the carriage but it looks cool so if I can save it I will. I'm curious how the guy with the mac managed to get this to work in openSCAD without repairing the model -- View this message in context: http://forum.openscad.org/dxf-and-stl-import-rendering-issue-tp15979p16006.html Sent from the OpenSCAD mailing list archive at Nabble.com.
A
arnholm@arnholm.org
Mon, Feb 1, 2016 8:36 AM

On 2016-01-31 23:40, MichaelAtOz wrote:

CGAL is not called all the time in rendering, when t needs to do a
boolean it
will be called, hence why each separately is OK.

The carriage STL is bad, it has self intersections
http://forum.openscad.org/file/n16004/td15979.jpg

These cases appear to be good examples illustrating that STL will always
be a problem for import with the intent of performing further boolean
operations. The fact that different software report different problems
(or sometimes none at all), is a further aspect of this.

STL isn't perfect as input to slicers, but for that purpose it isn't
quite as critical that everything is water tight. For booleans, however
it is critical. Put differently, any format that does not bring along
its own topology will be an eternal problem for booleans.

Carsten Arnholm

On 2016-01-31 23:40, MichaelAtOz wrote: > CGAL is not called all the time in rendering, when t needs to do a > boolean it > will be called, hence why each separately is OK. > > The carriage STL is bad, it has self intersections > <http://forum.openscad.org/file/n16004/td15979.jpg> These cases appear to be good examples illustrating that STL will always be a problem for import with the intent of performing further boolean operations. The fact that different software report different problems (or sometimes none at all), is a further aspect of this. STL isn't perfect as input to slicers, but for that purpose it isn't quite as critical that everything is water tight. For booleans, however it is critical. Put differently, any format that does not bring along its own topology will be an eternal problem for booleans. Carsten Arnholm
NH
nop head
Mon, Feb 1, 2016 9:26 AM

It doesn't matter what the file format is, if it has self intersections
some programs won't like it, others don't care. If you look at the
kisslicer key you see there is no colour for self intersections.

Also what classes as degenerate triangles seems to vary between programs. A
true degenerate triangle has zero area, so is a line or a point but very
thin triangles are counted as degenerate by some programs.

I think anything with vertices too close together will upset OpenScad due
to its snap to grid, nothing to do with STL.

You keep repeating STL cant preserve topology, but that doesn't make it
true. If it is written correctly and read correctly topology can be
preserved unambiguously it is just implicit not explicit. If the source or
target resolution is different from the file resolution then it is
difficult to get right, which is why most programs are buggy.

Using a file format with explicit topology would still fail in this case.

On 1 February 2016 at 08:36, arnholm@arnholm.org wrote:

On 2016-01-31 23:40, MichaelAtOz wrote:

CGAL is not called all the time in rendering, when t needs to do a
boolean it
will be called, hence why each separately is OK.

The carriage STL is bad, it has self intersections
http://forum.openscad.org/file/n16004/td15979.jpg

These cases appear to be good examples illustrating that STL will always
be a problem for import with the intent of performing further boolean
operations. The fact that different software report different problems (or
sometimes none at all), is a further aspect of this.

STL isn't perfect as input to slicers, but for that purpose it isn't quite
as critical that everything is water tight. For booleans, however it is
critical. Put differently, any format that does not bring along its own
topology will be an eternal problem for booleans.

Carsten Arnholm


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

It doesn't matter what the file format is, if it has self intersections some programs won't like it, others don't care. If you look at the kisslicer key you see there is no colour for self intersections. Also what classes as degenerate triangles seems to vary between programs. A true degenerate triangle has zero area, so is a line or a point but very thin triangles are counted as degenerate by some programs. I think anything with vertices too close together will upset OpenScad due to its snap to grid, nothing to do with STL. You keep repeating STL cant preserve topology, but that doesn't make it true. If it is written correctly and read correctly topology can be preserved unambiguously it is just implicit not explicit. If the source or target resolution is different from the file resolution then it is difficult to get right, which is why most programs are buggy. Using a file format with explicit topology would still fail in this case. On 1 February 2016 at 08:36, <arnholm@arnholm.org> wrote: > On 2016-01-31 23:40, MichaelAtOz wrote: > >> CGAL is not called all the time in rendering, when t needs to do a >> boolean it >> will be called, hence why each separately is OK. >> >> The carriage STL is bad, it has self intersections >> <http://forum.openscad.org/file/n16004/td15979.jpg> >> > > These cases appear to be good examples illustrating that STL will always > be a problem for import with the intent of performing further boolean > operations. The fact that different software report different problems (or > sometimes none at all), is a further aspect of this. > > STL isn't perfect as input to slicers, but for that purpose it isn't quite > as critical that everything is water tight. For booleans, however it is > critical. Put differently, any format that does not bring along its own > topology will be an eternal problem for booleans. > > Carsten Arnholm > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
CA
Carsten Arnholm
Mon, Feb 1, 2016 7:49 PM

On 01. feb. 2016 10:26, nop head wrote:

It doesn't matter what the file format is, if it has self intersections
some programs won't like it, others don't care.

That's pretty much beside the issue. If the original topology is
self-intersecting or otherwise wrong, the file format obviously does not
matter. However, when the file representation does not include explicit
topology, then you have no way of knowing what the original definition
was, it might have been good. It might be the guess the software made on
import that was wrong, you cannot tell. That was sort of my point.

Also, the fact you point to, that different programs interpret the same
input differently, should be a pretty strong sign that using geometry
only representation is too weak for further boolean work.

If you look at the
kisslicer key you see there is no colour for self intersections.

Sure, but how is that relevant for topology and boolean operations? I
Use KISSlicer. KISSlicer is a slicer and does not do boolean operations.
As I mentioned earlier "STL isn't perfect as input to slicers, but for
that purpose it isn't quite as critical that everything is water tight."

Also what classes as degenerate triangles seems to vary between
programs.

This is talking about geometry. Topology is completely decoupled from
geometry.

A true degenerate triangle has zero area, so is a line or a
point but very thin triangles are counted as degenerate by some programs.

Again, this is geometry.

I think anything with vertices too close together will upset OpenScad
due to its snap to grid, nothing to do with STL.

Again, you are talking about geometry. That is a different issue,
although important.

You keep repeating STL cant preserve topology, but that doesn't make it
true.

Well, you keep asserting the opposite, but mere assertions does not make
it true either. Therefore, let me give you one very simple example where
a geometry-only representation will fail to preserve the original
topology: http://arnholm.org/tmp/openscad/topology_stl.png

The above is simplified, but from a real-life case in a related field
and has not been constructed from pure theory.

If it is written correctly and read correctly topology can be
preserved unambiguously it is just implicit not explicit.

With all due respect, this is not true. See above for one example.

If the source
or target resolution is different from the file resolution then it is
difficult to get right, which is why most programs are buggy.

Correct geometry is also very important, I agree with that. OpenSCAD has
the problem you describe.

But it is a separate issue from topology. I will give some examples
below on how STL as implemented also fails to preserve geometry
correctly given the intent of performing boolean operations.

Using a file format with explicit topology would still fail in this case.

Understanding communicated topology is unrelated to numerical
resolution. How you apply the topology and geometry is something else.

On the question of geometry: I did some simple tests on creating and
importing STL files with the intent of performing boolean operations.
The .scad and related STL files (the STL files can also be created from
the example itself) are found in
http://arnholm.org/tmp/openscad/topo_geo_test.7z

I also copy the OpenSCAD code below. This illustrates that STL files as
implemented today also fail to preserve geometry 100%, leading to errors
when trying to import and perform boolean operations. Like it or not,
STL is not suited for such purposes.

// Render with "F6" on each step
step=1;

if(step==1)
planes();
// export as "step1.stl"

else if(step==2)
import(file="step1.stl");
// re-export as "step2.stl"

else if(step==3)
diff3();
else if(step==4)
diff4();
else if(step==5)
diff5();
else if(step==6)
diff6();

module planes(h=.1)
{
rotate([22,33,44])
union() {
linear_extrude(height=h)square(30);
translate([-25,15,-15])
rotate([90,0,0])
linear_extrude(height=h)square(30);
}
}

module diff3()
{
difference() {
planes();
planes();
}
}

module diff4()
{
difference() {
planes();
import(file="step1.stl");
}
}

module diff5()
{
difference() {
planes();
import(file="step2.stl");
}
}

module diff6()
{
difference() {
import(file="step1.stl");
import(file="step2.stl");
}
}

Carsten Arnholm

On 01. feb. 2016 10:26, nop head wrote: > It doesn't matter what the file format is, if it has self intersections > some programs won't like it, others don't care. That's pretty much beside the issue. If the original topology is self-intersecting or otherwise wrong, the file format obviously does not matter. However, when the file representation does not include explicit topology, then you have no way of knowing what the original definition was, it might have been good. It might be the guess the software made on import that was wrong, you cannot tell. That was sort of my point. Also, the fact you point to, that different programs interpret the same input differently, should be a pretty strong sign that using geometry only representation is too weak for further boolean work. > If you look at the > kisslicer key you see there is no colour for self intersections. Sure, but how is that relevant for topology and boolean operations? I Use KISSlicer. KISSlicer is a slicer and does not do boolean operations. As I mentioned earlier "STL isn't perfect as input to slicers, but for that purpose it isn't quite as critical that everything is water tight." > Also what classes as degenerate triangles seems to vary between > programs. This is talking about geometry. Topology is completely decoupled from geometry. > A true degenerate triangle has zero area, so is a line or a > point but very thin triangles are counted as degenerate by some programs. Again, this is geometry. > I think anything with vertices too close together will upset OpenScad > due to its snap to grid, nothing to do with STL. Again, you are talking about geometry. That is a different issue, although important. > You keep repeating STL cant preserve topology, but that doesn't make it > true. Well, you keep asserting the opposite, but mere assertions does not make it true either. Therefore, let me give you one very simple example where a geometry-only representation will fail to preserve the original topology: http://arnholm.org/tmp/openscad/topology_stl.png The above is simplified, but from a real-life case in a related field and has not been constructed from pure theory. > If it is written correctly and read correctly topology can be > preserved unambiguously it is just implicit not explicit. With all due respect, this is not true. See above for one example. > If the source > or target resolution is different from the file resolution then it is > difficult to get right, which is why most programs are buggy. Correct geometry is also very important, I agree with that. OpenSCAD has the problem you describe. But it is a separate issue from topology. I will give some examples below on how STL as implemented also fails to preserve geometry correctly given the intent of performing boolean operations. > Using a file format with explicit topology would still fail in this case. Understanding communicated topology is unrelated to numerical resolution. How you apply the topology and geometry is something else. On the question of geometry: I did some simple tests on creating and importing STL files with the intent of performing boolean operations. The .scad and related STL files (the STL files can also be created from the example itself) are found in http://arnholm.org/tmp/openscad/topo_geo_test.7z I also copy the OpenSCAD code below. This illustrates that STL files as implemented today also fail to preserve geometry 100%, leading to errors when trying to import and perform boolean operations. Like it or not, STL is not suited for such purposes. // Render with "F6" on each step step=1; if(step==1) planes(); // export as "step1.stl" else if(step==2) import(file="step1.stl"); // re-export as "step2.stl" else if(step==3) diff3(); else if(step==4) diff4(); else if(step==5) diff5(); else if(step==6) diff6(); module planes(h=.1) { rotate([22,33,44]) union() { linear_extrude(height=h)square(30); translate([-25,15,-15]) rotate([90,0,0]) linear_extrude(height=h)square(30); } } module diff3() { difference() { planes(); planes(); } } module diff4() { difference() { planes(); import(file="step1.stl"); } } module diff5() { difference() { planes(); import(file="step2.stl"); } } module diff6() { difference() { import(file="step1.stl"); import(file="step2.stl"); } } Carsten Arnholm
DM
doug moen
Mon, Feb 1, 2016 8:06 PM

What is the alternative to STL? What's an example of a polyhedral mesh file
format that includes explicit topology?

On 1 February 2016 at 14:49, Carsten Arnholm arnholm@arnholm.org wrote:

On 01. feb. 2016 10:26, nop head wrote:

It doesn't matter what the file format is, if it has self intersections
some programs won't like it, others don't care.

That's pretty much beside the issue. If the original topology is
self-intersecting or otherwise wrong, the file format obviously does not
matter. However, when the file representation does not include explicit
topology, then you have no way of knowing what the original definition was,
it might have been good. It might be the guess the software made on import
that was wrong, you cannot tell. That was sort of my point.

Also, the fact you point to, that different programs interpret the same
input differently, should be a pretty strong sign that using geometry only
representation is too weak for further boolean work.

If you look at the

kisslicer key you see there is no colour for self intersections.

Sure, but how is that relevant for topology and boolean operations? I Use
KISSlicer. KISSlicer is a slicer and does not do boolean operations. As I
mentioned earlier "STL isn't perfect as input to slicers, but for that
purpose it isn't quite as critical that everything is water tight."

Also what classes as degenerate triangles seems to vary between

programs.

This is talking about geometry. Topology is completely decoupled from
geometry.

A true degenerate triangle has zero area, so is a line or a

point but very thin triangles are counted as degenerate by some programs.

Again, this is geometry.

I think anything with vertices too close together will upset OpenScad

due to its snap to grid, nothing to do with STL.

Again, you are talking about geometry. That is a different issue, although
important.

You keep repeating STL cant preserve topology, but that doesn't make it

true.

Well, you keep asserting the opposite, but mere assertions does not make
it true either. Therefore, let me give you one very simple example where a
geometry-only representation will fail to preserve the original topology:
http://arnholm.org/tmp/openscad/topology_stl.png

The above is simplified, but from a real-life case in a related field and
has not been constructed from pure theory.

If it is written correctly and read correctly topology can be

preserved unambiguously it is just implicit not explicit.

With all due respect, this is not true. See above for one example.

If the source

or target resolution is different from the file resolution then it is
difficult to get right, which is why most programs are buggy.

Correct geometry is also very important, I agree with that. OpenSCAD has
the problem you describe.

But it is a separate issue from topology. I will give some examples below
on how STL as implemented also fails to preserve geometry correctly given
the intent of performing boolean operations.

Using a file format with explicit topology would still fail in this case.

Understanding communicated topology is unrelated to numerical resolution.
How you apply the topology and geometry is something else.

On the question of geometry: I did some simple tests on creating and
importing STL files with the intent of performing boolean operations. The
.scad and related STL files (the STL files can also be created from the
example itself) are found in
http://arnholm.org/tmp/openscad/topo_geo_test.7z

I also copy the OpenSCAD code below. This illustrates that STL files as
implemented today also fail to preserve geometry 100%, leading to errors
when trying to import and perform boolean operations. Like it or not, STL
is not suited for such purposes.

// Render with "F6" on each step
step=1;

if(step==1)
planes();
// export as "step1.stl"

else if(step==2)
import(file="step1.stl");
// re-export as "step2.stl"

else if(step==3)
diff3();
else if(step==4)
diff4();
else if(step==5)
diff5();
else if(step==6)
diff6();

module planes(h=.1)
{
rotate([22,33,44])
union() {
linear_extrude(height=h)square(30);
translate([-25,15,-15])
rotate([90,0,0])
linear_extrude(height=h)square(30);
}
}

module diff3()
{
difference() {
planes();
planes();
}
}

module diff4()
{
difference() {
planes();
import(file="step1.stl");
}
}

module diff5()
{
difference() {
planes();
import(file="step2.stl");
}
}

module diff6()
{
difference() {
import(file="step1.stl");
import(file="step2.stl");

}

}

Carsten Arnholm


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

What is the alternative to STL? What's an example of a polyhedral mesh file format that includes explicit topology? On 1 February 2016 at 14:49, Carsten Arnholm <arnholm@arnholm.org> wrote: > On 01. feb. 2016 10:26, nop head wrote: > >> It doesn't matter what the file format is, if it has self intersections >> some programs won't like it, others don't care. >> > > That's pretty much beside the issue. If the original topology is > self-intersecting or otherwise wrong, the file format obviously does not > matter. However, when the file representation does not include explicit > topology, then you have no way of knowing what the original definition was, > it might have been good. It might be the guess the software made on import > that was wrong, you cannot tell. That was sort of my point. > > Also, the fact you point to, that different programs interpret the same > input differently, should be a pretty strong sign that using geometry only > representation is too weak for further boolean work. > > If you look at the >> kisslicer key you see there is no colour for self intersections. >> > > Sure, but how is that relevant for topology and boolean operations? I Use > KISSlicer. KISSlicer is a slicer and does not do boolean operations. As I > mentioned earlier "STL isn't perfect as input to slicers, but for that > purpose it isn't quite as critical that everything is water tight." > > Also what classes as degenerate triangles seems to vary between >> programs. >> > > This is talking about geometry. Topology is completely decoupled from > geometry. > > A true degenerate triangle has zero area, so is a line or a >> point but very thin triangles are counted as degenerate by some programs. >> > > Again, this is geometry. > > I think anything with vertices too close together will upset OpenScad >> due to its snap to grid, nothing to do with STL. >> > > Again, you are talking about geometry. That is a different issue, although > important. > > You keep repeating STL cant preserve topology, but that doesn't make it >> true. >> > > Well, you keep asserting the opposite, but mere assertions does not make > it true either. Therefore, let me give you one very simple example where a > geometry-only representation will fail to preserve the original topology: > http://arnholm.org/tmp/openscad/topology_stl.png > > The above is simplified, but from a real-life case in a related field and > has not been constructed from pure theory. > > If it is written correctly and read correctly topology can be >> preserved unambiguously it is just implicit not explicit. >> > > With all due respect, this is not true. See above for one example. > > If the source >> or target resolution is different from the file resolution then it is >> difficult to get right, which is why most programs are buggy. >> > > Correct geometry is also very important, I agree with that. OpenSCAD has > the problem you describe. > > But it is a separate issue from topology. I will give some examples below > on how STL as implemented also fails to preserve geometry correctly given > the intent of performing boolean operations. > > Using a file format with explicit topology would still fail in this case. >> > > Understanding communicated topology is unrelated to numerical resolution. > How you apply the topology and geometry is something else. > > On the question of geometry: I did some simple tests on creating and > importing STL files with the intent of performing boolean operations. The > .scad and related STL files (the STL files can also be created from the > example itself) are found in > http://arnholm.org/tmp/openscad/topo_geo_test.7z > > I also copy the OpenSCAD code below. This illustrates that STL files as > implemented today also fail to preserve geometry 100%, leading to errors > when trying to import and perform boolean operations. Like it or not, STL > is not suited for such purposes. > > > // Render with "F6" on each step > step=1; > > if(step==1) > planes(); > // export as "step1.stl" > > else if(step==2) > import(file="step1.stl"); > // re-export as "step2.stl" > > else if(step==3) > diff3(); > else if(step==4) > diff4(); > else if(step==5) > diff5(); > else if(step==6) > diff6(); > > module planes(h=.1) > { > rotate([22,33,44]) > union() { > linear_extrude(height=h)square(30); > translate([-25,15,-15]) > rotate([90,0,0]) > linear_extrude(height=h)square(30); > } > } > > module diff3() > { > difference() { > planes(); > planes(); > } > } > > module diff4() > { > difference() { > planes(); > import(file="step1.stl"); > } > } > > module diff5() > { > difference() { > planes(); > import(file="step2.stl"); > } > } > > module diff6() > { > difference() { > import(file="step1.stl"); > import(file="step2.stl"); > > } > } > > Carsten Arnholm > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > >
CA
Carsten Arnholm
Mon, Feb 1, 2016 8:25 PM

On 01. feb. 2016 21:06, doug moen wrote:

What is the alternative to STL? What's an example of a polyhedral mesh
file format that includes explicit topology?

AMF has already been mentioned. Not because it is ideal, but simply
because it exists and is already available as an export format in OpenSCAD.

Other possibilities have been mentioned also.

Carsten Arnholm

On 01. feb. 2016 21:06, doug moen wrote: > What is the alternative to STL? What's an example of a polyhedral mesh > file format that includes explicit topology? AMF has already been mentioned. Not because it is ideal, but simply because it exists and is already available as an export format in OpenSCAD. Other possibilities have been mentioned also. Carsten Arnholm
NH
nop head
Tue, Feb 2, 2016 12:24 AM

The example you gave of the crack is non-manifold if vertices 5 & 7 are not
distinct.  STL can represent manifold meshes unambiguously and you can then
do boolean ops on them. It is no different to constructing a polyhedron
inside OpenScad. As long as you make it manifold CGAL will work, if you
don't it will barf.

As soon as you have topologically distinct vertices that are numerically
the same STL can't represent the topology, but that doesn't matter because
we are only interested in 2 manifold meshes for CSG.

As long as you have the property that topologically distinct vertices that
are numerically distinct then you can convert a mesh to a list of triangles
and then reconstruct the mesh from those triangles. It will be exactly the
same. Although there is no explicit topological information in the file the
reconstructed mesh has exactly the same topology as the original. If this
wasn't the case STL would be completely useless.

The weakness of STL is it relies on vertex values not being rounded or
truncated. They must be written and read with great care, especially in
ASCII. The reason lots of programs can't read it or write it correctly is
because it isn't easy. OpenScad can't do it correctly in all circumstances.
As soon as you round or truncate you run the risk of breaking the topology.
Yes topology: if you collapse two vertices that were not previously
touching you have changed the geometry minutely but you have changed the
topology, which is what causes the problem.

Degenerate triangles are a different problem. Agreed they don't break the
topology and are still manifold. They still have a winding order, so you
can work out which way out they face but you can't work out a face normal,
which upsets some programs.

Your multi-step problem is nothing to do with topology. It is simply that
converting the vertices to float from a higher resolution has moved them a
bit. When differenced with the internal representation you get a non zero
result. When the vertices are very close then truncation can cause
topological corruption and that needs to be corrected before writing the
STL, but in this case that doesn't apply. The original vertices are at
least 0.1mm apart.

When imported the results are differenced with the non-trucated versions
the result is very thin slivers and OpenScad seems to not be able to handle
them correctly. Not too surprising as they only differ by less that the
resolution of a float.

Doing the same thing with any other file format will result in the same
mess if the vertex representation is different from OpenScad's. The
problems are purely due to truncation to floats.

step1.stl and step2.stl have exactly the same vertices. The only difference
is the face normals differ slightly. This must be because they are
calculated using the higher precision internal representation, not the
actual vertex values written in the file. Step 6 is correctly empty.

On 1 February 2016 at 20:25, Carsten Arnholm arnholm@arnholm.org wrote:

On 01. feb. 2016 21:06, doug moen wrote:

What is the alternative to STL? What's an example of a polyhedral mesh
file format that includes explicit topology?

AMF has already been mentioned. Not because it is ideal, but simply
because it exists and is already available as an export format in OpenSCAD.

Other possibilities have been mentioned also.

Carsten Arnholm


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

The example you gave of the crack is non-manifold if vertices 5 & 7 are not distinct. STL can represent manifold meshes unambiguously and you can then do boolean ops on them. It is no different to constructing a polyhedron inside OpenScad. As long as you make it manifold CGAL will work, if you don't it will barf. As soon as you have topologically distinct vertices that are numerically the same STL can't represent the topology, but that doesn't matter because we are only interested in 2 manifold meshes for CSG. As long as you have the property that topologically distinct vertices that are numerically distinct then you can convert a mesh to a list of triangles and then reconstruct the mesh from those triangles. It will be exactly the same. Although there is no explicit topological information in the file the reconstructed mesh has exactly the same topology as the original. If this wasn't the case STL would be completely useless. The weakness of STL is it relies on vertex values not being rounded or truncated. They must be written and read with great care, especially in ASCII. The reason lots of programs can't read it or write it correctly is because it isn't easy. OpenScad can't do it correctly in all circumstances. As soon as you round or truncate you run the risk of breaking the topology. Yes topology: if you collapse two vertices that were not previously touching you have changed the geometry minutely but you have changed the topology, which is what causes the problem. Degenerate triangles are a different problem. Agreed they don't break the topology and are still manifold. They still have a winding order, so you can work out which way out they face but you can't work out a face normal, which upsets some programs. Your multi-step problem is nothing to do with topology. It is simply that converting the vertices to float from a higher resolution has moved them a bit. When differenced with the internal representation you get a non zero result. When the vertices are very close then truncation can cause topological corruption and that needs to be corrected before writing the STL, but in this case that doesn't apply. The original vertices are at least 0.1mm apart. When imported the results are differenced with the non-trucated versions the result is very thin slivers and OpenScad seems to not be able to handle them correctly. Not too surprising as they only differ by less that the resolution of a float. Doing the same thing with any other file format will result in the same mess if the vertex representation is different from OpenScad's. The problems are purely due to truncation to floats. step1.stl and step2.stl have exactly the same vertices. The only difference is the face normals differ slightly. This must be because they are calculated using the higher precision internal representation, not the actual vertex values written in the file. Step 6 is correctly empty. On 1 February 2016 at 20:25, Carsten Arnholm <arnholm@arnholm.org> wrote: > On 01. feb. 2016 21:06, doug moen wrote: > >> What is the alternative to STL? What's an example of a polyhedral mesh >> file format that includes explicit topology? >> > > AMF has already been mentioned. Not because it is ideal, but simply > because it exists and is already available as an export format in OpenSCAD. > > Other possibilities have been mentioned also. > > > Carsten Arnholm > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >