Creates a formatter that reads unit settings from the given database.
Drawing database whose LUNITS, AUNITS, and related variables are consulted on every format call.
Formats an angle given in radians (WCS), for display according to the drawing angle units.
Processing order:
| AUNITS | Typical output (no unit suffix) |
|---|---|
0 Decimal degrees |
45 or 45.5 |
1 Degrees/minutes/seconds |
45d30'15" |
2 Gradians |
50 |
3 Radians |
0.785 |
4 Surveyor's |
N 45d30'15" E |
Angle in radians. When AcDbFormatterOptions.applyAngbaseAngdir is
true (default), this is an absolute WCS angle (counterclockwise from +X before
ANGBASE / ANGDIR adjustment). When false, this is the scalar angle to display.
Optionaloptions: AcDbFormatterOptionsOptional display flags; when AcDbFormatterOptions.showUnits is true,
unit markers such as °, g, or rad may be appended.
Formatted angle string.
For included or relative angles, pass AcDbFormatterOptions.applyAngbaseAngdir = false.
For arc sweep or dimension overrides, supply the appropriate radians value and flags.
Formats a single linear distance in drawing units.
The output pattern follows LUNITS and
LUPREC. When AcDbFormatterOptions.showUnits is true,
a suffix may be appended based on INSUNITS and
MEASUREMENT.
| LUNITS | Typical output (no unit suffix) |
|---|---|
1 Scientific |
1.23E+02 |
2 Decimal |
12.35 |
3 Engineering |
1'-3.5 (value interpreted as inches) |
4 Architectural |
1'-3 1/2 |
5 Fractional |
15 1/2 |
6 Windows desktop |
Same as decimal |
UNITMODE changes delimiters for engineering, architectural,
and fractional modes (for example 1'3-1/2 when UNITMODE = 1).
Distance in drawing units (WCS length, not pre-converted to feet or degrees).
Optionaloptions: AcDbFormatterOptionsOptional display flags; see AcDbFormatterOptions.
Formatted string suitable for status bars, measurement overlays, or tooltips.
Formats a 2D point as "x, y", formatting each component with formatLength.
Both coordinates use the same LUNITS / LUPREC rules and the
same AcDbFormatterOptions for the call. The separator is a comma followed by a space
(, ), which matches common Cartesian display in measurement UIs.
Point in drawing units (WCS x / y).
Optionaloptions: AcDbFormatterOptionsOptional display flags applied to each coordinate.
Formatted coordinate pair, for example "1.2, 4.6" or "1'-0, 2'-6" depending on LUNITS.
Formats a 3D point as "x, y, z", formatting each component with formatLength.
Behavior is the same as formatPoint2d for x and y, with z appended using the same linear formatting and options.
Point in drawing units (WCS x / y / z).
Optionaloptions: AcDbFormatterOptionsOptional display flags applied to each coordinate.
Formatted coordinate triple, for example "1.2, 4.6, 7.9".
Formats linear distances, point coordinates, and angles for display in the UI, matching AutoCAD drawing-unit behavior as closely as the supported system variables allow.
An instance is bound to one AcDbDatabase. On each call it reads the current values of the relevant header/system variables from that database (not a snapshot taken at construction).
Linear distances and coordinates
true; see AcDbDatabase.insunitsEngineering (LUNITS = 3) and architectural (LUNITS = 4) formats treat the numeric value as inches, consistent with AutoCAD.
Angles
Input angles are radians in WCS. Before formatting, the value is adjusted by ANGBASE and ANGDIR, then converted per AUNITS and AUPREC.
Out of scope
Dimension entity text uses per-style DIM* variables (for example DIMLUNIT, DIMDEC), not this class. SNAPANG and UCS settings affect snapping/input, not WCS coordinate strings here.
Example