ricosjp / truck

Truck is a Rust CAD Kernel.
Apache License 2.0
952 stars 49 forks source link

How to solve NotSimpleWire? #74

Open vltown opened 1 month ago

vltown commented 1 month ago
let shells: Vec<truck_topology::Shell<Point3, Curve3D, Surface>> = table.shell.values().cloned().filter_map(|step_shell| {
        let mut cshell = match table.to_compressed_shell(&step_shell) {
            Ok(shell) => shell,
            Err(e) => {
                println!("Error during compression: {:?}", e);
                return None;
            }
        };
        cshell.robust_split_closed_edges_and_faces(0.1);
        match truck_topology::Shell::extract(cshell) {
            Ok(shell) => Some(shell),
            Err(e) => {
                println!("Failed to extract shell: {:?}", e);
                None 
            }
        }
    }).collect();

Failed to extract shell: NotSimpleWire This code will cause this error, causing my model to render incompletely. Is there any way to solve this problem?

ytanimura commented 1 month ago

Perhaps your STEP data does not meet the requirements. Boundary representation in truck does not accept boundary wires with self-intersections. This is a problem when editing the shape, and if you just want to display it, just leave the meshing as CompressedShell. If you want to edit the shape, try this method.

https://gitlab.ritc.jp/ricos/truck/truck/-/blob/master/truck-shapeops/src/healing/mod.rs?ref_type=heads#L80