I am using the Python package ezdxf to extract information from a dxf file. Is there a way I can find out the height and width of the file, so than I can create an image of the same size and draw the entities on it for my reference. I tried to extract the information from the DXF Header using `
dwg = ezdxf.readfile("example.dxf")
print "EXTMAX ", dwg.header['$EXTMAX']
print "EXTMIN ", dwg.header['$EXTMIN']
print "LIMMAX ", dwg.header['$LIMMAX']
print "LIMMIN ", dwg.header['$LIMMIN']
as mentioned in this link.
But I am not clear about what they mean. Also would request for some links having good details about Python ezdxf.
The system variables EXTMIN
& EXTMAX
store the lower-left & upper-right corners of the smallest rectangular frame which encloses all geometry in the drawing or in your case, DXF.
The values of these system variables are 3D points expressed relative to the World Coordinate System (WCS) of the drawing. The coordinate values of the points will be expressed in the units of the DXF (e.g. as given by the INSUNITS
system variable), or may be unitless.
You can use the difference between the X & Y coordinate values of the points given by the EXTMAX
& EXTMIN
system variables respectively to obtain the dimensions (and hence aspect ratio) of the DXF, enabling you to create an image scaled to the same aspect ratio.
LIMMIN
& LIMMAX
also store 3D WCS points corresponding to the lower-left & upper-right corners of a rectangular area, however, this area is merely a user-imposed restriction on the available drawing area when new objects are created after limit checking has been enabled (LIMCHECK = 1
).
Whilst the LIMMIN
& LIMMAX
system variables theoretically provide an upper-bound on the dimensions of the bounding box surrounding all geometry in the DXF, this is an unreliable measure, as objects can be created with limit checking disabled and such objects will not be removed when limit checking is enabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With