Replies: 1 comment 1 reply
-
import ezdxf
from ezdxf.math import Matrix44
def main():
doc = ezdxf.new()
msp = doc.modelspace()
circle = msp.add_circle((100, 100), radius=5)
doc.saveas("circle_orig.dxf")
move_to_origin = Matrix44.translate(-100, -100, 0)
scale = Matrix44.scale(0.5, 0.5, 1)
move_back = Matrix44.translate(100, 100, 0)
circle.transform(move_to_origin @ scale @ move_back)
doc.saveas("circle_scaled_at_center.dxf")
if __name__ == "__main__":
main() Before the transformation: After the transformation: |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Hairo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Scaling with the transform module seems to use
(0, 0)
as the base point, which means an object at(5000, 5000)
scaled withtransform.scale_uniform(obj, 0.5)
will move to(2500, 2500)
.Is there any way to change the base point? or scale without moving?
EDIT:
Tried to translate back with:
But now my objects are at
(5000.0000, 4997.5437)
instead of the original position(5000, 5000)
, seems to be an issue with the bounding box calculation?Beta Was this translation helpful? Give feedback.
All reactions