volmdlr_tools.features package#

The features package provides tools for feature recognition and extraction from BRep models.

Subpackages#

Submodules#

volmdlr_tools.features.core module#

Feature recognition module.

class volmdlr_tools.features.core.FeatureProcessor(shape: Shell | Solid, aag: AttributedAdjacencyGraph | None = None, name: str = '')#

Bases: DessiaObject

Processor/orchestrator for feature recognition and manipulation.

Features extracted through this class are managed internally and should not exist outside of this context. All feature access and manipulation happens through methods on this class.

This class acts as the single source of truth for all extracted features and provides a clean API for feature recognition, querying, filtering, and manipulation operations.

property bends: tuple[Bend, ...]#

Get extracted bend features.

Returns:

Tuple of Bend objects (immutable)

property blend_chains: tuple[BlendChain, ...]#

Get extracted blend chains.

Returns:

Tuple of BlendChain objects (immutable)

property blends: tuple[Blend, ...]#

Get extracted blend features.

Returns:

Tuple of Blend objects (immutable)

property cavities: tuple[Cavity, ...]#

Get extracted cavity features.

Returns:

Tuple of Cavity objects (immutable)

clear_all_features() None#

Clear all features from the registry.

clear_features(feature_types: list[type[Feature]] | None = None) None#

Clear extracted features.

Parameters:

feature_types – Optional feature classes to clear (e.g., Bend, Cavity). If None, clears all features.

property corner: tuple[Corner, ...]#

Get extracted corner features.

Returns:

Tuple of Corner objects (immutable)

property corner_reliefs: tuple[CornerRelief, ...]#

Get extracted corner relief features.

Returns:

Tuple of CornerRelief objects (immutable)

property embosses: tuple[Emboss, ...]#

Get extracted emboss features.

Returns:

Tuple of Emboss objects (immutable)

extract_all(blend_max_radius: float = 0.5) None#

Recognize all available features for the shape.

Parameters:

blend_max_radius – Maximum radius for blend recognition

extract_blends(max_radius: float = 0.5) None#

Recognize blend features and store them internally.

Parameters:

max_radius – The maximum radius for blend recognition. Default is 0.5.

extract_cavities() None#

Recognize cavity features and store them internally.

extract_deformations() None#

Recognize emboss features and store them internally.

Raises:

ValueError – If the shape is not a sheet metal.

extract_lances() None#

Recognize lance features and store them internally.

Raises:

ValueError – If the shape is not a sheet metal.

extract_sharp_edges() None#

Recognize sharp edge features and store them internally.

extract_sheet_metal_features() None#

Recognize sheet metal features and store them internally by type.

Raises:

ValueError – If the shape is not a sheet metal.

filter_blend_chains(min_radius: float | None = None, max_radius: float | None = None, min_length: float | None = None, max_length: float | None = None) list[BlendChain]#

Filter blend chains based on criteria.

Parameters:
  • min_radius – Minimum chain radius

  • max_radius – Maximum chain radius

  • min_length – Minimum chain length

  • max_length – Maximum chain length

Returns:

Filtered list of blend chains

filter_blends(min_radius: float | None = None, max_radius: float | None = None, blend_type: str | None = None, confirmed_only: bool = False) list[Blend]#

Filter blends based on criteria.

Parameters:
  • min_radius – Minimum blend radius

  • max_radius – Maximum blend radius

  • blend_type – type of blend to filter (as string name)

  • confirmed_only – If True, only return confirmed blends

Returns:

Filtered list of blends

filter_by_category(category: str, location: str | None = None) list#

Filter features by category and optionally by location.

Parameters:
  • category (str) – Feature category (“cut”, “forming”, “blend”, “cavity”, “unknown”)

  • location (Optional[str]) – Optional location filter (“boundary”, “internal”)

Returns:

List of features matching the criteria

Return type:

list

filter_by_location(location: str) list#

Filter all features by location.

Parameters:

location (str) – Location filter (“boundary” or “internal”)

Returns:

