Table of Contents

Class DxfObjectContextCollection

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

The drawing's list of scales, as AutoCAD's ObjectContextCollection of the name ACDB_ANNOTATIONSCALES: the SCALE objects of the dictionary ACAD_SCALELIST of the named object dictionary, each a DxfAnnotationScale, in the order of the dictionary, and the annotation scale of model space among them as CurrentContext.

public sealed class DxfObjectContextCollection : IEnumerable<DxfObjectContext>, IEnumerable
Inheritance
DxfObjectContextCollection
Implements
Inherited Members
Extension Methods

Remarks

A drawing AutoCAD saved lists its own scales, 1:1, 1:2 and on, as SCALEs whose entries are named A0, A1 and on, and those added to it as *A1, *A2 and on; a drawing of ezdxf holds the dictionary empty. scales.AddContext(new DxfAnnotationScale { Name = "1:50", PaperUnits = 1, DrawingUnits = 50 }) adds the scale of a plan in millimetres drawn at 1:50, its entry named *A1 in a list of none added; RemoveContext("1:50") takes it out again where nothing uses it.

Properties

CurrentContext

Gets or sets the current scale, as AutoCAD's CurrentContext: the scale the annotation scale of model space (Cannoscale, CANNOSCALE) names, which a new annotative object takes.

Name

Gets the name of the collection, as AutoCAD's Name: ACDB_ANNOTATIONSCALES.

Methods

AddContext(DxfObjectContext)

Adds a scale made in code to the list, as AutoCAD's AddContext: a SCALE at the end of the OBJECTS section, owned by ACAD_SCALELIST and named in it as AutoCAD 2021 names one, *A and one more than the highest number of such a name the list has or was given while the drawing is open: Z1, Z2 and Z3 added are *A1, *A2 and *A3, and Z4 added once Z3 is taken out is *A4 (check D35e). Its name (300), units (140, 141) and the flag of the unit scale (290) are written as AutoCAD writes them, the flag 1 for a scale of as many units of the paper as of the drawing, 1:1, where the list has no unit scale, as AutoCAD keeps one, else 0; the class SCALE listed in the CLASSES section where it is not. The dictionary ACAD_SCALELIST is added to the named object dictionary where it has none, in a file of R2007 (AC1021) or later, the version of AutoCAD 2008, which brought the list. The scale stands for its SCALE from then on.

CanRemoveContext(string)

Gets whether RemoveContext(string) would take a scale out: the list has it, and it is not the unit scale, the current scale or one an object points at. AutoCAD's -SCALELISTEDIT answers "Scale 1:1 is referenced so it cannot be deleted." for one it keeps, and its Delete * takes out every one this gives true for.

GetContext(string)

Gets the scale of a name, as AutoCAD's GetContext: GetContext("1:50").

GetEnumerator()

Gets an enumerator over the scales of the list, each a DxfAnnotationScale, in the order of the dictionary ACAD_SCALELIST.

HasContext(string)

Gets whether the list has a scale of a name, as AutoCAD's HasContext.

RemoveContext(string)

Takes a scale out of the list, as AutoCAD's RemoveContext: its SCALE erased with its entry of ACAD_SCALELIST. The scale AutoCAD keeps is refused: the unit scale (290 of 1), the current scale (CurrentContext), and a scale an object points at (the 340 of an annotative object's context, or any other hard pointer), as AutoCAD keeps a scale in use.