yapcad.boolean package

Submodules

yapcad.boolean.native module

Native boolean engine extracted from yapcad.geom3d.

yapcad.boolean.native.invalidate_surface_octree(s)[source]
yapcad.boolean.native.solid_boolean(a, b, operation, tol=1e-07, *, stitch=False)[source]
yapcad.boolean.native.solid_contains_point(sld, p, tol=1e-07)[source]
yapcad.boolean.native.solids_intersect(a, b, tol=1e-07)[source]
yapcad.boolean.native.stitch_open_edges(triangles, tol)[source]

Experimental: attempt to close open edge loops by triangulating them.

Parameters:
  • triangles (Iterable) – A sequence of triangle coordinate lists [[x, y, z, w], ...] describing a mesh with potential boundary edges.

  • tol (float) – Tolerance used when deduplicating vertices and detecting shared edges. Typically reuse _DEFAULT_RAY_TOL.

Returns:

A new list of triangles with any stitched faces appended.

Return type:

list

yapcad.boolean.native.stitch_solid(sld, tol=1e-07)[source]

Experimental helper that runs stitch_open_edges() on a solid.

yapcad.boolean.native.surface_octree(s, rebuild=False)[source]

yapcad.boolean.occ_engine module

OCC-backed boolean engine operating on BrepSolid metadata.

yapcad.boolean.occ_engine.is_available() bool[source]
yapcad.boolean.occ_engine.solid_boolean(a, b, operation: str)[source]

Perform an OCC boolean; requires both solids to carry BREP metadata.

Handles both single-solid results and compound results (e.g., union of disconnected solids produces a compound containing multiple solids).

yapcad.boolean.trimesh_engine module

Trimesh-backed boolean engine for yapCAD solids.

This engine is optional. It converts yapCAD solids to trimesh.Trimesh instances, dispatches boolean operations via trimesh.boolean, and converts the resulting mesh back into a yapCAD solid.

Availability depends on both the trimesh package and at least one boolean backend supported by trimesh (e.g. Blender, OpenSCAD, Cork).

yapcad.boolean.trimesh_engine.engines_available() set[str][source]

Return the set of trimesh boolean backends that are operational.

yapcad.boolean.trimesh_engine.is_available(backend: str | None = None) bool[source]

Check whether the engine can run (trimesh + backend present).

yapcad.boolean.trimesh_engine.solid_boolean(a, b, operation: str, tol=1e-07, *, stitch: bool = False, backend: str | None = None)[source]

Perform a boolean between a and b using trimesh.

Module contents

yapcad.boolean.get_engine(name: str)[source]