Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 1.7 KB

zoom.rst

File metadata and controls

54 lines (37 loc) · 1.7 KB

Zoom Layouts

ezdxf.zoom

These functions mimic the ZOOM commands in CAD applications.

Zooming means resetting the current viewport limits to new values. The coordinates for the functions center and window are drawing units for the model space and paper space units for paper space layouts. The modelspace units in Drawing.units are ignored.

The extents detection for the functions entities and extents is done by the ezdxf.bbox module. Read the associated documentation to understand the limitations of the ezdxf.bbox module. Tl;dr The extents detection is slow and not accurate.

Because the ZOOM operations in CAD applications are not that precise, then zoom functions of this module uses the fast bounding box calculation mode of the bbox module, which means the argument flatten is always False for ~ezdxf.bbox.extents function calls.

The region displayed by CAD applications also depends on the aspect ratio of the application window, which is not available to ezdxf, therefore the viewport size is just an educated guess of an aspect ratio of 2:1 (16:9 minus top toolbars and the bottom status bar).

Warning

All zoom functions replace the current viewport configuration by a single window configuration.

Example to reset the main CAD viewport of the model space to the extents of its entities:

import ezdxf
from ezdxf import zoom

doc = ezdxf.new()
msp = doc.modelspace()
... # add your DXF entities

zoom.extents(msp)
doc.saveas("your.dxf")

center

objects

extents

window