List of features at the specified location

Return type:

list

filter_cavities(min_depth: float | None = None, max_depth: float | None = None) list[Cavity]#

Filter cavities based on depth criteria.

Parameters:
  • min_depth – Minimum cavity depth

  • max_depth – Maximum cavity depth

Returns:

Filtered list of cavities

get_cut_features(location: str | None = None) list#

Get all cut features (slots, notches, corner reliefs, clips).

Parameters:

location (Optional[str]) – Optional location filter (“boundary”, “internal”)

Returns:

List of cut features

Return type:

list

get_feature_count() dict[str, int]#

Get count of all extracted features.

Returns:

Dictionary mapping feature class names to counts

get_forming_features(location: str | None = None) list#

Get all forming features (bends, jogs).

Parameters:

location (Optional[str]) – Optional location filter (“boundary”, “internal”)

Returns:

List of forming features

Return type:

list

has_features(feature_type: type[Feature] | None = None) bool#

Check if any features have been extracted.

Parameters:

feature_type (Optional[type[Feature]]) – Optional feature class to check (e.g., Bend, Jog). If None, checks if any features exist.

Returns:

True if features exist, False otherwise

Return type:

bool

property is_sheet_metal: bool#

Check if the shape is a sheet metal.

Returns:

True if shape is sheet metal, False otherwise

property jogs: tuple[Jog, ...]#

Get extracted jog features.

Returns:

Tuple of Jog objects (immutable)

property lances: tuple[Lance, ...]#

Get extracted lance features.

Returns:

Tuple of Lance objects (immutable)

property louvre: tuple[Louvre, ...]#

Get extracted louvre features.

Returns:

Tuple of Louvre objects (immutable)

property notches: tuple[Notch, ...]#

Get extracted notch features.

Returns:

Tuple of Notch objects (immutable)

post_process_unknown_features(internal_features: list[Feature]) list[Feature]#

Reclassify unknown internal features adjacent to multiple blends as CutoutWithBendInternal.

property sharp_edges: tuple[Edge, ...]#

Get extracted sharp edge features.

Returns:

Tuple of Edge objects (immutable)

show_features#

Implementation of a tag for displays.

property unknown_features: tuple[UnknownFeature, ...]#

Get extracted unknown features.

Returns:

Tuple of UnknownFeature objects (immutable)

class volmdlr_tools.features.core.FeaturesRecognizer(*args, **kwargs)#

Bases: FeatureProcessor

Backward compatibility alias for FeatureProcessor.

. deprecated:: v1.0.0

Use FeatureProcessor instead. This alias will be removed in version 1.0.0.

blends_recognition(max_radius: float)#

Deprecated method for backward compatibility.

. deprecated:: v1.0.0

Use extract_blends() instead.

cavitivies_recognition()#

Deprecated method for backward compatibility.

. deprecated:: v1.0.0

Use extract_cavities() instead.

emboss_recognition()#

Deprecated method for backward compatibility.

. deprecated:: v1.0.0

Use extract_embosses() instead.

sharp_edges_recognition()#

Deprecated method for backward compatibility.

. deprecated:: v1.0.0

Use extract_sharp_edges() instead.

volmdlr_tools.features.constants module#

Constants for feature extraction and processing.

This module defines constants used throughout the feature extraction system. Using Enums instead of plain strings provides: - Type safety and IDE autocompletion - Protection against typos - Clear grouping of related values

class volmdlr_tools.features.constants.FeatureCategory(*values)#

Bases: str, Enum

High-level category of manufacturing features.

Attributes:

CUT: Material removal features (slots, notches, holes). FORMING: Deformation features (bends, jogs). BLEND: Fillet/chamfer features. CAVITY: Pocket/cavity features. UNKNOWN: Unclassified features.

BLEND = 'blend'#
CAVITY = 'cavity'#
CUT = 'cut'#
FORMING = 'forming'#
UNKNOWN = 'unknown'#
class volmdlr_tools.features.constants.FeatureLocation(*values)#

