Application Settings¶
This is a high-level module for working with CAD application settings and behaviors. None of these settings have any influence on the behavior of ezdxf, since ezdxf only takes care of the content of the DXF file and not of the way it is presented to the user.
Important
You need to understand that these settings work at the application level, ezdxf cannot force an application to do something in a certain way! The functionality of this module has been tested with Autodesk TrueView and BricsCAD, other applications may show different results or ignore the settings.
Set Current Properties¶
The current properties are used by the CAD application to create new entities, these settings do not affect how ezdxf creates new entities.
The module ezdxf.gfxattribs
provides the class GfxAttribs()
,
which can load the current graphical entity settings from the HEADER section
for creating new entities by ezdxf: load_from_header()
- ezdxf.appsettings.set_current_color(doc: Drawing, color: int)¶
Set current AutoCAD Color Index (ACI).
- ezdxf.appsettings.set_current_lineweight(doc: Drawing, lineweight: int)¶
Set current lineweight, see Lineweights reference for valid values.
- ezdxf.appsettings.set_current_linetype_scale(doc: Drawing, scale: float)¶
Set current linetype scale.
Restore the WCS¶
Update Extents¶
- ezdxf.appsettings.update_extents(doc: Drawing) BoundingBox ¶
Calculate the extents of the model space, update the HEADER variables $EXTMIN and $EXTMAX and returns the result as
ezdxf.math.BoundingBox
. Note that this function uses theezdxf.bbox
module to calculate the extent of the model space. This module is not very fast and not very accurate for text and ignores all ACIS based entities.The function updates only the values in the HEADER section, to zoom the active viewport to this extents, use this recipe:
import ezdxf from ezdxf import zoom, appsettings doc = ezdxf.readfile("your.dxf") extents = appsettings.update_extents(doc) zoom.center(doc.modelspace(), extents.center, extents.size)
See also
the
ezdxf.bbox
module to understand the limitations of the extent calculationthe
ezdxf.zoom
module