Chamfers a solid on the selected edges. The edges on the stack are chamfered. The solid to which the edges belong must be in the parent chain of the selected edges. Optional parameter `length2` can be supplied with a different value than `length` fo
(self: T, length: float, length2: Optional[float] = None)
| 1245 | return self.newObject([s.clean()]) |
| 1246 | |
| 1247 | def chamfer(self: T, length: float, length2: Optional[float] = None) -> T: |
| 1248 | """ |
| 1249 | Chamfers a solid on the selected edges. |
| 1250 | |
| 1251 | The edges on the stack are chamfered. The solid to which the |
| 1252 | edges belong must be in the parent chain of the selected |
| 1253 | edges. |
| 1254 | |
| 1255 | Optional parameter `length2` can be supplied with a different |
| 1256 | value than `length` for a chamfer that is shorter on one side |
| 1257 | longer on the other side. |
| 1258 | |
| 1259 | :param length: the length of the chamfer, must be greater than zero |
| 1260 | :param length2: optional parameter for asymmetrical chamfer |
| 1261 | :raises ValueError: if at least one edge is not selected |
| 1262 | :raises ValueError: if the solid containing the edge is not in the chain |
| 1263 | :returns: CQ object with the resulting solid selected. |
| 1264 | |
| 1265 | This example will create a unit cube, with the top edges chamfered:: |
| 1266 | |
| 1267 | s = Workplane("XY").box(1, 1, 1).faces("+Z").chamfer(0.1) |
| 1268 | |
| 1269 | This example will create chamfers longer on the sides:: |
| 1270 | |
| 1271 | s = Workplane("XY").box(1, 1, 1).faces("+Z").chamfer(0.2, 0.1) |
| 1272 | """ |
| 1273 | solid = self.findSolid() |
| 1274 | |
| 1275 | edgeList = cast(List[Edge], self.edges().vals()) |
| 1276 | if len(edgeList) < 1: |
| 1277 | raise ValueError("Chamfer requires that edges be selected") |
| 1278 | |
| 1279 | s = solid.chamfer(length, length2, edgeList) |
| 1280 | |
| 1281 | return self.newObject([s]) |
| 1282 | |
| 1283 | def transformed( |
| 1284 | self: T, rotate: VectorLike = (0, 0, 0), offset: VectorLike = (0, 0, 0) |