Bases: str, Enum

Location of features on sheet metal parts.

Attributes:

BOUNDARY: Features on the outer boundary of the sheet metal. INTERNAL: Features in the internal area of the sheet metal.

BOUNDARY = 'boundary'#
INTERNAL = 'internal'#

volmdlr_tools.features.pattern_matcher module#

Pattern Matcher Module.

class volmdlr_tools.features.pattern_matcher.GraphMatcher(G1: Graph, G2: Graph, node_match=None, edge_match=None, min_similarity: float = 0.8)#

Bases: GraphMatcher

Override nx GraphMatcher class.

class volmdlr_tools.features.pattern_matcher.Match(faces: list[Face], name: str = '')#

Bases: DessiaObject

A geometric match object that represents a collection of faces with an enclosing bounding box.

The Match class creates a shell from the provided faces and generates an oriented bounding box to enclose the geometry. It provides methods for visualization and geometric operations.

Parameters:
  • (list[shapes.Face]) (faces) – List of Face objects that define the match geometry

  • (shapes.Solid) (enclosing_box) – Oriented bounding box that encloses the match shell

  • (Frame) (frame) – Coordinate frame of the oriented bounding box

  • (shapes.Shell) (match_shell) – Shell created from the input faces

  • color – Color attribute for visualization (can be None)

  • (str) (name) – Name identifier for the match object

volmdlr_primitives() list[Shape]#

Generate visualization primitives for the match object.

Prepares the match shell and enclosing box for visualization by setting their color properties. The enclosing box is made semi-transparent to allow viewing of the internal shell geometry.

Returns:

This method modifies the color and alpha properties of the shell and enclosing box before returning them. The shell is opaque while the enclosing box is semi-transparent.

class volmdlr_tools.features.pattern_matcher.PatternMatcher(graph_assembly: GraphAssembly, angular_tol: float = 1e-06, min_similarity: float = 1.0, min_face_signature_similarity: float = 1.0, name: str = '')#

Bases: DessiaObject

A class for finding geometric patterns within a graph assembly structure.

This class provides functionality to search for specific subgraph patterns within a larger graph assembly, particularly focusing on solid geometries and their face relationships.

Parameters:
  • graph_assembly – The graph assembly structure to search for patterns within.

  • angular_tol – Angular tol parameter in radians.

  • name – A descriptive name for the pattern matcher instance, defaults to ‘’

EXACT_MATCH_SIMILARITY = 1.0#
find_matches_from_multiple_patterns(patterns: list[AttributedAdjacencyGraph]) list[list[int]]#

Find patterns matches within a graph assembly structure for a list of different patterns.

find_pattern_matches(pattern_graph: AttributedAdjacencyGraph) list[Match]#

Find all occurrences of a pattern graph within the assembly’s solid nodes.

This method searches through all solid nodes in the graph assembly, extracts their associated adjacency graphs (AAG), and identifies subgraphs that match the given pattern using isomorphism detection.

Parameters:
  • pattern_graph – The pattern graph to search for.

  • exact – If true, only return subgraphs that match the pattern graph.

If False, approximate solutions may be accepted. :returns: A list of matches, where each match is a list of Face objects

corresponding to the nodes in the pattern.

matrix_similarity_verification(pattern_graph: AttributedAdjacencyGraph, target_graph: AttributedAdjacencyGraph) set#

Verify the similarity between two adjacency matrices.

static row_similarity_scipy(sig1_batch, sig2_batch)#

Use scipy’s optimized distance computation.

volmdlr_tools.features.pattern_matcher.prepare_graph(graph: AttributedAdjacencyGraph, tolerance: float = 1.0, n_bins: int = 150, n_points: int = 10000) None#

Prepare a pattern graph for matching.

It calculates all nodes degree and adds a node attribute with its value.

volmdlr_tools.features.spring_pattern_matcher module#

Spring Pattern Matcher Module.

