Apply a 2D chamfer to a planar face.
(s: Shape, verts: Shape, d: float)
| 7074 | |
| 7075 | |
| 7076 | def chamfer2D(s: Shape, verts: Shape, d: float) -> Shape: |
| 7077 | """ |
| 7078 | Apply a 2D chamfer to a planar face. |
| 7079 | """ |
| 7080 | |
| 7081 | f = _get_one(s, "Face") |
| 7082 | |
| 7083 | bldr = BRepFilletAPI_MakeFillet2d(tcast(TopoDS_Face, f.wrapped)) |
| 7084 | edge_map = s._entitiesFrom("Vertex", "Edge") |
| 7085 | |
| 7086 | for v in verts.vertices(): |
| 7087 | edges = edge_map[v] |
| 7088 | if len(edges) < 2: |
| 7089 | raise ValueError("Cannot chamfer at this location") |
| 7090 | |
| 7091 | e1, e2 = edges |
| 7092 | |
| 7093 | bldr.AddChamfer( |
| 7094 | tcast(TopoDS_Edge, e1.wrapped), tcast(TopoDS_Edge, e2.wrapped), d, d |
| 7095 | ) |
| 7096 | |
| 7097 | bldr.Build() |
| 7098 | |
| 7099 | return _compound_or_shape(bldr.Shape()) |
| 7100 | |
| 7101 | |
| 7102 | def fillet2D(s: Shape, verts: Shape, r: float) -> Shape: |