Skip to content

Commit 89aaa5b

Browse files
authored
feat: support xdata and xrecord (#24)
1 parent 2d476cb commit 89aaa5b

22 files changed

Lines changed: 743 additions & 58 deletions
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
/* eslint-disable @typescript-eslint/no-duplicate-enum-values */
2+
/**
3+
* DXF group codes used by AutoCAD for reading and writing DXF/DWG data.
4+
*
5+
* This enum mirrors Autodesk.AutoCAD.DatabaseServices.DxfCode exactly.
6+
* Values indicate both semantic meaning and expected data type.
7+
*
8+
* @remarks
9+
* - Group codes 0–9: string / symbol data
10+
* - Group codes 10–59: floating-point values
11+
* - Group codes 60–79: short integers
12+
* - Group codes 90–99: 32-bit integers
13+
* - Group codes 100–107: subclass / control strings
14+
* - Group codes 300–369: strings / handles
15+
* - Group codes 370–389: lineweight / plot style
16+
* - Group codes 400+ : extended data (XData)
17+
* - Negative values : internal / structural markers
18+
*/
19+
export const enum AcDbDxfCode {
20+
/** Invalid DXF code */
21+
Invalid = -9999,
22+
23+
/** Start of an entity or section */
24+
Start = 0,
25+
26+
/** Primary text string */
27+
Text = 1,
28+
29+
/** Attribute tag, block name, symbol name */
30+
AttributeTag = 2,
31+
BlockName = 2,
32+
ShapeName = 2,
33+
SymbolTableName = 2,
34+
SymbolTableRecordName = 2,
35+
MlineStyleName = 2,
36+
37+
/** Attribute prompt, dimension post string, description */
38+
AttributePrompt = 3,
39+
Description = 3,
40+
DimPostString = 3,
41+
DimStyleName = 3,
42+
LinetypeProse = 3,
43+
TextFontFile = 3,
44+
45+
/** CL shape name, dimension prefix/suffix, text bigfont file */
46+
CLShapeName = 4,
47+
DimensionAlternativePrefixSuffix = 4,
48+
SymbolTableRecordComments = 4,
49+
TextBigFontFile = 4,
50+
51+
/** Handle or dimension block name */
52+
Handle = 5,
53+
DimensionBlock = 5,
54+
55+
/** Linetype name or dimension block 1 */
56+
LinetypeName = 6,
57+
DimBlk1 = 6,
58+
59+
/** Text style name or dimension block 2 */
60+
TextStyleName = 7,
61+
DimBlk2 = 7,
62+
63+
/** Layer name */
64+
LayerName = 8,
65+
66+
/** CL shape text */
67+
CLShapeText = 9,
68+
69+
/** X coordinate (WCS / OCS depending on context) */
70+
XCoordinate = 10,
71+
72+
/** Y coordinate */
73+
YCoordinate = 20,
74+
75+
/** Z coordinate */
76+
ZCoordinate = 30,
77+
78+
/** Real (double precision floating-point) */
79+
Real = 40,
80+
TxtSize = 40,
81+
ViewportHeight = 40,
82+
83+
/** Angle in degrees */
84+
Angle = 50,
85+
ViewportSnapAngle = 50,
86+
87+
/** Visibility flag */
88+
Visibility = 60,
89+
90+
/** 16-bit integer */
91+
Int16 = 70,
92+
93+
/** 32-bit integer */
94+
Int32 = 90,
95+
96+
/** 64-bit integer */
97+
Int64 = 160,
98+
99+
/** 8-bit integer */
100+
Int8 = 280,
101+
102+
/** Thickness */
103+
Thickness = 0x27,
104+
105+
/** Elevation */
106+
Elevation = 0x26,
107+
108+
/** Line type scale */
109+
LinetypeScale = 0x30,
110+
111+
/** Dash length or MLine offset */
112+
DashLength = 0x31,
113+
MlineOffset = 0x31,
114+
LinetypeElement = 0x31,
115+
116+
/** Normal vector components */
117+
NormalX = 210,
118+
NormalY = 220,
119+
NormalZ = 230,
120+
121+
/** UCS origin */
122+
UcsOrg = 110,
123+
124+
/** UCS orientation vectors */
125+
UcsOrientationX = 0x6f,
126+
UcsOrientationY = 0x70,
127+
128+
/** View parameters */
129+
ViewHeight = 0x2d,
130+
ViewWidth = 0x29,
131+
ViewLensLength = 0x2a,
132+
ViewFrontClip = 0x2b,
133+
ViewBackClip = 0x2c,
134+
ViewBrightness = 0x8d,
135+
ViewContrast = 0x8e,
136+
ViewMode = 0x47,
137+
138+
/** Viewport parameters */
139+
ViewportActive = 0x44,
140+
ViewportAspect = 0x29,
141+
ViewportGrid = 0x4c,
142+
ViewportIcon = 0x4a,
143+
ViewportNumber = 0x45,
144+
ViewportSnap = 0x4b,
145+
ViewportSnapPair = 0x4e,
146+
ViewportSnapStyle = 0x4d,
147+
ViewportTwist = 0x33,
148+
ViewportVisibility = 0x43,
149+
ViewportZoom = 0x49,
150+
151+
/** Color values */
152+
Color = 0x3e,
153+
ColorRgb = 420,
154+
ColorName = 430,
155+
156+
/** Lineweight */
157+
LineWeight = 370,
158+
159+
/** Plot style */
160+
PlotStyleNameType = 380,
161+
PlotStyleNameId = 390,
162+
163+
/** Gradient fill parameters */
164+
GradientObjType = 450,
165+
GradientAngle = 460,
166+
GradientName = 470,
167+
GradientColCount = 0x1c5,
168+
GradientPatType = 0x1c3,
169+
GradientTintType = 0x1c4,
170+
GradientShift = 0x1cd,
171+
GradientColVal = 0x1cf,
172+
GradientTintVal = 0x1ce,
173+
174+
/** Handles and object references */
175+
SoftPointerId = 330,
176+
HardPointerId = 340,
177+
SoftOwnershipId = 350,
178+
HardOwnershipId = 360,
179+
ArbitraryHandle = 320,
180+
181+
/** Extended data (XData) */
182+
ExtendedDataAsciiString = 0x3e8,
183+
ExtendedDataRegAppName = 0x3e9,
184+
ExtendedDataControlString = 0x3ea,
185+
ExtendedDataLayerName = 0x3eb,
186+
ExtendedDataBinaryChunk = 0x3ec,
187+
ExtendedDataHandle = 0x3ed,
188+
ExtendedDataXCoordinate = 0x3f2,
189+
ExtendedDataWorldXCoordinate = 0x3f3,
190+
ExtendedDataWorldXDisp = 0x3f4,
191+
ExtendedDataWorldXDir = 0x3f5,
192+
ExtendedDataYCoordinate = 0x3fc,
193+
ExtendedDataWorldYCoordinate = 0x3fd,
194+
ExtendedDataWorldYDisp = 0x3fe,
195+
ExtendedDataWorldYDir = 0x3ff,
196+
ExtendedDataZCoordinate = 0x406,
197+
ExtendedDataWorldZCoordinate = 0x407,
198+
ExtendedDataWorldZDisp = 0x408,
199+
ExtendedDataWorldZDir = 0x409,
200+
ExtendedDataReal = 0x410,
201+
ExtendedDataDist = 0x411,
202+
ExtendedDataScale = 0x412,
203+
ExtendedDataInteger16 = 0x42e,
204+
ExtendedDataInteger32 = 0x42f,
205+
206+
/** XData helpers */
207+
XTextString = 300,
208+
XReal = 140,
209+
XInt16 = 170,
210+
XXInt16 = 270,
211+
212+
/** Control / structural markers */
213+
Subclass = 100,
214+
ControlString = 0x66,
215+
EmbeddedObjectStart = 0x65,
216+
217+
/** Internal markers */
218+
End = -1,
219+
FirstEntityId = -2,
220+
HeaderId = -2,
221+
XDataStart = -3,
222+
Operator = -4,
223+
PReactors = -5,
224+
XDictionary = -6
225+
}

0 commit comments

Comments
 (0)