def new( dxfversion: str = DXF2013, setup: Union[str, bool, Sequence[str]] = False, units: int = 6, ) -> "Drawing": """Create a new :class:`~ezdxf.drawing.Drawing` from scratch, `dxfversion` can be either "AC1009" the official DXF version name or "R12" the AutoCAD release name. :func:`new` can create drawings for following DXF versions: ======= ======================== Version AutoCAD Release ======= ======================== AC1009 AutoCAD R12 AC1015 AutoCAD R2000 AC1018 AutoCAD R2004 AC1021 AutoCAD R2007 AC1024 AutoCAD R2010 AC1027 AutoCAD R2013 AC1032 AutoCAD R2018 ======= ======================== The `units` argument defines th document and modelspace units. The header variable $MEASUREMENT will be set according to the given `units`, 0 for inch, feet, miles, ... and 1 for metric units. For more information go to module :mod:`ezdxf.units` Args: dxfversion: DXF version specifier as string, default is "AC1027" respectively "R2013" setup: setup default styles, ``False`` for no setup, ``True`` to setup everything or a list of topics as strings, e.g. ["linetypes", "styles"] to setup only some topics: ================== ======================================== Topic Description ================== ======================================== linetypes setup line types styles setup text styles dimstyles setup default `ezdxf` dimension styles visualstyles setup 25 standard visual styles ================== ======================================== units: document and modelspace units, default is 6 for meters """ doc = Drawing.new(dxfversion) doc.units = units doc.header["$MEASUREMENT"] = 0 if units in (1, 2, 3, 8, 9, 10) else 1 if setup: setup_drawing(doc, topics=setup) return doc
def new(dxfversion: str = DXF2013, setup: Union[str, bool, Sequence[str]] = None) -> 'Drawing': """ Create a new :class:`~ezdxf.drawing.Drawing` from scratch, `dxfversion` can be either ``'AC1009'`` the official DXF version name or ``'R12'`` the AutoCAD release name. :func:`new` can create drawings for following DXF versions: ======= ======================== Version AutoCAD Release ======= ======================== AC1009 AutoCAD R12 AC1015 AutoCAD R2000 AC1018 AutoCAD R2004 AC1021 AutoCAD R2007 AC1024 AutoCAD R2010 AC1027 AutoCAD R2013 AC1032 AutoCAD R2018 ======= ======================== .. versionadded:: 0.7.4 release name as DXF version Args: dxfversion: DXF version specifier as string, default is ``'AC1027'`` (R2013) setup: setup drawing standard styles - ``None`` or ``False`` for no setup - ``'all'`` or ``True`` to setup everything - a list of topics as strings, e.g. ``['linetypes', 'styles']`` to setup only linetypes and text styles: ====================== ====================================================== ``linetypes`` setup line types ``styles`` setup text styles ``dimstyles`` setup all dimension styles ``dimstyles:metric`` setup metric dimension styles ``dimstyles:imperial`` setup imperial dimension styles (not implemented yet) ``visualstyles`` setup 25 standard visual styles ====================== ====================================================== """ doc = Drawing.new(dxfversion) if setup: setup_drawing(doc, topics=setup) return doc
def new(dxfversion: str = DXF2013, setup: Union[str, bool, Sequence[str]] = False) -> 'Drawing': """ Create a new :class:`~ezdxf.drawing.Drawing` from scratch, `dxfversion` can be either "AC1009" the official DXF version name or "R12" the AutoCAD release name. :func:`new` can create drawings for following DXF versions: ======= ======================== Version AutoCAD Release ======= ======================== AC1009 AutoCAD R12 AC1015 AutoCAD R2000 AC1018 AutoCAD R2004 AC1021 AutoCAD R2007 AC1024 AutoCAD R2010 AC1027 AutoCAD R2013 AC1032 AutoCAD R2018 ======= ======================== Args: dxfversion: DXF version specifier as string, default is "AC1027" respectively "R2013" setup: setup default styles, ``False`` for no setup, ``True`` to setup everything or a list of topics as strings, e.g. ["linetypes", "styles"] to setup only some topics: ================== ======================================== Topic Description ================== ======================================== linetypes setup line types styles setup text styles dimstyles setup default `ezdxf` dimension styles visualstyles setup 25 standard visual styles ================== ======================================== """ doc = Drawing.new(dxfversion) if setup: setup_drawing(doc, topics=setup) return doc
def new(dxfversion: str = 'AC1009', setup: Union[str, bool, Sequence[str]] = None) -> 'Drawing': """ Create a new DXF drawing. new() can create drawings for following DXF versions: - AC1009 or R12: AutoCAD R12 (DXF R12) - AC1015 or R2000: AutoCAD 2000 (DXF R2000) - AC1018 or R2004: AutoCAD 2004 (DXF R2004) - AC1021 or R2007: AutoCAD 2007 (DXF R2007) - AC1024 or R2010: AutoCAD 2010 (DXF R2010) - AC1027 or R2013: AutoCAD 2013 (DXF R2013) - AC1032 or R2018: AutoCAD 2018 (DXF R2018) Args: dxfversion: DXF version specifier, default is AC1009 setup: setup drawing standard for linetypes, text styles, dimension styles None or False: no setup 'all' or True: setup all list of topics as strings: - 'linetypes' ... setup line types - 'styles' ... setup text styles - 'dimstyles ... setup all dimension styles - 'dimstyles:metric' ... setup metric dimension styles - 'dimstyles:imperial' ... setup imperial dimension styles (not implemented yet) """ from ezdxf.drawing import Drawing dwg = Drawing.new(dxfversion) if dwg.dxfversion > 'AC1009': dwg.reset_fingerprintguid() dwg.reset_versionguid() if setup: setup_drawing(dwg, topics=setup) return dwg