class volmdlr_tools.features.spring_pattern_matcher.SpringPatternMatcher(graph_assembly: GraphAssembly, angular_tol: float = 1e-06, min_similiraty: float = 1.0, name: str = '')#

Bases: PatternMatcher

A pattern matcher for identifying spring-like geometric patterns in 3D models.

This class extends FacePatternMatcher to specifically identify patterns that resemble specific springs by analyzing face relationships, distances, and plane parallelism.

Parameters:

(list[int]) (NO_VISIT_COUNT_INDEXES) – Indexes that should not be counted during visits (11, 23).

NO_VISIT_COUNT_INDEXES = (0, 1)#
static cluster_points_kmeans(points: ndarray, points_per_group: int = 4) tuple[ndarray, ndarray, list[ndarray]]#

Cluster 3D points into groups of specified sizes using K-means.

Parameters:
  • points – Numpy array of shape (n, 3) containing 3D coordinates.

  • points_per_group – Number of points per cluster (default 4)

Returns:

labels: cluster labels for each point centroids: cluster centers groups: list of point groups

get_springs(pattern_graph: AttributedAdjacencyGraph) list[Compound]#

Extract springs from a pattern graph by identifying patterns, clustering them, and building spring compounds.

Parameters:

pattern_graph – The faces graph containing pattern data from which springs are to be extracted.

Returns:

A list of spring compounds constructed from the patterns in the graph.

volmdlr_tools.features.edge_lines module#

This module provides functionality for finding specific patterns in attributed adjacency graphs.

Particularly useful for analyzing geometric structures with angular relationships between faces.

class volmdlr_tools.features.edge_lines.EdgeLines(aag: AttributedAdjacencyGraph, angle_tolerance: float = 5, name: str = '')#

Bases: SharpEdgeExtractor

Identifies border edges formed by faces meeting at approximately 90 degrees.

This class analyzes angular relationships between adjacent faces in a 3D model to detect sharp, convex edges. Edges are classified as sharp if the angle between the connected faces is close to 90 degrees, within a given tolerance.

perform() None#

Detect and cache sharp convex edges formed at approximately 90 degrees.

Iterates through edges in the model, evaluates the angle between adjacent faces, and marks edges as sharp if the angle is convex and near 90 degrees.

Module contents#

Feature extraction module.

class volmdlr_tools.features.BlendExtractor(aag: AttributedAdjacencyGraph, max_radius: float = 0.5)#

Bases: FeatureExtractor

Extract blend/fillet features from AAG.

A class for recognizing and analyzing blends in a geometric model using an adjacency attribute graph (AAG). Supports recognition of edge-based and vertex-based blends.

calculate_chain_length(feature: list[int]) float#

Compute the total length of a blend chain based on the blend candidate attributes of each face.

The total length is the sum of the lengths of each blend face in the chain, as stored in their blend candidate attributes.

Parameters:

feature – A list of face IDs representing the blend chain.

Returns:

The computed total length of the blend chain.

compute_blend_length(edges_indices: list[int]) float#

Compute the total length of the blend chain.

Parameters:

edges_indices – A list of edges indexes from the belnd chain

Returns:

The sum of the lengths of all edges in edges_indeces list.

display_result#

Implementation of a tag for displays.

dye_blending_faces(color: tuple = (0, 1, 1)) None#

Change the colors of blending faces.

Parameters:

color – Derired color

find_cross_edges(face_id: int, smooth_edges_ids: list[int], spring_edges_ids: list[int], candidate_radius: float) tuple#

Identify and return cross edges on a given face, based on curvature evaluation and a specified candidate radius.

Cross edges are those that satisfy certain curvature conditions compared to the provided radius and are not in the excluded categories (smooth or spring edges).

  • The method evaluates curvature at the midpoint of each remaining edge, which is neither a smooth nor spring edge.

  • The edge is classified as a cross edge if its curvature-derived radius matches the candidate radius within a tolerance threshold.

