volmdlr_tools.shapes.recognizers package#
Shape recognizers for identifying and abstracting specific shape types.
Submodules#
volmdlr_tools.shapes.recognizers.sheet_metal module#
Module for recognizing sheet metal shapes in a B-Rep CAD model.
This module implements a SheetMetalRecognizer that uses the Attributed Adjacency Graph (AAG) to identify main faces and thickness faces in sheet metal parts. The main strategy is to: 1. Find the face with the greatest area as a seed face 2. Propagate through neighbors with smooth angles to identify the first main face group 3. Find the largest remaining face as the opposite face from the remaining faces 4. Propagate from the opposite face to identify the second main face group 5. Identify remaining faces as thickness faces 6. Validate that removing thickness faces creates two connected components
- class volmdlr_tools.shapes.recognizers.sheet_metal.SheetMetalRecognizer(shape: Shell | Solid, aag: AttributedAdjacencyGraph | None = None, name: str = '')#
Bases:
DessiaObjectRecognize sheet metal shapes.
This recognizer uses the Attributed Adjacency Graph (AAG) to separate main faces from thickness faces in sheet metal parts. The algorithm works by: 1. Finding the face with the greatest area as a seed face 2. Propagating through neighbors with smooth angles to identify the first main face group 3. Finding the largest remaining face as the opposite face from the remaining faces 4. Propagating from the opposite face to identify the second main face group 5. Identifying remaining faces as thickness faces 6. Validating that removing thickness faces creates two connected components
Responsibility: ONLY classification. All feature extraction is handled by SheetMetalShape.
- property main_face_group_1: list[int]#
Get the first main face group (first side of sheet metal).
- property main_face_group_2: list[int]#
Get the second main face group (second side of sheet metal).
- property main_faces: list[int]#
Get the main faces identified by the recognizer.
- property opposite_face_id: int#
Get the opposite face ID found during recognition.
- perform() bool#
Perform the sheet metal recognition.
- Returns:
True if the shape can be considered as a sheet metal part, False otherwise.
- property result: SheetMetalShape | None#
Get the recognition result as SheetMetalShape.
This property provides access to the shape abstraction after recognition. Automatically calls perform() if not yet executed.
- Returns:
SheetMetalShape if recognized, None otherwise
- property seed_face_id: int#
Get the seed face ID used for recognition.
- property sheet_metal: SheetMetalShape | None#
Get the sheet metal shape (type-specific alias for result).
Provides better typing and IDE support compared to generic ‘result’ property.
- Returns:
SheetMetalShape if recognized, None otherwise
- property thickness_faces: list[int]#
Get the thickness faces identified by the recognizer.
volmdlr_tools.shapes.recognizers.swept_shape module#
A dedicated module for pipe recognition from a BRep model.
- class volmdlr_tools.shapes.recognizers.swept_shape.SweptShapeRecognizer(shape: Shell | Solid, aag: AttributedAdjacencyGraph | None = None, name: str = '')#
Bases:
DessiaObjectA class to identify if a BRep model is a Swept face.
A Swept shape has a face that defines it start and end. A Swept shape should be smooth (The neutral fiber has C1 continuity).
- get_radius() dict#
Calculate the radius of the swept shape based on its contours.
This method returns the radius of the outer and inner contours of the section If the contour contains an Arc2D or FullArc2D primitive, return its radius directly.
- Returns:
A dictionary with two keys: - “outer_contour”: The radius of the outer contour if it is round, or None if not applicable. - “inner_contours”: A list containing the radii of the inner contours, where each radius is
either a float (if the contour is round) or None (if the contour is not round or could not be fit).
- property neutral_fiber: Wire3D#
Get the neutral fiber of the sweep.
- perform() bool#
Perform the recognition.
- Returns:
Return True if the shape can be considered as a swept shape and False otherwise.
- property section: Face3D#
Get the transversal section of the sweep.
Module contents#
Shape recognizers.
- class volmdlr_tools.shapes.recognizers.SheetMetalRecognizer(shape: Shell | Solid, aag: AttributedAdjacencyGraph | None = None, name: str = '')#
Bases:
DessiaObjectRecognize sheet metal shapes.
This recognizer uses the Attributed Adjacency Graph (AAG) to separate main faces from thickness faces in sheet metal parts. The algorithm works by: 1. Finding the face with the greatest area as a seed face 2. Propagating through neighbors with smooth angles to identify the first main face group 3. Finding the largest remaining face as the opposite face from the remaining faces 4. Propagating from the opposite face to identify the second main face group 5. Identifying remaining faces as thickness faces 6. Validating that removing thickness faces creates two connected components
Responsibility: ONLY classification. All feature extraction is handled by SheetMetalShape.
- property main_face_group_1: list[int]#
Get the first main face group (first side of sheet metal).
- property main_face_group_2: list[int]#
Get the second main face group (second side of sheet metal).
- property main_faces: list[int]#
Get the main faces identified by the recognizer.
- property opposite_face_id: int#
Get the opposite face ID found during recognition.
- perform() bool#
Perform the sheet metal recognition.
- Returns:
True if the shape can be considered as a sheet metal part, False otherwise.
- property result: SheetMetalShape | None#
Get the recognition result as SheetMetalShape.
This property provides access to the shape abstraction after recognition. Automatically calls perform() if not yet executed.
- Returns:
SheetMetalShape if recognized, None otherwise
- property seed_face_id: int#
Get the seed face ID used for recognition.
- property sheet_metal: SheetMetalShape | None#
Get the sheet metal shape (type-specific alias for result).
Provides better typing and IDE support compared to generic ‘result’ property.
- Returns:
SheetMetalShape if recognized, None otherwise
- property thickness_faces: list[int]#
Get the thickness faces identified by the recognizer.
- class volmdlr_tools.shapes.recognizers.SweptShapeRecognizer(shape: Shell | Solid, aag: AttributedAdjacencyGraph | None = None, name: str = '')#
Bases:
DessiaObjectA class to identify if a BRep model is a Swept face.
A Swept shape has a face that defines it start and end. A Swept shape should be smooth (The neutral fiber has C1 continuity).
- get_radius() dict#
Calculate the radius of the swept shape based on its contours.
This method returns the radius of the outer and inner contours of the section If the contour contains an Arc2D or FullArc2D primitive, return its radius directly.
- Returns:
A dictionary with two keys: - “outer_contour”: The radius of the outer contour if it is round, or None if not applicable. - “inner_contours”: A list containing the radii of the inner contours, where each radius is
either a float (if the contour is round) or None (if the contour is not round or could not be fit).
- property neutral_fiber: Wire3D#
Get the neutral fiber of the sweep.
- perform() bool#
Perform the recognition.
- Returns:
Return True if the shape can be considered as a swept shape and False otherwise.
- property section: Face3D#
Get the transversal section of the sweep.