DimStyle

../_images/dimvars11.svg
../_images/dimvars21.svg

DIMSTYLE (DXF Reference) defines the appearance of Dimension entities. Each of this dimension variables starting with dim... can be overridden for any Dimension entity individually.

Subclass of

ezdxf.entities.DXFEntity

DXF type

'DIMSTYLE'

Factory function

Drawing.dimstyles.new()

class ezdxf.entities.DimStyle
dxf.owner

Handle to owner (Table).

dxf.name

Dimension style name.

dxf.flags

Standard flag values (bit-coded values):

16

If set, table entry is externally dependent on an xref

32

If both this bit and bit 16 are set, the externally dependent xref has been successfully resolved

64

If set, the table entry was referenced by at least one entity in the drawing the last time the drawing was edited. (This flag is only for the benefit of AutoCAD)

dxf.dimpost

Prefix/suffix for primary units dimension values.

dxf.dimapost

Prefix/suffix for alternate units dimensions.

dxf.dimblk

Block type to use for both arrowheads as name string.

dxf.dimblk1

Block type to use for first arrowhead as name string.

dxf.dimblk2

Block type to use for second arrowhead as name string.

dxf.dimscale

Global dimension feature scale factor. (default=1)

dxf.dimasz

Dimension line and arrowhead size. (default=0.28)

dxf.dimexo

Distance from origin points to extension lines. (default imperial=0.0625, default metric=0.625)

dxf.dimdli

Incremental spacing between baseline dimensions. (default imperial=0.38, default metric=3.75)

dxf.dimexe

Extension line distance beyond dimension line. (default imperial=0.28, default metric=2.25)

dxf.dimrnd

Rounding value for decimal dimensions. (default=0)

Rounds all dimensioning distances to the specified value, for instance, if DIMRND is set to 0.25, all distances round to the nearest 0.25 unit. If you set DIMRND to 1.0, all distances round to the nearest integer.

dxf.dimdle

Dimension line extension beyond extension lines. (default=0)

dxf.dimtp

Upper tolerance value for tolerance dimensions. (default=0)

dxf.dimtm

Lower tolerance value for tolerance dimensions. (default=0)

dxf.dimtxt

Size of dimension text. (default imperial=0.28, default metric=2.5)

dxf.dimcen

Controls placement of center marks or centerlines. (default imperial=0.09, default metric=2.5)

dxf.dimtsz

Controls size of dimension line tick marks drawn instead of arrowheads. (default=0)

dxf.dimaltf

Alternate units dimension scale factor. (default=25.4)

dxf.dimlfac

Scale factor for linear dimension values. (default=1)

dxf.dimtvp

Vertical position of text above or below dimension line. (default=0)

dxf.dimtfac

Scale factor for fractional or tolerance text size. (default=1)

dxf.dimgap

Gap size between dimension line and dimension text. (default imperial=0.09, default metric=0.625)

dxf.dimaltrnd

Rounding value for alternate dimension units. (default=0)

dxf.dimtol

Toggles creation of appended tolerance dimensions. (default imperial=1, default metric=0)

dxf.dimlim

Toggles creation of limits-style dimension text. (default=0)

dxf.dimtih

Orientation of text inside extension lines. (default imperial=1, default metric=0)

dxf.dimtoh

Orientation of text outside extension lines. (default imperial=1, default metric=0)

dxf.dimse1

Toggles suppression of first extension line. (default=0)

dxf.dimse2

Toggles suppression of second extension line. (default=0)

dxf.dimtad

Sets text placement relative to dimension line. (default imperial=0, default metric=1)

dxf.dimzin

Zero suppression for primary units dimensions. (default imperial=0, default metric=8) ???

dxf.dimazin

Controls zero suppression for angular dimensions. (default=0)

dxf.dimalt

Enables or disables alternate units dimensioning. (default=0)

dxf.dimaltd

Controls decimal places for alternate units dimensions. (default imperial=2, default metric=3)

dxf.dimtofl

Toggles forced dimension line creation. (default imperial=0, default metric=1)

dxf.dimsah

Toggles appearance of arrowhead blocks. (default=0)

dxf.dimtix

Toggles forced placement of text between extension lines. (default=0)

dxf.dimsoxd

Suppresses dimension lines outside extension lines. (default=0)

dxf.dimclrd

Dimension line, arrowhead, and leader line color. (default=0)

dxf.dimclre

Dimension extension line color. (default=0)

dxf.dimclrt

Dimension text color. (default=0)

dxf.dimadec

Controls the number of decimal places for angular dimensions.

dxf.dimunit

