scaling shapes
- Dominant language
- Python
- Stars
- 5.8k
- Forks
- 541
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 5
Description
There is `Workplane.rotate` and `Workplane.translate` but not `Workplane.scale`.
There doesn't seem to be an easy way to scale shapes so I came up with this. Perhaps it should be part of the core API?
```python
def scale(workplane: cq.Workplane, x: float, y: Optional[float] = None, z: Optional[float] = None) -> cq.Workplane:
y = y if y is not None else x
z = z if z is not None else x
t = cq.Matrix([
[x, 0, 0, 0],
[0, y, 0, 0],
[0, 0, z, 0],
[0, 0, 0, 1]
])
return workplane.newObject([
o.transformGeometry(t) if isinstance(o, cq.Shape) else o
for o in workplane.objects
])
```
perhaps a generic `Workplane.transform(cq.Matrix)` would also be useful?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.