nanoLogika / ACadSvg

C# library to convert AutoCAD drawings from DWG to SVG. AutoCAD files are read using ACadSharp.
GNU Lesser General Public License v3.0
8 stars 2 forks source link

Dimension-text formatting: primary, alternate, tolerance #63

Closed mme1950 closed 6 months ago

mme1950 commented 7 months ago

The measurement text can in AutoCAD be specified explicitly. In this case this text displayed as it is.

If no explicit text is specified the measurement text must be created using a set of properties defined by the DimensionStyle object associated with the Dimenison object. All properties can be overridden by Dimension object's ExtendedData.

The measurement text contains

The primary part and alternate part respectively can be formatted in various styles, specified by the enums defiened in ACadSharp:

To create a measurement text based on the effective DimensionStyle properties both the parts of the measurement text and the style must be considered.

mme1950 commented 7 months ago

Concept

The DimensionSvg.CreateMeasurementText method creates the measurement text. Two implementations for linear dimensions and angular dimensions respectively.

Both implementation use a switch to distinguish the cases:

For each LinearUnitFormat and AngularUnitFormat a formatter class is implemented.

For linear dimensions the measurement text is composed es primary and alternate part if specified. For both parts different formatters may be used.

The created measuement text is coded using AutoCAD "markup" as used for MTEXT entities.