Open Markk116 opened 2 days ago
Thank you for your issue.
Solid::try_new Returns NotClosedShell Error on Valid Manifold Shells
The reason why the solid is not created is because the shell is not oriented. In the truck, the term “closed shell” is used to impose "closed and oriented". By the following code, the shell was meshed and the mesh was output. It was found that the mesh on the bottom surface was facing inward.
fn output_mesh(&shell) {
use truck_meshalgo::prelude::*;
// meshing the shell
let mesh = shell.triangulation(0.001).to_polygon();
// create output obj file
let mut shell_obj = std::fs::File::create("solid_meshed.obj").unwrap();
// wirte the mesh to obj
obj::write(&mesh, &mut shell_obj).unwrap();
}
This can be handled by inverting the faces when pushing them.
let mut faces = vec![face.inverse()];
I cannot find a method to tell me the normal vector of a face to check its orientation properly
As for the normal of the surface, once one has obtained the surface from the face, one can obtains the normal from the surface.
// get surface compatible with the face orientation
let surface = face.oriented_surface();
// get normal with parameter (0.5, 0.5)
let normal = surface.normal(0.5, 0.5);
if there are plans to add more sweep operations to the builder module, I would be down to help! I have done some background math for sweeping along arbitrary bezier curves already.
Thank you for your kind words. There are no immediate plans, but we may contact you if necessary.
I think there might be an issue with the detection of closed manifolds. I'm working on implementing a function that sweeps an arbitrary profile along a linear spline, mitring the corners. However, I have been having issues with closing the shell.
I must also admit, I have been having real trouble with debugging using this crate. Maybe it is there and I have just missed it, but I cannot find a method to tell me the normal vector of a face to check its orientation properly. As a stopgap I have tried inverting the tube and the faces in all possible combinatorial options, but to no avail.
So after a while, I decided to try Solid::new_uncheckecked and that works. Now when I open the resulting step file in Prusaslicer it seems like there are actually no errors in the BREP. So that is why I think there is an issue with the Solid::new method.
I have attached a minimal code example, which is a slimmed-down version of my project code:
I hope that this can help improve the crate because in general, I am very grateful for its existence, and all the hard work of the maintainers.
Thanks, Mark
p.s. if there are plans to add more sweep operations to the builder module, I would be down to help! I have done some background math for sweeping along arbitrary bezier curves already.