Obsolete, now use DIMLUNIT AND DIMFRAC

dxf.dimdec

Decimal places for dimension values. (default imperial=4, default metric=2)

dxf.dimtdec

Decimal places for primary units tolerance values. (default imperial=4, default metric=2)

dxf.dimaltu

Units format for alternate units dimensions. (default=2)

dxf.dimalttd

Decimal places for alternate units tolerance values. (default imperial=4, default metric=2)

dxf.dimaunit

Unit format for angular dimension values. (default=0)

dxf.dimfrac

Controls the fraction format used for architectural and fractional dimensions. (default=0)

dxf.dimlunit

Specifies units for all nonangular dimensions. (default=2)

dxf.dimdsep

Specifies a single character to use as a decimal separator. (default imperial=”.”, default metric=”,”) This is an integer value, use ord('.') to write value.

dxf.dimtmove

Controls the format of dimension text when it is moved. (default=0)

dxf.dimjust

Horizontal justification of dimension text. (default=0)

dxf.dimsd1

Toggles suppression of first dimension line. (default=0)

dxf.dimsd2

Toggles suppression of second dimension line. (default=0)

dxf.dimtolj

Vertical justification for dimension tolerance text. (default=1)

dxf.dimaltz

Zero suppression for alternate units dimension values. (default=0)

dxf.dimalttz

Zero suppression for alternate units tolerance values. (default=0)

dxf.dimfit

Obsolete, now use DIMATFIT and DIMTMOVE

dxf.dimupt

Controls user placement of dimension line and text. (default=0)

dxf.dimatfit

Controls placement of text and arrowheads when there is insufficient space between the extension lines. (default=3)

dxf.dimtxsty

Text style used for dimension text by name.

dxf.dimtxsty_handle

Text style used for dimension text by handle of STYLE entry. (use DimStyle.dxf.dimtxsty to get/set text style by name)

dxf.dimldrblk

Specify arrowhead used for leaders by name.

dxf.dimldrblk_handle

Specify arrowhead used for leaders by handle of referenced block. (use DimStyle.dxf.dimldrblk to get/set arrowhead by name)

dxf.dimblk_handle

Block type to use for both arrowheads, handle of referenced block. (use DimStyle.dxf.dimblk to get/set arrowheads by name)

dxf.dimblk1_handle

Block type to use for first arrowhead, handle of referenced block. (use DimStyle.dxf.dimblk1 to get/set arrowhead by name)

dxf.dimblk2_handle

Block type to use for second arrowhead, handle of referenced block. (use DimStyle.dxf.dimblk2 to get/set arrowhead by name)

dxf.dimlwd

Lineweight value for dimension lines. (default=-2, BYBLOCK)

dxf.dimlwe

Lineweight value for extension lines. (default=-2, BYBLOCK)

dxf.dimltype

Specifies the linetype used for the dimension line as linetype name, requires DXF R2007+

dxf.dimltype_handle

Specifies the linetype used for the dimension line as handle to LTYPE entry, requires DXF R2007+ (use DimStyle.dxf.dimltype to get/set linetype by name)

dxf.dimltex1

Specifies the linetype used for the extension line 1 as linetype name, requires DXF R2007+

dxf.dimlex1_handle

Specifies the linetype used for the extension line 1 as handle to LTYPE entry, requires DXF R2007+ (use DimStyle.dxf.dimltex1 to get/set linetype by name)

dxf.dimltex2

Specifies the linetype used for the extension line 2 as linetype name, requires DXF R2007+

dxf.dimlex2_handle

Specifies the linetype used for the extension line 2 as handle to LTYPE entry, requires DXF R2007+ (use DimStyle.dxf.dimltex2 to get/set linetype by name)

dxf.dimfxlon

Extension line has fixed length if set to 1, requires DXF R2007+

dxf.dimfxl

Length of extension line below dimension line if fixed (DimStyle.dxf.dimtfxlon == 1), DimStyle.dxf.dimexen defines the the length above the dimension line, requires DXF R2007+

dxf.dimtfill

Text fill 0=off; 1=background color; 2=custom color (see DimStyle.dxf.dimtfillclr), requires DXF R2007+

dxf.dimtfillclr

Text fill custom color as color index (1-255), requires DXF R2007+

copy_to_header(dwg: Drawing) → None

Copy all dimension style variables to HEADER section of dwg.

set_arrows(blk: str = '', blk1: str = '', blk2: str = '', ldrblk: str = '') → None

Set arrows by block names or AutoCAD standard arrow names, set DIMTSZ to 0 which disables tick.

