diff --git a/src/build123d/topology.py b/src/build123d/topology.py index 8ef608d..c693e88 100644 --- a/src/build123d/topology.py +++ b/src/build123d/topology.py @@ -1088,7 +1088,11 @@ class Mixin3D: return max_radius def chamfer( - self, length: float, length2: Optional[float], edge_list: Iterable[Edge], face: Face = None + self, + length: float, + length2: Optional[float], + edge_list: Iterable[Edge], + face: Face = None, ) -> Self: """Chamfer @@ -1104,7 +1108,7 @@ class Mixin3D: part of the face Returns: - Any: Chamfered solid + Self: Chamfered solid """ if face: if any((edge for edge in edge_list if edge not in face.edges())): @@ -5459,18 +5463,27 @@ class Face(Shape): return self.__class__(fillet_builder.Shape()) def chamfer_2d( - self, distance: float, distance2: float, vertices: Iterable[Vertex], edge: Edge=None, + self, + distance: float, + distance2: float, + vertices: Iterable[Vertex], + edge: Edge = None, ) -> Face: """Apply 2D chamfer to a face Args: - distance (float): chamfer length - distance2 (float): chamfer length - vertices (Iterable[Vertex]): vertices to chamfer - edge (Edge): identifies the side where length is measured. The virtices must be - part of the edge + distance (float): chamfer length + distance2 (float): chamfer length + vertices (Iterable[Vertex]): vertices to chamfer + edge (Edge): identifies the side where length is measured. The vertices must be + part of the edge + + Raises: + ValueError: Cannot chamfer at this location + ValueError: One or more vertices are not part of edge Returns: + Face: face with a chamfered corner(s) """ @@ -5481,7 +5494,7 @@ class Face(Shape): edges = edge_map[vertex] if len(edges) < 2: raise ValueError("Cannot chamfer at this location") - + if edge: if edge not in edges: raise ValueError("One or more vertices are not part of edge") @@ -5495,7 +5508,6 @@ class Face(Shape): if edge in edges: pass - chamfer_builder.AddChamfer( TopoDS.Edge_s(edge1.wrapped), TopoDS.Edge_s(edge2.wrapped), @@ -6909,7 +6921,11 @@ class Wire(Shape, Mixin1D): return Face.make_from_wires(self).fillet_2d(radius, vertices).outer_wire() def chamfer_2d( - self, distance: float, distance2: float, vertices: Iterable[Vertex], edge:Edge = None + self, + distance: float, + distance2: float, + vertices: Iterable[Vertex], + edge: Edge = None, ) -> Wire: """chamfer_2d