Table of Contents

CadDimStyleEditor

from OpenCAD2D import CadDimStyleEditor

class CadDimStyleEditor(System.Object) ยท CadDimStyleEditor in the .NET reference

The edits of the dimension style table, as AutoCAD's Dimension Style Manager (DIMSTYLE) makes them: each one undo step through CadDocument.ApplyEdit, refused where AutoCAD refuses it. A style's variables travel as values by their names (Dimasz, Dimtxt), the names of the library's DxfDimStyleTableRecord; an arrowhead as its name in CadArrowheads.Names (Closed filled for none), a text style or a linetype as its name, null for none.

Properties and fields

AnnotativeKey

.NET

AnnotativeKey: ClassVar[str]

The key of the style's Annotative flag among the values a dialog hands to CadDimStyleEditor.Apply and CadDimStyleEditor.Add: a bool, not a variable.

VariableNames

.NET

VariableNames: ClassVar[System.Collections.Generic.IReadOnlyList[str]]

Gets the names of the variables a style has, as the library names them, in ordinal order: Dimadec to Dimzin.

Methods

Add

.NET

@staticmethod
def Add(
    document: CadDocument,
    name: str,
    from_: str,
    /,
    values: System.Collections.Generic.IDictionary[str, object],
) -> CadEditResult

Adds a style, as the Manager's New: a copy of another's variables (Start With), under a name no style of the drawing has.

Apply

.NET

@staticmethod
def Apply(
    document: CadDocument,
    name: str,
    values: System.Collections.Generic.IDictionary[str, object],
) -> CadEditResult

Writes variables into a style, as OK of the Manager's Modify: each that differs, then the dimensions drawn in it drawn again (see the remarks), and the header given them where the style is current. Nothing is written where none differs.

Compare

.NET

@staticmethod
def Compare(
    first: System.Collections.Generic.IDictionary[str, object],
    second: System.Collections.Generic.IDictionary[str, object],
) -> System.Collections.Generic.IReadOnlyList[System.Collections.Generic.KeyValuePair[str, System.Array[str]]]

Gets the variables in which two sets of values differ, as the Manager's Compare lists them: each name with the two values as text, in ordinal order of the names.

CountUses

.NET

@staticmethod
def CountUses(document: CadDocument, name: str) -> int

Gets how many dimensions are drawn in a style, or in a style AutoCAD keeps for one kind of them (ISO-25$0), in every space and block.

Current

.NET

@staticmethod
def Current(database: DxfDatabase) -> str

Gets the name of the current dimension style ($DIMSTYLE), as the table spells it; the first style where the header names none the drawing has.

Delete

.NET

@staticmethod
def Delete(document: CadDocument, name: str) -> CadEditResult

Deletes a style, as the Manager's Delete: refused for Standard, the current style and a style dimensions are drawn in, saying how many.

KeysOf

.NET

@staticmethod
def KeysOf(part: CadStylePart) -> System.Collections.Generic.IReadOnlyList[str]

Gets the keys of the fields that set a part, in the order of the dialog: the tabs from Lines to Tolerances, the rows of each in order.

Measures

.NET

@staticmethod
def Measures(
    sample: CadStyleSample,
    values: System.Collections.Generic.IDictionary[str, object],
    key: str,
) -> System.Collections.Generic.IReadOnlyList[CadStyleMeasure]

Measures what a field of the dimension style dialogs sets on the sample, as a callout: DIMEXE from the dimension line to the end of the first extension line, DIMEXO from the origin to the start of it, DIMFXL along it to the line, DIMASZ along the second arrowhead from its tip, DIMDLE the run of the line past the second extension line (for ticks), DIMDLI between the two dimension lines of the Lines sample, DIMTXT the height of the words, DIMGAP the gap between the dimension line and the words, DIMCEN# the half of the centre mark and DIMJOGANG the angle of the jog (an arc). A part the style leaves out (DIMSE1, DIMSE2, DIMSD1, DIMSD2 on, DIMCEN none) is given with the Key of its field as the ghost of where it would be. The points are in the drawing coordinates of the sample, so the lengths are the values times the overall scale; the label has the value as the field shows it.

Override

.NET

