Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review validity of vnf_validate() error conditions #1563

Open
amatulic opened this issue Feb 13, 2025 · 8 comments
Open

Review validity of vnf_validate() error conditions #1563

amatulic opened this issue Feb 13, 2025 · 8 comments

Comments

@amatulic
Copy link
Contributor

Regarding https://github.com/BelfrySCAD/BOSL2/wiki/vnf.scad#module-vnf_validate

Two conditions should be reviewed, and removed if not applicable:

  • BIG_FACE warning: This has never been an issue in the years I've been using OpenSCAD, starting with the 2015 version. Before I came across BOSL2, I released several polyhedron-based designs made completely from nonplanar quads (example, example). Not once have I ever encountered a rendering error or CGAL complaint due to a nonplanar face. If it's nonplanar, it gets triangulated for you.
  • MULTCONN error: For the example given, with an edge sharing four faces, neither CGAL nor Manifold complains, both render the object.
    • The STL file output simply has 24 triangle faces in it, that's all. When previewing in 3D Builder, it's a valid STL, regardless of whether it was generated by Manifold or CGAL.
    • In both cases, the 3MF file output does cause 3D builder to complain and offer to repair it.

Perhaps that difference between STL and 3MF should be reported to the OpenSCAD repo. I thought 3MF was essentially an extension of STL.

@adrianVmariano
Copy link
Collaborator

I don't think you can make a valid object with CGAL that has an edge sharing four faces. Maybe it's possible with manifold?

The big face thing is somewhat confusing. I questioned that, but I think we did have a bug recently where we had to run vnf_triangulate because a large face resulted in a rendering error.

@amatulic
Copy link
Contributor Author

amatulic commented Feb 13, 2025

I tried it with both CGAL and Manifold. It worked in both cases, both exported a valid STL, but neither exported a valid 3MF.

Maybe the big face thing is for non-convex faces? It's never ever been a problem with convex faces.

@adrianVmariano
Copy link
Collaborator

Did you have a second shape in your model?

@adrianVmariano
Copy link
Collaborator

Unfortunately, I don't remember what the situation was with the big face.

@adrianVmariano
Copy link
Collaborator

Rendering Polygon Mesh using CGAL...
ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron. 
Rendering cancelled.
Geometries in cache: 4
Geometry cache size in bytes: 111348704
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0
Total rendering time: 0:02:06.971
WARNING: No top level geometry to render 

@adrianVmariano
Copy link
Collaborator

v=vnf_join([
           cube(10),
           move([10,10], cube(10))]);

vnf_polyhedron(v);
sphere(4);

@amatulic
Copy link
Contributor Author

amatulic commented Feb 13, 2025

This has no problem with CGAL or Manifold:

include <BOSL2/std.scad>
vnf = linear_sweep(
    union(square(50), square(50,anchor=BACK+RIGHT)), height=50
);
vnf_polyhedron(vnf);

...and exporting the STL gives me the correct shape.

However, for this:

include<BOSL2/std.scad>
v=vnf_join([
    cube(10),
    move([10,10], cube(10))
]);
vnf_polyhedron(v);
sphere(4);

I get an error with CGAL, but Manifold renders it, and creates an STL file that has no errors. It doesn't create an error-free 3MF.

@adrianVmariano
Copy link
Collaborator

You never get an error from render when there is only one object because the rendering engine doesn't run. To tell if an object is invalid you always have to have a second object. I think I did see that manifold can handle objects that touch on edges, so that would explain why manifold works, though if the saved output may have errors that's not exactly a success story.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants