Replies: 5 comments 1 reply
-
You cannot rotate the modelspace, you have to rotate the entities of the modelspace: for e in msp:
e.rotate_z(angle) This rotates all entities of the modelspace around the z-axis in the origin (0, 0), this may raise a BTW: Rotation is nothing special for a CAD application, but |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, it works. |
Beta Was this translation helpful? Give feedback.
-
I've tried various options, but still haven't succeeded.
If I try:
|
Beta Was this translation helpful? Give feedback.
-
import ezdxf
doc = ezdxf.new()
msp = doc.modelspace()
pline = msp.add_lwpolyline(([(1, 1), (3, 2), (1, 3)]))
doc.saveas("test.dxf")
pline.scale(-1, 1, 1)
doc.saveas("test_sx.dxf") |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply. I found the problem. And the code I wrote was OK, but the problem was the application with which I opened the DXFs. More precisely with
DXFs were displayed correctly rotated. With the applications:
the same rotated DXFs were not displayed correctly. I don't know why this happens, I used the applications with the default settings, on Windows 10 Pro (64 bits) |
Beta Was this translation helpful? Give feedback.
-
Hello
I am trying to rotate (mirror) a DXF file (gerber). Just rotate the whole DXF by a certain number of degrees, nothing special.
I state from the beginning that this is my first contact with Python and with DXF files.
So, I installed Python :
pip install ezdxf
, thenpip install ezdxf[draw]
(I don't know if the second step was necessary).Then, I tried various options, but without success.
E.g:
, but I get an error message:
AttributeError: 'Modelspace' object has no attribute 'rotation'
I also attach the file that I want to rotate.
Basically, I'm looking for a simple method (regardless of which) to rotate a DXF file.
Thanks in advance for any help.
input.zip
Beta Was this translation helpful? Give feedback.
All reactions