Parameters:
  • face_id – The index or ID of the face for which to find cross edges.

  • smooth_edges_ids – A list of edge IDs that represent “smooth” edges to be excluded.

  • spring_edges_ids – A list of edge IDs that represent “spring” edges to be excluded.

  • candidate_radius – The target radius value used to compare the curvature of the edges.

Returns:

  • cross_edges: A list of edge objects that qualify as cross edges based on the curvature evaluation.

  • cross_edges_ids: A list of IDs corresponding to the cross edges.

Raises:

Issues a warning if the curvature cannot be evaluated along the edge.

find_smooth_edges() tuple[list[TopoDS_Shape], list[int]]#

Find all smooth edges across all faces in the adjacency attribute graph (AAG).

Returns:

A tuple containing the list of all smooth edges and their corresponding indices.

find_smooth_edges_for_face(face_id: int) tuple[list[TopoDS_Shape], list[int]]#

Find smooth edges for a given face based on adjacent faces in the graph.

Parameters:

face_id – The ID of the face to analyze.

Returns:

A tuple containing the list of smooth edges and their corresponding indices.

find_spring_edges(face_id: int, smooth_edge_ids: TColStd_PackedMapOfInteger) tuple[list[TopoDS_Shape], list[int], bool, float]#

Find the spring edges for a given face, considering the smooth edge indices.

Parameters:
  • face_id – The ID of the face to analyze.

  • smooth_edge_ids – The indices of the smooth edges.

Returns:

A tuple containing the spring edges, their indices, whether it’s a candidate blend, and the candidate radius.

find_terminating_edges(face_id: int, smooth_edges_ids: list[int], spring_edges_ids: list[int], cross_edges_ids: list[int]) tuple#

Identify and return the terminating edges of a given face, excluding edges that belong to specified categories.

A terminating edge is one that does not belong to any of the provided exclusion lists.

Parameters:
  • face_id – The index or ID of the face for which to find terminating edges.

  • smooth_edges_ids – A list of edge IDs that represent “smooth” edges to be excluded.

  • spring_edges_ids – A list of edge IDs that represent “spring” edges to be excluded.

  • cross_edges_ids – A list of edge IDs that represent “cross” edges to be excluded.

Returns:

A list of edge objects that are considered terminating edges. A list of IDs corresponding to the terminating edges.

get_blending_chains_faces() list[list[Face]]#

Return a list containing all identified faces grouped by connectivity and radius.

get_blending_faces() list[Face]#

Return a list containing all identified faces.

get_blends() list[Blend]#

Return a list containing all blends.

get_chains(r_dev_perc: float = 5.0) list[BlendChain]#

Identify and return chains of blend faces.

Chains are grouped by their fillet radii and cross-edge length. The method first extracts connected components from the adjacency graph based on recognized blend candidates. It then distributes faces into groups based on their fillet radii and evaluates connected components within each group. Afterward, it normalizes these chains by removing any dangling vertex blends.

Parameters:

r_dev_perc – The allowed percentage deviation when comparing fillet radii. This value controls the tolerance for how close radii need to be considered part of the same chain. A typical default value is 5.0%.

Returns:

A list of BlendChain objects, each containing faces, properties, and spring edges.

property ids: list[int]#

Return the ids of blend faces.

Returns:

Ids of blend faces.

perform() None#

Execute the blend recognition process over all faces in the adjacency attribute graph (AAG).

property shape: Shape#

Return the shape.

terminating_edges_to_cross_edges() None#

Convert terminating edges to cross edges if the terminating edges connect blend candidate faces.

class volmdlr_tools.features.CavityExtractor(aag: AttributedAdjacencyGraph, name: str = '')#

Bases: InnerFeaturesExtractor

Extract cavity and pocket features from AAG.

A class for recognizing cavities and pockets in a CAD model using an Attributed Adjacency Graph (AAG). The AAG is traversed to find “seed” faces that are part of these features. From the seeds, the algorithm propagates to identify connected faces that share specific geometric characteristics such as convexity of edges and angles.

