Create a new workplane based on the current one. The origin of the new plane is located at the existing origin+offset vector, where offset is given in coordinates local to the current plane The new plane is rotated through the angles specified by the components of th
(
self: T, rotate: VectorLike = (0, 0, 0), offset: VectorLike = (0, 0, 0)
)
| 1281 | return self.newObject([s]) |
| 1282 | |
| 1283 | def transformed( |
| 1284 | self: T, rotate: VectorLike = (0, 0, 0), offset: VectorLike = (0, 0, 0) |
| 1285 | ) -> T: |
| 1286 | """ |
| 1287 | Create a new workplane based on the current one. |
| 1288 | The origin of the new plane is located at the existing origin+offset vector, where offset is |
| 1289 | given in coordinates local to the current plane |
| 1290 | The new plane is rotated through the angles specified by the components of the rotation |
| 1291 | vector. |
| 1292 | |
| 1293 | :param rotate: 3-tuple of angles to rotate, in degrees relative to work plane coordinates |
| 1294 | :param offset: 3-tuple to offset the new plane, in local work plane coordinates |
| 1295 | :return: a new work plane, transformed as requested |
| 1296 | """ |
| 1297 | |
| 1298 | # old api accepted a vector, so we'll check for that. |
| 1299 | if isinstance(rotate, Vector): |
| 1300 | rotate = rotate.toTuple() |
| 1301 | |
| 1302 | if isinstance(offset, Vector): |
| 1303 | offset = offset.toTuple() |
| 1304 | |
| 1305 | p = self.plane.rotated(rotate) |
| 1306 | p.origin = self.plane.toWorldCoords(offset) |
| 1307 | ns = self.newObject([p.origin]) |
| 1308 | ns.plane = p |
| 1309 | |
| 1310 | return ns |
| 1311 | |
| 1312 | def newObject(self: T, objlist: Iterable[CQObject]) -> T: |
| 1313 | """ |