Parameters
  • blk – block/arrow name for both arrows, if DIMSAH is 0

  • blk1 – block/arrow name for first arrow, if DIMSAH is 1

  • blk2 – block/arrow name for second arrow, if DIMSAH is 1

  • ldrblk – block/arrow name for leader

set_tick(size: float = 1) → None

Set tick size, which also disables arrows, a tick is just an oblique stroke as marker.

Parameters

size – arrow size in drawing units

set_text_align(halign: str = None, valign: str = None, vshift: float = None) → None

Set measurement text alignment, halign defines the horizontal alignment (requires DXF R2000), valign defines the vertical alignment, above1 and above2 means above extension line 1 or 2 and aligned with extension line.

Parameters
  • halignleft, right, center`, `above1, above2 (requires DXF R2000)

  • valignabove, center, below

  • vshift – vertical text shift, if valign is center; >0 shift upward, <0 shift downwards

set_text_format(prefix: str = '', postfix: str = '', rnd: float = None, dec: int = None, sep: str = None, leading_zeros: bool = True, trailing_zeros: bool = True)

Set dimension text format, like prefix and postfix string, rounding rule and number of decimal places.

Parameters
  • prefix – Dimension text prefix text as string

  • postfix – Dimension text postfix text as string

  • rnd – Rounds all dimensioning distances to the specified value, for instance, if DIMRND is set to 0.25, all distances round to the nearest 0.25 unit. If you set DIMRND to 1.0, all distances round to the nearest integer.

  • dec – Sets the number of decimal places displayed for the primary units of a dimension. (requires DXF R2000)

  • sep'.' or ',' as decimal separator (requires DXF R2000)

  • leading_zeros – suppress leading zeros for decimal dimensions if False

  • trailing_zeros – suppress trailing zeros for decimal dimensions if False

set_dimline_format(color: int = None, linetype: str = None, lineweight: int = None, extension: float = None, disable1: bool = None, disable2: bool = None)

Set dimension line properties

Parameters
  • color – color index

  • linetype – linetype as string (requires DXF R2007)

  • lineweight – line weight as int, 13 = 0.13mm, 200 = 2.00mm (requires DXF R2000)

  • extension – extension length

  • disable1True to suppress first part of dimension line (requires DXF R2000)

  • disable2True to suppress second part of dimension line (requires DXF R2000)

set_extline_format(color: int = None, lineweight: int = None, extension: float = None, offset: float = None, fixed_length: float = None)

Set common extension line attributes.

Parameters
  • color – color index

  • lineweight – line weight as int, 13 = 0.13mm, 200 = 2.00mm

  • extension – extension length above dimension line

  • offset – offset from measurement point

  • fixed_length – set fixed length extension line, length below the dimension line

set_extline1(linetype: str = None, disable=False)

Set extension line 1 attributes.

Parameters
  • linetype – linetype for extension line 1 (requires DXF R2007)

  • disable – disable extension line 1 if True

set_extline2(linetype: str = None, disable=False)

Set extension line 2 attributes.

Parameters
  • linetype – linetype for extension line 2 (requires DXF R2007)

  • disable – disable extension line 2 if True

set_tolerance(upper: float, lower: float = None, hfactor: float = 1.0, align: str = None, dec: int = None, leading_zeros: bool = None, trailing_zeros: bool = None) → None

Set tolerance text format, upper and lower value, text height factor, number of decimal places or leading and trailing zero suppression.

Parameters
  • upper – upper tolerance value

  • lower – lower tolerance value, if None same as upper

  • hfactor – tolerance text height factor in relation to the dimension text height

  • align – tolerance text alignment 'TOP', 'MIDDLE', 'BOTTOM' (requires DXF R2000)

  • dec – Sets the number of decimal places displayed (requires DXF R2000)

  • leading_zeros – suppress leading zeros for decimal dimensions if False (requires DXF R2000)

  • trailing_zeros – suppress trailing zeros for decimal dimensions if False (requires DXF R2000)

set_limits(upper: float, lower: float, hfactor: float = 1.0, dec: int = None, leading_zeros: bool = None, trailing_zeros: bool = None) → None

Set limits text format, upper and lower limit values, text height factor, number of decimal places or leading and trailing zero suppression.

Parameters
  • upper – upper limit value added to measurement value

  • lower – lower lower value subtracted from measurement value

  • hfactor – limit text height factor in relation to the dimension text height

  • dec – Sets the number of decimal places displayed (requires DXF R2000)

  • leading_zeros – suppress leading zeros for decimal dimensions if False (requires DXF R2000)

  • trailing_zeros – suppress trailing zeros for decimal dimensions if False (requires DXF R2000)