Parameters:
  • aag (AttributedAdjacencyGraph) – The Attributed Adjacency Graph (AAG) representation of the CAD model

  • max_number_feature_faces (int) – Maximum allowable number of faces in a recognized feature (used to filter overly large features), defaults to 20

display_result#

Implementation of a tag for displays.

find_seeds() list[int]#

Find potential seed faces in the CAD model that can be used to start the feature recognition process.

This method scans the faces in the Attributed Adjacency Graph (AAG) to locate candidate seed faces. For a cavity, a seed face is typically a face with inner wires, where the neighboring faces, adjacent to this seed face through the inner wires, have a convex relationship with respect to the seed face.

Returns:

A list of face indices that are valid seed candidates for further feature recognition.

get_cavities() list[Cavity]#

Return a list containing all identified cavities with their base faces.

property ids_pockets: list[list[int]]#

Return the ids of blend faces.

Returns:

Ids of blend faces.

is_angle_valid(seed_id: int, neighbor_id: int) bool#

Check if the angle is valid.

is_feature_valid(new_feature_faces: list[TopoDS_Shape], new_feature_indices: list[int], seed_face_neighbors: list[int]) bool#

Check if the feature is valid.

is_invalid_base_neighbor(start_id: int, neighbor_id: int) bool#

Check if the base neighbor is invalid.

is_seed_valid(face_index: int, wire: TopoDS_Shape) bool#

Check if the seed node is valid.

perform() bool#

Perform the cavity feature extraction.

recognize_cavities() None#

Recognize cavity features in the CAD model by analyzing the Attributed Adjacency Graph (AAG).

(Under construction)

property shape: Shape#

Return the shape.

class volmdlr_tools.features.FeatureProcessor(shape: Shell | Solid, aag: AttributedAdjacencyGraph | None = None, name: str = '')#

Bases: DessiaObject

Processor/orchestrator for feature recognition and manipulation.

Features extracted through this class are managed internally and should not exist outside of this context. All feature access and manipulation happens through methods on this class.

This class acts as the single source of truth for all extracted features and provides a clean API for feature recognition, querying, filtering, and manipulation operations.

property bends: tuple[Bend, ...]#

Get extracted bend features.

Returns:

Tuple of Bend objects (immutable)

property blend_chains: tuple[BlendChain, ...]#

Get extracted blend chains.

Returns:

Tuple of BlendChain objects (immutable)

property blends: tuple[Blend, ...]#

Get extracted blend features.

Returns:

Tuple of Blend objects (immutable)

property cavities: tuple[Cavity, ...]#

Get extracted cavity features.

Returns:

Tuple of Cavity objects (immutable)

clear_all_features() None#

Clear all features from the registry.

clear_features(feature_types: list[type[Feature]] | None = None) None#

Clear extracted features.

Parameters:

feature_types – Optional feature classes to clear (e.g., Bend, Cavity). If None, clears all features.

property corner: tuple[Corner, ...]#

Get extracted corner features.

Returns:

Tuple of Corner objects (immutable)

property corner_reliefs: tuple[CornerRelief, ...]#

Get extracted corner relief features.

Returns:

Tuple of CornerRelief objects (immutable)

property embosses: tuple[Emboss, ...]#

Get extracted emboss features.

Returns:

Tuple of Emboss objects (immutable)

extract_all(blend_max_radius: float = 0.5) None#

Recognize all available features for the shape.

Parameters:

blend_max_radius – Maximum radius for blend recognition

extract_blends(max_radius: float = 0.5) None#

Recognize blend features and store them internally.

Parameters:

max_radius – The maximum radius for blend recognition. Default is 0.5.

extract_cavities() None#

Recognize cavity features and store them internally.

extract_deformations() None#

Recognize emboss features and store them internally.

Raises:

ValueError – If the shape is not a sheet metal.

extract_lances() None#

Recognize lance features and store them internally.

Raises:

ValueError – If the shape is not a sheet metal.

extract_sharp_edges() None#

Recognize sharp edge features and store them internally.

extract_sheet_metal_features() None#

