pyvista_cad.topods_to_edges#
- topods_to_edges(shape, *, linear_deflection=0.1, angular_deflection=0.5, tangent_tol_deg=8.0)[source]#
Extract topological edges of
shapeas a polyline mesh.Edges are recovered from the existing face triangulation via OCCT’s
PolygonOnTriangulation— no extra meshing pass — so the polylines lie exactly on the tessellated facets. Each topological edge becomes a single polyline cell, deduplicated across the faces that share it. Face-less edges (wireframe geometry) fall back to direct 3D curve sampling.Edges shared by two faces whose surface normals agree to within
tangent_tol_degare dropped: these are smooth/tangent transitions (hidden by convention in CAD viewers) or, for a faceted solid where every triangle is its own planar face, pure tessellation noise. Real sharp edges and open boundaries are kept.- Parameters:
- shapeOCP.TopoDS.TopoDS_Shape
Shape to extract edges from.
build123d/cadquerywrappers are unwrapped automatically.- linear_deflectionfloat, default: 0.1
Chordal deviation used if
shapeis not already meshed.- angular_deflectionfloat, default: 0.5
Angular deviation (radians) used if not already meshed.
- tangent_tol_degfloat, default: 8.0
Adjacent-face angle below which a shared edge is treated as a tangent/coplanar internal edge and suppressed. Set to
0to keep every topological edge.
- Returns:
- pyvista.PolyData
Line-cell mesh. Cell arrays:
cad.edge_id(int, per edge) andcad.edge_kind(int code; seefield_data ['cad.edge_kind_legend']).
- Raises:
- pyvista_cad.TessellationError
If OCCT meshing fails.
- Parameters:
- Return type:
Examples
Extract feature edges from a build123d box (requires the
[step]extra):>>> import build123d as b3d >>> from pyvista_cad import topods_to_edges >>> edges = topods_to_edges(b3d.Box(10, 10, 10).wrapped) >>> type(edges).__name__ 'PolyData' >>> edges.n_cells 12