Change the position of drawing while reading dxf file

245 views
Skip to first unread message

akhil verma

unread,
Mar 22, 2021, 11:14:04 PM3/22/21
to python-ezdxf
Hi,
I am able to read a dxf file but I want to change the position of drawing. Can you please help me out?

Thanks,
Akhil 

Below is the code:

import ezdxf as ez
from ezdxf.groupby import groupby
doc = ez.readfile("AutoCad/pump_Grouped_1.dxf")
# iterate over all entities in modelspace
msp = doc.modelspace()
global wcs_location
group = msp.groupby(dxfattrib='layer')

for layer, entities in group.items():
    for entity in entities:
        dxf_Insert.append(entity.dxf.insert)
        wcs_location = entity.ocs().to_wcs(entity.dxf.insert)

Manfred Moitzi

unread,
Mar 23, 2021, 12:19:43 AM3/23/21
to akhil verma, python-ezdxf
1. DXF entities do not have unified attributes, this means not all DXF entities have an attribute called "insert".

2. For many (but not all) entities ezdxf provides a transformation interface entity.transform(), unsupported entities raise NotImplementedError(). Use Matrix44.translate(x, y, z) to create a translation matrix.

Related documentations:



--
You received this message because you are subscribed to the Google Groups "python-ezdxf" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-ezdxf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-ezdxf/077005be-fc0a-4a77-ac47-213630c71993n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages