volmdlr_tools.graph.utils package#
Submodules#
volmdlr_tools.graph.utils.angle_types module#
Define angles types between faces.
- class volmdlr_tools.graph.utils.angle_types.FeatureAngle#
Bases:
objectA class providing methods to analyze and classify feature angles in geometry based on their type.
- static from_string(angle_type: str)#
Convert a string representation of an angle type into a corresponding enumeration value of FeatureAngleType.
This method provides a mapping from specific string descriptions of angle types to their corresponding FeatureAngleType enumeration members.
- Parameters:
angle_type – A string representing the type of angle. Supported values include: - “concave”: Represents a concave angle. - “convex”: Represents a convex angle. - “smooth”: Represents a smooth angle. - “smooth concave”: Represents a smooth and concave angle. - “smooth convex”: Represents a smooth and convex angle.
- Returns:
FeatureAngleType - The enumeration value that corresponds to the provided string. If the string does not match any known type, it returns FeatureAngleType.UNDEFINED.
- static is_concave(angle_type: FeatureAngleType) bool#
Determine if the given angle type is concave.
- Parameters:
angle_type – The angle type to check.
- Returns:
True if the angle type is concave, False otherwise.
- static is_convex(angle_type: FeatureAngleType) bool#
Determine if the given angle type is convex.
- Parameters:
angle_type – The angle type to check.
- Returns:
True if the angle type is convex, False otherwise.
- static is_definite(angle_type: FeatureAngleType) bool#
Check if the given angle type is definite (neither undefined nor non-manifold).
- Parameters:
angle_type – The angle type to check.
- Returns:
True if the angle type is definite, False otherwise.
- static is_smooth(angle_type: FeatureAngleType) bool#
Determine if the given angle type is a smooth transition.
- Parameters:
angle_type – The angle type to check.
- Returns:
True if the angle type is smooth, False otherwise.
- static to_string(angle_type: FeatureAngleType) str#
Convert the given feature angle type to a string representation.
- Parameters:
angle_type – The angle type to convert.
- Returns:
String representation of the angle type.
volmdlr_tools.graph.utils.core module#
Helper functions to build AAG.
- volmdlr_tools.graph.utils.core.angle_between_faces(face1: TopoDS_Face, face2: TopoDS_Face, bbox_face2: BoundingBox, allow_smooth: bool, smooth_angular_tol: float) tuple[FeatureAngleType, list[TopoDS_Edge], float]#
Compute the angle between two faces, taking into account the transition type.
This function identifies the common edge between the two faces, calculates the angle formed by their surface normals, and determines if the transition is smooth or concave/convex based on the angle and tolerances. It also handles the special case where the two faces are the same, but have a seam (self-edge).
- Parameters:
face1 – The first face to compare (TopoDS_Shape).
face2 – The second face to compare (TopoDS_Shape).
allow_smooth – Boolean flag indicating if smooth transitions should be accepted.
smooth_angular_tol – Tolerance (in radians) to consider a transition as smooth.
- Returns:
A tuple containing: - The type of angle (smooth, concave, convex, or undefined). - The common edges shared by the faces (if any). - The calculated angle in radians (if applicable).
- volmdlr_tools.graph.utils.core.check_seam_vexity(point: gp_Pnt, norm: float, surface: Geom_Surface) tuple[bool, bool]#
Check the seam vexity (whether concave or convex) of a given surface face.
This function analyzes the given face, determines its surface type (cylindrical, conical, toroidal, surface of revolution, or spherical), and computes the seam vexity based on the distance between the probe point and the axis of the surface.
A probe point is generated along the normal vector at the input point, and the function determines whether the surface is concave based on the distance between the axis and both the original point and the probe point.
- Parameters:
point – A gp_Pnt representing a point on the face.
norm – The normal vector length to project from the point.
surface – A Geom_Surface representing the face of the shape to analyze.
- Returns:
A tuple (bool, bool) where: - The first value is True if the surface is labeled (recognized as a known surface type),
otherwise False.
The second value is True if the seam is concave, False if convex. This value is only meaningful if the first value is True.
- volmdlr_tools.graph.utils.core.derivative(edge: TopoDS_Edge, u: float, order: int) Vector3D#
Return the derivative of specified order of the curve at u.
- volmdlr_tools.graph.utils.core.get_color_based_on_angle_type(angle: FeatureAngleType) tuple[int, int, int]#
Return a color based on the angle type.
- Parameters:
angle – The angle type.
- Returns:
A tuple representing the RGB color.
- volmdlr_tools.graph.utils.core.get_common_edge_between_faces(face1: TopoDS_Face, face2: TopoDS_Face, face2_bbox: BoundingBox, common_edges: TopTools_IndexedMapOfShape) tuple[TopoDS_Edge, bool]#
Identify the common edge between two adjacent faces and checks if it’s a seam edge.
If the two faces are the same, it searches for a seam edge on the face. If the faces are different, it finds the common edge between them by comparing their edges. The common edge, if found, is added to the common_edges collection. The method returns the first common edge found and whether it is a seam edge.
- Parameters:
face1 – The first face (TopoDS_Shape) to check for common edges.
face2 – The second face (TopoDS_Shape) to check for common edges.
face2_bbox – Bounding box of the second face (BoundingBox) to check for common edges.
common_edges – A collection (TopTools_IndexedMapOfShape) where the found common edges will be stored.
- Returns:
A tuple containing: - The first common edge (TopoDS_Edge) between the two faces, or None if no common edge is found. - A boolean indicating whether the common edge is a seam edge (True if it is, False otherwise).
- volmdlr_tools.graph.utils.core.get_common_edge_orientation_on_parent_faces(common_edge: TopoDS_Edge, face1: TopoDS_Face, face2: TopoDS_Face, is_seam: bool) tuple[TopAbs_Orientation, TopAbs_Orientation]#
Retrieve the orientations of a common edge on two parent faces, taking into account seam edges.
This function checks the orientation of a common edge on the two provided parent faces, face1 and face2. If the edge is a seam (i.e., is_seam is True), the orientation on face2 is inferred as the reverse of the orientation on face1. Otherwise, the orientation is retrieved by exploring the topology of both faces.
- Parameters:
common_edge – The common edge (TopoDS_Edge) between the two faces.
face1 – The first parent face (TopoDS_Shape) where the orientation of the edge will be checked.
face2 – The second parent face (TopoDS_Shape) where the orientation of the edge will be checked.
is_seam – A boolean indicating if the common edge is a seam edge (True if seam, False otherwise).
- Returns:
A tuple containing: - The orientation of the common edge on face1 (TopAbs_Orientation). - The orientation of the common edge on face2 (TopAbs_Orientation).
- volmdlr_tools.graph.utils.core.get_surface_color(surface_type: str) tuple[int, int, int]#
Return a color based on surface type.
- Param:
The surface type.
- volmdlr_tools.graph.utils.core.tangent(edge: TopoDS_Edge, u: float) Vector3D#
Return the tangent direction of the curve at u.
volmdlr_tools.graph.utils.volmdlr_temp module#
Module contents#
Faces graph utils.
- volmdlr_tools.graph.utils.angle_between_faces(face1: TopoDS_Face, face2: TopoDS_Face, bbox_face2: BoundingBox, allow_smooth: bool, smooth_angular_tol: float) tuple[FeatureAngleType, list[TopoDS_Edge], float]#
Compute the angle between two faces, taking into account the transition type.
This function identifies the common edge between the two faces, calculates the angle formed by their surface normals, and determines if the transition is smooth or concave/convex based on the angle and tolerances. It also handles the special case where the two faces are the same, but have a seam (self-edge).
- Parameters:
face1 – The first face to compare (TopoDS_Shape).
face2 – The second face to compare (TopoDS_Shape).
allow_smooth – Boolean flag indicating if smooth transitions should be accepted.
smooth_angular_tol – Tolerance (in radians) to consider a transition as smooth.
- Returns:
A tuple containing: - The type of angle (smooth, concave, convex, or undefined). - The common edges shared by the faces (if any). - The calculated angle in radians (if applicable).
- volmdlr_tools.graph.utils.get_color_based_on_angle_type(angle: FeatureAngleType) tuple[int, int, int]#
Return a color based on the angle type.
- Parameters:
angle – The angle type.
- Returns:
A tuple representing the RGB color.
- volmdlr_tools.graph.utils.get_surface_color(surface_type: str) tuple[int, int, int]#
Return a color based on surface type.
- Param:
The surface type.