@staticmethod
def Override(
    document: CadDocument,
    handles: System.Collections.Generic.IReadOnlyCollection[str],
    values: System.Collections.Generic.IDictionary[str, object],
) -> CadEditResult

Writes variables as overrides of the dimensions given, as AutoCAD's DIMOVERRIDE writes them into a dimension's extended data (ACAD, DSTYLE), each dimension then drawn again; the style is left as it is. A dimension an owner keeps is refused through the document's edit gate.

PartsOf

.NET

@staticmethod
def PartsOf(key: str) -> System.Collections.Generic.IReadOnlyList[CadStylePart]

Gets the parts of a sample a field of the dimension style dialogs sets, from the table of the fields: the extension and dimension lines, the arrowheads, the words. A field of no part (DIMSCALE, Annotative, DIMUPT) gives none. The key is the name of the variable the dialog shows beside the field, as DIMEXE, letters of either case and spaces left out the same; a field of two variables is keyed by the first (DIMTOL, DIMTIH), the second field of one variable by the variable and a # (DIMCEN# the centre mark's size, DIMGAP# the frame round the text), and the placement of the alternate units as DIMPOST\X.

Read

.NET

@staticmethod
def Read(style: DxfDimStyleTableRecord) -> System.Collections.Generic.SortedDictionary[str, Any]

Reads the variables of a style, or of the dimension style data a dimension or the header gives, by their names.

Rename

.NET

@staticmethod
def Rename(document: CadDocument, name: str, newName: str) -> CadEditResult

Renames a style with the dimensions drawn in it, as the Manager's Rename; Standard keeps its name.

Sample

.NET

@staticmethod
def Sample(
    source: DxfDatabase,
    values: System.Collections.Generic.IDictionary[str, object],
    kind: CadDimSampleKind,
) -> CadStyleSample

Makes the sample of one tab of the dimension style dialogs, with the parts of its dimensions told apart: a drawing of its own holding the style's variables (the text style copied by its name and font, the arrowheads' blocks made, the linetypes of the dimension and extension lines copied), and in its model space the entities of the sample's dimensions, each its own, drawn by the builders the DIM commands use (see CadDimSampleKind for what each sample holds). The sample is as many times bigger as the style's overall scale (DIMSCALE) says, nought taken for 1. The CadDimSampleKind.Overview sample draws what CadDimStyleEditor.Samples draws, item for item.

Samples

.NET

@staticmethod
def Samples(source: DxfDatabase, values: System.Collections.Generic.IDictionary[str, object]) -> DxfDatabase

Makes the sample dimensions of the Manager's preview: a drawing of its own holding the style's variables (the text style copied by its name and font, the arrowheads' blocks made), a part 32 by 20 with a linear dimension across its top, a circle of radius 12 with its radius and an angle of 60 degrees, drawn as the DIM commands draw them.

SetCurrent

.NET

@staticmethod
def SetCurrent(document: CadDocument, name: str) -> CadEditResult

Makes a style current ($DIMSTYLE), as Set Current and the style box do, its variables given to the header as AutoCAD gives them, so that the header's dimension variables are the style's.

Styles

.NET

@staticmethod
def Styles(database: DxfDatabase) -> System.Collections.Generic.IReadOnlyList[DxfDimStyleTableRecord]

Gets the styles the Manager lists: those of the table but the ones AutoCAD keeps for one kind of dimension of another (ISO-25$0), in the order of the table.

Text

.NET

@staticmethod
def Text(value: object) -> str

Gives a value of a variable as the Manager shows it: a number invariant to 15 figures, a colour as AutoCAD names it, none as an empty text.

Write

.NET

@staticmethod
def Write(
    database: DxfDatabase,
    style: DxfDimStyleTableRecord,
    values: System.Collections.Generic.IDictionary[str, object],
) -> None

Writes variables into a style of a drawing, each that differs, by their names (CadDimStyleEditor.VariableNames): a name of an arrowhead, text style or linetype is taken to its record in the drawing, an arrowhead's block made where it is AutoCAD's, and a text style or linetype the drawing has not gives the variable no record. A value is the kind the variable is (a Double for Dimtxt, a Boolean for Dimtix, a String for Dimtxsty).