Recognize sheet metal features and store them internally by type.

Raises:

ValueError – If the shape is not a sheet metal.

filter_blend_chains(min_radius: float | None = None, max_radius: float | None = None, min_length: float | None = None, max_length: float | None = None) list[BlendChain]#

Filter blend chains based on criteria.

Parameters:
  • min_radius – Minimum chain radius

  • max_radius – Maximum chain radius

  • min_length – Minimum chain length

  • max_length – Maximum chain length

Returns:

Filtered list of blend chains

filter_blends(min_radius: float | None = None, max_radius: float | None = None, blend_type: str | None = None, confirmed_only: bool = False) list[Blend]#

Filter blends based on criteria.

Parameters:
  • min_radius – Minimum blend radius

  • max_radius – Maximum blend radius

  • blend_type – type of blend to filter (as string name)

  • confirmed_only – If True, only return confirmed blends

Returns:

Filtered list of blends

filter_by_category(category: str, location: str | None = None) list#

Filter features by category and optionally by location.

Parameters:
  • category (str) – Feature category (“cut”, “forming”, “blend”, “cavity”, “unknown”)

  • location (Optional[str]) – Optional location filter (“boundary”, “internal”)

Returns:

List of features matching the criteria

Return type:

list

filter_by_location(location: str) list#

Filter all features by location.

Parameters:

location (str) – Location filter (“boundary” or “internal”)

Returns:

List of features at the specified location

Return type:

list

filter_cavities(min_depth: float | None = None, max_depth: float | None = None) list[Cavity]#

Filter cavities based on depth criteria.

Parameters:
  • min_depth – Minimum cavity depth

  • max_depth – Maximum cavity depth

Returns:

Filtered list of cavities

get_cut_features(location: str | None = None) list#

Get all cut features (slots, notches, corner reliefs, clips).

Parameters:

location (Optional[str]) – Optional location filter (“boundary”, “internal”)

Returns:

List of cut features

Return type:

list

get_feature_count() dict[str, int]#

Get count of all extracted features.

Returns:

Dictionary mapping feature class names to counts

get_forming_features(location: str | None = None) list#

Get all forming features (bends, jogs).

Parameters:

location (Optional[str]) – Optional location filter (“boundary”, “internal”)

Returns:

List of forming features

Return type:

list

has_features(feature_type: type[Feature] | None = None) bool#

Check if any features have been extracted.

Parameters:

feature_type (Optional[type[Feature]]) – Optional feature class to check (e.g., Bend, Jog). If None, checks if any features exist.

Returns:

True if features exist, False otherwise

Return type:

bool

property is_sheet_metal: bool#

Check if the shape is a sheet metal.

Returns:

True if shape is sheet metal, False otherwise

property jogs: tuple[Jog, ...]#

Get extracted jog features.

Returns:

Tuple of Jog objects (immutable)

property lances: tuple[Lance, ...]#

Get extracted lance features.

Returns:

Tuple of Lance objects (immutable)

property louvre: tuple[Louvre, ...]#

Get extracted louvre features.

Returns:

Tuple of Louvre objects (immutable)

property notches: tuple[Notch, ...]#

Get extracted notch features.

Returns:

Tuple of Notch objects (immutable)

post_process_unknown_features(internal_features: list[Feature]) list[Feature]#

Reclassify unknown internal features adjacent to multiple blends as CutoutWithBendInternal.

property sharp_edges: tuple[Edge, ...]#

Get extracted sharp edge features.

Returns:

Tuple of Edge objects (immutable)

show_features#

Implementation of a tag for displays.

property unknown_features: tuple[UnknownFeature, ...]#

Get extracted unknown features.

Returns:

Tuple of UnknownFeature objects (immutable)

class volmdlr_tools.features.FeaturesRecognizer(*args, **kwargs)#

Bases: FeatureProcessor

Backward compatibility alias for FeatureProcessor.

. deprecated:: v1.0.0

Use FeatureProcessor instead. This alias will be removed in version 1.0.0.

