Summary:
WARNING: Normalized tree is growing past 200000 elements. Aborting normalization.
WARNING: CSG normalization resulted in an empty tree
Dear OpenSCAD folks,
I have a 3d scan of a cat. I want to make it post-processable by converting the surface area to a volume.
Here is the idea:
OpenSCAD has a polyhedron(). Polyhedron describes 2d surfaces in a 3d volume. If you are very "lucky", those surfaces provide a closed volume.
Example
+----------+f
/g /|
/ / |
/ / |
/ / |
+----------+ |
|a |b |
| | |
| | |
| | |
| | |
| | +e
| | /
| | /
| | /
|c |/
+----------+d
points=[
[a],
[b],
[c],
[d],
[e],
[f]
];
faces=[
[a,b,c,d],
[b,d,e,f],
[a,b,f,g]
]
polyhedron(points, faces);
The STL file format has basically the same idea. Provide a list of coordinates that form a surface, provide a list of surfaces.
Minor implementation detail: Instead of providing (multi point) polygon surfaces, you may just provide triangles. Polyhedron() implements this as polyhedron(triangles=) and STL implements this as STL-binary-file-format.
My personal opinion is that people hurt themselfs with polyhedron() and STL. You may create something that appears to be a cube, but has just 5 sides. Its preview will be fine, but it cannot be rendered, cannot be exported and cannot be printed.
It happend recently on this mailing list that people provided non-closed polyhedra. The first one was a scan of a pet - a surface in 3D space, the second example was a spare part for a car - a surface in 3D space.
I think there is a generic case that can be helped:
Instead of using polyhedron() to draw surfaces into 3d space, we can use hull() to create volumes in 3d space.
An implementation looks like this
module hullhedron( vertice_list, surface_list){
for( a_surface = surface_list) {
hull(){
for( a_coordinate_index = a_surface) {
translate( vertice_list[ a_coordinate_index ]) cube(1);
}
}
}
}
To prove my idea a am trying to post process the 3d scan of a cat. I got a list of vertices and surfaces extracted from a STL. There are 3 million vertices and a similar number of surfaces/volumes. I am exceeding OpenSCAD caches. What do I need to set to fix
WARNING: Normalized tree is growing past 200000 elements. Aborting normalization.
WARNING: CSG normalization resulted in an empty tree
?
Any other recommendation how to overcome limits for a resource wasteful prototyp?
OS: Linux
OpenSCAD version: OpenSCAD-2023.07.09.ai15799-x86_64.AppImage, but I may work with any of the pre compiled binaries
Outlook: If the prototyp works, we can start creating closed volumes from 3d scans by providing a common center per model that each volume needs to connect to.
Bonus: I promised you a CAT-Scan; Picture is attached :-)
Bonus: hullhedron() example attached
Bonus: If you are interested in processing 60MByte of binary STL yourself, I will provide raw data.
Cheers,
Marcus
Edit -> Preferences -> Advanced -> OpenCSG -> "Turn off rendering at _____
elements".
Try adding a zero or two.
On Sun, Jul 14, 2024 at 2:29 AM Marcus Poller via Discuss <
discuss@lists.openscad.org> wrote:
Summary:
WARNING: Normalized tree is growing past 200000 elements. Aborting
normalization.
WARNING: CSG normalization resulted in an empty tree
Dear OpenSCAD folks,
I have a 3d scan of a cat. I want to make it post-processable by
converting the surface area to a volume.
Here is the idea:
OpenSCAD has a polyhedron(). Polyhedron describes 2d surfaces in a 3d
volume. If you are very "lucky", those surfaces provide a closed volume.
Example
+----------+f
/g /|
/ / |
/ / |
/ / |
+----------+ |
|a |b |
| | |
| | |
| | |
| | |
| | +e
| | /
| | /
| | /
|c |/
+----------+d
points=[
[a],
[b],
[c],
[d],
[e],
[f]
];
faces=[
[a,b,c,d],
[b,d,e,f],
[a,b,f,g]
]
polyhedron(points, faces);
The STL file format has basically the same idea. Provide a list of
coordinates that form a surface, provide a list of surfaces.
Minor implementation detail: Instead of providing (multi point) polygon
surfaces, you may just provide triangles. Polyhedron() implements this as
polyhedron(triangles=) and STL implements this as STL-binary-file-format.
My personal opinion is that people hurt themselfs with polyhedron() and
STL. You may create something that appears to be a cube, but has just 5
sides. Its preview will be fine, but it cannot be rendered, cannot be
exported and cannot be printed.
It happend recently on this mailing list that people provided non-closed
polyhedra. The first one was a scan of a pet - a surface in 3D space, the
second example was a spare part for a car - a surface in 3D space.
I think there is a generic case that can be helped:
Instead of using polyhedron() to draw surfaces into 3d space, we can use
hull() to create volumes in 3d space.
An implementation looks like this
module hullhedron( vertice_list, surface_list){
for( a_surface = surface_list) {
hull(){
for( a_coordinate_index = a_surface) {
translate( vertice_list[ a_coordinate_index ]) cube(1);
}
}
}
}
To prove my idea a am trying to post process the 3d scan of a cat. I got a
list of vertices and surfaces extracted from a STL. There are 3 million
vertices and a similar number of surfaces/volumes. I am exceeding OpenSCAD
caches. What do I need to set to fix
WARNING: Normalized tree is growing past 200000 elements. Aborting
normalization.
WARNING: CSG normalization resulted in an empty tree
?
Any other recommendation how to overcome limits for a resource wasteful
prototyp?
OS: Linux
OpenSCAD version: OpenSCAD-2023.07.09.ai15799-x86_64.AppImage, but I may
work with any of the pre compiled binaries
Outlook: If the prototyp works, we can start creating closed volumes from
3d scans by providing a common center per model that each volume needs to
connect to.
Bonus: I promised you a CAT-Scan; Picture is attached :-)
Bonus: hullhedron() example attached
Bonus: If you are interested in processing 60MByte of binary STL yourself,
I will provide raw data.
Cheers,
Marcus
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 7/14/2024 12:28 AM, Marcus Poller via Discuss wrote:
Minor implementation detail: Instead of providing (multi point) polygon surfaces, you may just provide triangles. Polyhedron() implements this as polyhedron(triangles=) and STL implements this as STL-binary-file-format.
The "triangles" parameter is deprecated. The "faces" parameter is more
general, and a direct replacement. "triangles" is treated as an alias
for "faces".
My personal opinion is that people hurt themselfs with polyhedron() and STL. You may create something that appears to be a cube, but has just 5 sides. Its preview will be fine, but it cannot be rendered, cannot be exported and cannot be printed.
It is certainly easy to get bad results with polyhedron(). (A
five-sided cube is pretty obvious in preview, though.) It is even
easier with STLs because you have less control over them.
Instead of using polyhedron() to draw surfaces into 3d space, we can use hull() to create volumes in 3d space.
Yes, though hull() is only useful with convex shapes. Your cat is not a
convex shape. You can decompose your general shape into a number of
convex shapes, but that's hard.
Also, polyhedron is fast. Hulling a thousand tiny cubes takes about 10s
on my system. polyhedron() is nearly instantaneous, once you have the
list of points. (Less than 1s, including generating the list of points.)
One trick is that hull() doesn't care whether its argument is a valid
polyhedron. It works to give it a cloud of points that are arranged
into a single "face". That's a lot faster than hulling cubes. But
again, the result is always convex.
points = [
for(i=[0:999]) rands(0,100,3)
];
faces = [ [ for (i=[0:999]) i ] ];
hull() polyhedron(points=points, faces=faces);
I believe it is significantly faster to give a face list of triangles (and
one quadrilateral or pentagon) in instead of a single face containing all
the points.
I think the solution to problems making polyhedra is to write supporting
code to ensure that they are valid. Due to the convexity requirement hull
is rarely the answer.
On Sun, Jul 14, 2024 at 13:21 Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:
On 7/14/2024 12:28 AM, Marcus Poller via Discuss wrote:
Minor implementation detail: Instead of providing (multi point) polygon surfaces, you may just provide triangles. Polyhedron() implements this as polyhedron(triangles=) and STL implements this as STL-binary-file-format.
The "triangles" parameter is deprecated. The "faces" parameter is more
general, and a direct replacement. "triangles" is treated as an alias for
"faces".
My personal opinion is that people hurt themselfs with polyhedron() and STL. You may create something that appears to be a cube, but has just 5 sides. Its preview will be fine, but it cannot be rendered, cannot be exported and cannot be printed.
It is certainly easy to get bad results with polyhedron(). (A five-sided
cube is pretty obvious in preview, though.) It is even easier with STLs
because you have less control over them.
Instead of using polyhedron() to draw surfaces into 3d space, we can use hull() to create volumes in 3d space.
Yes, though hull() is only useful with convex shapes. Your cat is not a
convex shape. You can decompose your general shape into a number of convex
shapes, but that's hard.
Also, polyhedron is fast. Hulling a thousand tiny cubes takes about 10s
on my system. polyhedron() is nearly instantaneous, once you have the list
of points. (Less than 1s, including generating the list of points.)
One trick is that hull() doesn't care whether its argument is a valid
polyhedron. It works to give it a cloud of points that are arranged into a
single "face". That's a lot faster than hulling cubes. But again, the
result is always convex.
points = [
for(i=[0:999]) rands(0,100,3)
];
faces = [ [ for (i=[0:999]) i ] ];
hull() polyhedron(points=points, faces=faces);
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 7/14/2024 5:43 PM, Adrian Mariano via Discuss wrote:
I believe it is significantly faster to give a face list of triangles
(and one quadrilateral or pentagon) in instead of a single face
containing all the points.
Don't know. But in the question posed, we don't really know all of the
faces... or we could just use them.
I think the solution to problems making polyhedra is to write
supporting code to ensure that they are valid.
Yep.
Due to the convexity requirement hull is rarely the answer.
Yes, agree. The "polyhedron point cloud" scheme is an improvement over
creating numerous cubes and hulling them, but still has big problems.
Not sure if this would be helpful, but in the distant path I used other,
meshing, tools to decimate and/or smooth a polygonal mesh. Maybe you can
use that as an incoming step before feeding it in. But with the 'Edit ->
Preferences -> Advanced -> OpenCSG -> "Turn off rendering at _____
elements"' comment, maybe I misunderstood the comment. Is this an issue of
just rendering to the screen, or is this an issue with the entire pipeline?
On Sun, Jul 14, 2024 at 11:37 PM Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:
On 7/14/2024 5:43 PM, Adrian Mariano via Discuss wrote:
I believe it is significantly faster to give a face list of triangles (and
one quadrilateral or pentagon) in instead of a single face containing all
the points.
Don't know. But in the question posed, we don't really know all of the
faces... or we could just use them.
I think the solution to problems making polyhedra is to write supporting
code to ensure that they are valid.
Yep.
Due to the convexity requirement hull is rarely the answer.
Yes, agree. The "polyhedron point cloud" scheme is an improvement over
creating numerous cubes and hulling them, but still has big problems.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Not sure where this is going now, but it is a problem, with all the
broken stl files 'out there'. If the stl file is in ASCII (well I can
read them, not so much non ASCII)) then the attached stl file shows it
as a simple test. It will f5 but not f6 render with another object,
since the stl has a hole. Now, if all the points are hulled together,
then it becomes a solid, renders just fine, but does not have the
correct shape. However, if each facet of three points are individually
hulled, then the shape is preserved. and may be used to produce a useful
3d print. The the points can be extracted by an external program, and
used with interspersed hull statements to generate a block of scad code.
This may are may not be useful.
/*
cube(50);
translate([-10,20,80])
rotate([45,45,0])
cube(50);
*/
//hull(){
import("P:/Docs/openscad/brokeasctestcubes.stl");
//}
cube(2);
On 15/07/2024 04:37, Jordan Brown via Discuss wrote:
On 7/14/2024 5:43 PM, Adrian Mariano via Discuss wrote:
I believe it is significantly faster to give a face list of triangles
(and one quadrilateral or pentagon) in instead of a single face
containing all the points.
Don't know. But in the question posed, we don't really know all of
the faces... or we could just use them.
I think the solution to problems making polyhedra is to write
supporting code to ensure that they are valid.
Yep.
Due to the convexity requirement hull is rarely the answer.
Yes, agree. The "polyhedron point cloud" scheme is an improvement
over creating numerous cubes and hulling them, but still has big problems.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
This seems brute force, but I wonder if it would actually work. If so,
writing a program to take an ASCII STL and emit the fixer OpenSCAD
program should be pretty simple. Has anyone tried it? I know Carsten
has done a lot of work in the area of repairing files
Jon
On 7/15/2024 8:17 AM, Raymond West via Discuss wrote:
Not sure where this is going now, but it is a problem, with all the
broken stl files 'out there'. If the stl file is in ASCII (well I can
read them, not so much non ASCII)) then the attached stl file shows it
as a simple test. It will f5 but not f6 render with another object,
since the stl has a hole. Now, if all the points are hulled together,
then it becomes a solid, renders just fine, but does not have the
correct shape. However, if each facet of three points are individually
hulled, then the shape is preserved. and may be used to produce a
useful 3d print. The the points can be extracted by an external
program, and used with interspersed hull statements to generate a
block of scad code. This may are may not be useful.
/*
cube(50);
translate([-10,20,80])
rotate([45,45,0])
cube(50);
*/
//hull(){
import("P:/Docs/openscad/brokeasctestcubes.stl");
//}
cube(2);
On 15/07/2024 04:37, Jordan Brown via Discuss wrote:
On 7/14/2024 5:43 PM, Adrian Mariano via Discuss wrote:
I believe it is significantly faster to give a face list of
triangles (and one quadrilateral or pentagon) in instead of a single
face containing all the points.
Don't know. But in the question posed, we don't really know all of
the faces... or we could just use them.
I think the solution to problems making polyhedra is to write
supporting code to ensure that they are valid.
Yep.
Due to the convexity requirement hull is rarely the answer.
Yes, agree. The "polyhedron point cloud" scheme is an improvement
over creating numerous cubes and hulling them, but still has big
problems.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
--
This email has been checked for viruses by AVG antivirus software.
www.avg.com
I've just spent about 15 minutes with ChatGPT and python, and the
concept works OK. Whether it is of practical use, remains to be seen,
but it works. The code needs improving and it will be a lot of text for
a reasonable STL, but maybe it will of use. Perhaps if wanting to model
things like flowers, sailing ships, wherever dealing with none flat
surfaces/lines. I'll try and get it to more succinct code.
A sample of the verbose scad file that it generates and the python
script is attached.
On 15/07/2024 13:33, Jon Bondy wrote:
This seems brute force, but I wonder if it would actually work. If so,
writing a program to take an ASCII STL and emit the fixer OpenSCAD
program should be pretty simple. Has anyone tried it? I know Carsten
has done a lot of work in the area of repairing files
Jon
On 7/15/2024 8:17 AM, Raymond West via Discuss wrote:
Not sure where this is going now, but it is a problem, with all the
broken stl files 'out there'. If the stl file is in ASCII (well I
can read them, not so much non ASCII)) then the attached stl file
shows it as a simple test. It will f5 but not f6 render with another
object, since the stl has a hole. Now, if all the points are hulled
together, then it becomes a solid, renders just fine, but does not
have the correct shape. However, if each facet of three points are
individually hulled, then the shape is preserved. and may be used to
produce a useful 3d print. The the points can be extracted by an
external program, and used with interspersed hull statements to
generate a block of scad code. This may are may not be useful.
/*
cube(50);
translate([-10,20,80])
rotate([45,45,0])
cube(50);
*/
//hull(){
import("P:/Docs/openscad/brokeasctestcubes.stl");
//}
cube(2);
On 15/07/2024 04:37, Jordan Brown via Discuss wrote:
On 7/14/2024 5:43 PM, Adrian Mariano via Discuss wrote:
I believe it is significantly faster to give a face list of
triangles (and one quadrilateral or pentagon) in instead of a
single face containing all the points.
Don't know. But in the question posed, we don't really know all of
the faces... or we could just use them.
I think the solution to problems making polyhedra is to write
supporting code to ensure that they are valid.
Yep.
Due to the convexity requirement hull is rarely the answer.
Yes, agree. The "polyhedron point cloud" scheme is an improvement
over creating numerous cubes and hulling them, but still has big
problems.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OK, a bit less verbose in openscad. python script attached.
On 15/07/2024 16:23, Raymond West via Discuss wrote:
I've just spent about 15 minutes with ChatGPT and python, and the
concept works OK. Whether it is of practical use, remains to be seen,
but it works. The code needs improving and it will be a lot of text
for a reasonable STL, but maybe it will of use. Perhaps if wanting to
model things like flowers, sailing ships, wherever dealing with none
flat surfaces/lines. I'll try and get it to more succinct code.
A sample of the verbose scad file that it generates and the python
script is attached.
On 15/07/2024 13:33, Jon Bondy wrote:
This seems brute force, but I wonder if it would actually work. If
so, writing a program to take an ASCII STL and emit the fixer
OpenSCAD program should be pretty simple. Has anyone tried it? I
know Carsten has done a lot of work in the area of repairing files
Jon
On 7/15/2024 8:17 AM, Raymond West via Discuss wrote:
Not sure where this is going now, but it is a problem, with all the
broken stl files 'out there'. If the stl file is in ASCII (well I
can read them, not so much non ASCII)) then the attached stl file
shows it as a simple test. It will f5 but not f6 render with another
object, since the stl has a hole. Now, if all the points are hulled
together, then it becomes a solid, renders just fine, but does not
have the correct shape. However, if each facet of three points are
individually hulled, then the shape is preserved. and may be used to
produce a useful 3d print. The the points can be extracted by an
external program, and used with interspersed hull statements to
generate a block of scad code. This may are may not be useful.
/*
cube(50);
translate([-10,20,80])
rotate([45,45,0])
cube(50);
*/
//hull(){
import("P:/Docs/openscad/brokeasctestcubes.stl");
//}
cube(2);
On 15/07/2024 04:37, Jordan Brown via Discuss wrote:
On 7/14/2024 5:43 PM, Adrian Mariano via Discuss wrote:
I believe it is significantly faster to give a face list of
triangles (and one quadrilateral or pentagon) in instead of a
single face containing all the points.
Don't know. But in the question posed, we don't really know all of
the faces... or we could just use them.
I think the solution to problems making polyhedra is to write
supporting code to ensure that they are valid.
Yep.
Due to the convexity requirement hull is rarely the answer.
Yes, agree. The "polyhedron point cloud" scheme is an improvement
over creating numerous cubes and hulling them, but still has big
problems.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org