blends_recognition(max_radius: float)#

Deprecated method for backward compatibility.

. deprecated:: v1.0.0

Use extract_blends() instead.

cavitivies_recognition()#

Deprecated method for backward compatibility.

. deprecated:: v1.0.0

Use extract_cavities() instead.

emboss_recognition()#

Deprecated method for backward compatibility.

. deprecated:: v1.0.0

Use extract_embosses() instead.

sharp_edges_recognition()#

Deprecated method for backward compatibility.

. deprecated:: v1.0.0

Use extract_sharp_edges() instead.

class volmdlr_tools.features.HoleExtractor(aag: AttributedAdjacencyGraph, max_radius: float = inf, linear_tolerance: float = 0.0001, angular_tolerance: float = 0.0175, name: str = '')#

Bases: FeatureExtractor

Extract hole features from an Attributed Adjacency Graph (AAG).

This class recognizes holes by identifying cylindrical bore faces (internal cylindrical surfaces) and propagating to collect all coaxial cylindrical neighbors. The algorithm validates that the collected faces form a complete hole (360 degree angular coverage) and includes ending faces (bottoms).

Key differences from CavityExtractor: - Seed type: Cylindrical bore faces (vs. faces with inner wires) - Angle validation: Concave edges (vs. convex) - Propagation: Through coaxial cylinders (vs. outer wire neighbors) - Validation: Angular coverage (vs. connected components)

Parameters:
  • aag – The Attributed Adjacency Graph (AAG) representation of the CAD model.

  • max_radius – Maximum radius for hole recognition (filters large cylinders).

  • linear_tolerance – Tolerance for radius and position comparisons.

  • angular_tolerance – Tolerance for axis direction comparisons (radians).

  • name (str) – Name for the extractor instance.

get_holes() list[Hole]#

Create Hole objects from extracted face groups.

Returns:

List of Hole feature objects.

property ids_holes: list[list[int]]#

Return the face IDs of identified holes.

Returns:

List of face ID lists, one per hole.

perform() bool#

Perform the hole feature extraction.

Main entry point for hole recognition. Iterates through faces, identifies cylindrical bore faces, propagates to collect coaxial neighbors, validates angular coverage, and processes floating isolations.

Returns:

True if extraction completed successfully.

class volmdlr_tools.features.RecognizeBlends(aag: AttributedAdjacencyGraph, max_radius: float = 0.5)#

Bases: BlendExtractor

Deprecated: Use BlendExtractor instead.

This class is maintained for backward compatibility and will be removed in version 1.0.0. Please update your code to use BlendExtractor.

class volmdlr_tools.features.RecognizeCavities(aag: AttributedAdjacencyGraph)#

Bases: CavityExtractor

Deprecated: Use CavityExtractor instead.

This class is maintained for backward compatibility and will be removed in version 1.0.0. Please update your code to use CavityExtractor.

class volmdlr_tools.features.SharpEdgeExtractor(aag: AttributedAdjacencyGraph, name: str = '')#

Bases: FeatureExtractor

Extract sharp edge features from AAG.

A class for recognizing and analyzing sharp edges in a geometric model using an adjacency attribute graph. Sharp edges are identified by analyzing convex angles between adjacent faces along linear edges.

display_result#

Implementation of a tag for displays.

get_edges() list[SharpEdge]#

Return a list containing all identified edges.

get_edges_shapes() list[Edge]#

Return a list containing all identified edges shapes.

property ids: list[int]#

Return the ids of sharp edges.

Returns:

Ids of sharp edges.

perform() None#

Perform sharp edge identification and cache the result.

property shape: Shape#

Return the shape.

class volmdlr_tools.features.SharpEdgeRecognizer(aag: AttributedAdjacencyGraph, name: str = '')#

Bases: SharpEdgeExtractor

Deprecated: Use SharpEdgeExtractor instead.

This class is maintained for backward compatibility and will be removed in version 1.0.0. Please update your code to use SharpEdgeExtractor.