QCAD Application Framework
CAD Application Development and Automation.
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
dl_codes.h
Go to the documentation of this file.
1
/****************************************************************************
2
** Copyright (C) 2001-2011 RibbonSoft. All rights reserved.
3
** Copyright (C) 2001 Robert J. Campbell Jr.
4
**
5
** This file is part of the dxflib project.
6
**
7
** This file may be distributed and/or modified under the terms of the
8
** GNU General Public License version 2 as published by the Free Software
9
** Foundation and appearing in the file LICENSE.GPL included in the
10
** packaging of this file.
11
**
12
** Licensees holding valid dxflib Professional Edition licenses may use
13
** this file in accordance with the dxflib Commercial License
14
** Agreement provided with the Software.
15
**
16
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
17
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18
**
19
** See http://www.ribbonsoft.com for further details.
20
**
21
** Contact info@ribbonsoft.com if any conditions of this licensing are
22
** not clear to you.
23
**
24
**********************************************************************/
25
30
#ifndef DXF_CODES_H
31
#define DXF_CODES_H
32
33
#if _MSC_VER > 1000
34
#pragma once
35
#endif // _MSC_VER > 1000
36
37
#if defined(__OS2__)||defined(__EMX__)
38
#define strcasecmp(s,t) stricmp(s,t)
39
#endif
40
41
#if defined(_WIN32)
42
#define strcasecmp(s,t) _stricmp(s,t)
43
#endif
44
45
46
#ifdef _WIN32
47
#undef M_PI
48
#define M_PI 3.14159265358979323846
49
#pragma warning(disable : 4800)
50
#endif
51
52
#ifndef M_PI
53
#define M_PI 3.1415926535897932384626433832795
54
#endif
55
56
#define DL_DXF_MAXLINE 1024
57
#define DL_DXF_MAXGROUPCODE 1100
58
59
// used to mark invalid vectors:
60
//#define DL_DXF_MAXDOUBLE 1.0E+10
61
65
class
DL_Codes
{
66
public
:
70
enum
color
{
71
black
= 250,
72
green
= 3,
73
red
= 1,
74
brown
= 15,
75
yellow
= 2,
76
cyan
= 4,
77
magenta
= 6,
78
gray
= 8,
79
blue
= 5,
80
l_blue
= 163,
81
l_green
= 121,
82
l_cyan
= 131,
83
l_red
= 23,
84
l_magenta
= 221,
85
l_gray
= 252,
86
white
= 7,
87
bylayer
= 256,
88
byblock
= 0
89
};
90
94
enum
version
{
95
AC1009
,
AC1012
,
AC1014
,
AC1015
96
};
97
};
98
99
100
// Extended color palette:
101
// The first entry is only for direct indexing starting with [1]
102
// Color 1 is red (1,0,0)
103
const
double
dxfColors
[][3] = {
104
{0,0,0},
// unused
105
{1,0,0},
// 1
106
{1,1,0},
107
{0,1,0},
108
{0,1,1},
109
{0,0,1},
110
{1,0,1},
111
{1,1,1},
// black or white
112
{0.5,0.5,0.5},
113
{0.75,0.75,0.75},
114
{1,0,0},
// 10
115
{1,0.5,0.5},
116
{0.65,0,0},
117
{0.65,0.325,0.325},
118
{0.5,0,0},
119
{0.5,0.25,0.25},
120
{0.3,0,0},
121
{0.3,0.15,0.15},
122
{0.15,0,0},
123
{0.15,0.075,0.075},
124
{1,0.25,0},
// 20
125
{1,0.625,0.5},
126
{0.65,0.1625,0},
127
{0.65,0.4063,0.325},
128
{0.5,0.125,0},
129
{0.5,0.3125,0.25},
130
{0.3,0.075,0},
131
{0.3,0.1875,0.15},
132
{0.15,0.0375,0},
133
{0.15,0.0938,0.075},
134
{1,0.5,0},
// 30
135
{1,0.75,0.5},
136
{0.65,0.325,0},
137
{0.65,0.4875,0.325},
138
{0.5,0.25,0},
139
{0.5,0.375,0.25},
140
{0.3,0.15,0},
141
{0.3,0.225,0.15},
142
{0.15,0.075,0},
143
{0.15,0.1125,0.075},
144
{1,0.75,0},
// 40
145
{1,0.875,0.5},
146
{0.65,0.4875,0},
147
{0.65,0.5688,0.325},
148
{0.5,0.375,0},
149
{0.5,0.4375,0.25},
150
{0.3,0.225,0},
151
{0.3,0.2625,0.15},
152
{0.15,0.1125,0},
153
{0.15,0.1313,0.075},
154
{1,1,0},
// 50
155
{1,1,0.5},
156
{0.65,0.65,0},
157
{0.65,0.65,0.325},
158
{0.5,0.5,0},
159
{0.5,0.5,0.25},
160
{0.3,0.3,0},
161
{0.3,0.3,0.15},
162
{0.15,0.15,0},
163
{0.15,0.15,0.075},
164
{0.75,1,0},
// 60
165
{0.875,1,0.5},
166
{0.4875,0.65,0},
167
{0.5688,0.65,0.325},
168
{0.375,0.5,0},
169
{0.4375,0.5,0.25},
170
{0.225,0.3,0},
171
{0.2625,0.3,0.15},
172
{0.1125,0.15,0},
173
{0.1313,0.15,0.075},
174
{0.5,1,0},
// 70
175
{0.75,1,0.5},
176
{0.325,0.65,0},
177
{0.4875,0.65,0.325},
178
{0.25,0.5,0},
179
{0.375,0.5,0.25},
180
{0.15,0.3,0},
181
{0.225,0.3,0.15},
182
{0.075,0.15,0},
183
{0.1125,0.15,0.075},
184
{0.25,1,0},
// 80
185
{0.625,1,0.5},
186
{0.1625,0.65,0},
187
{0.4063,0.65,0.325},
188
{0.125,0.5,0},
189
{0.3125,0.5,0.25},
190
{0.075,0.3,0},
191
{0.1875,0.3,0.15},
192
{0.0375,0.15,0},
193
{0.0938,0.15,0.075},
194
{0,1,0},
// 90
195
{0.5,1,0.5},
196
{0,0.65,0},
197
{0.325,0.65,0.325},
198
{0,0.5,0},
199
{0.25,0.5,0.25},
200
{0,0.3,0},
201
{0.15,0.3,0.15},
202
{0,0.15,0},
203
{0.075,0.15,0.075},
204
{0,1,0.25},
// 100
205
{0.5,1,0.625},
206
{0,0.65,0.1625},
207
{0.325,0.65,0.4063},
208
{0,0.5,0.125},
209
{0.25,0.5,0.3125},
210
{0,0.3,0.075},
211
{0.15,0.3,0.1875},
212
{0,0.15,0.0375},
213
{0.075,0.15,0.0938},
214
{0,1,0.5},
// 110
215
{0.5,1,0.75},
216
{0,0.65,0.325},
217
{0.325,0.65,0.4875},
218
{0,0.5,0.25},
219
{0.25,0.5,0.375},
220
{0,0.3,0.15},
221
{0.15,0.3,0.225},
222
{0,0.15,0.075},
223
{0.075,0.15,0.1125},
224
{0,1,0.75},
// 120
225
{0.5,1,0.875},
226
{0,0.65,0.4875},
227
{0.325,0.65,0.5688},
228
{0,0.5,0.375},
229
{0.25,0.5,0.4375},
230
{0,0.3,0.225},
231
{0.15,0.3,0.2625},
232
{0,0.15,0.1125},
233
{0.075,0.15,0.1313},
234
{0,1,1},
// 130
235
{0.5,1,1},
236
{0,0.65,0.65},
237
{0.325,0.65,0.65},
238
{0,0.5,0.5},
239
{0.25,0.5,0.5},
240
{0,0.3,0.3},
241
{0.15,0.3,0.3},
242
{0,0.15,0.15},
243
{0.075,0.15,0.15},
244
{0,0.75,1},
// 140
245
{0.5,0.875,1},
246
{0,0.4875,0.65},
247
{0.325,0.5688,0.65},
248
{0,0.375,0.5},
249
{0.25,0.4375,0.5},
250
{0,0.225,0.3},
251
{0.15,0.2625,0.3},
252
{0,0.1125,0.15},
253
{0.075,0.1313,0.15},
254
{0,0.5,1},
// 150
255
{0.5,0.75,1},
256
{0,0.325,0.65},
257
{0.325,0.4875,0.65},
258
{0,0.25,0.5},
259
{0.25,0.375,0.5},
260
{0,0.15,0.3},
261
{0.15,0.225,0.3},
262
{0,0.075,0.15},
263
{0.075,0.1125,0.15},
264
{0,0.25,1},
// 160
265
{0.5,0.625,1},
266
{0,0.1625,0.65},
267
{0.325,0.4063,0.65},
268
{0,0.125,0.5},
269
{0.25,0.3125,0.5},
270
{0,0.075,0.3},
271
{0.15,0.1875,0.3},
272
{0,0.0375,0.15},
273
{0.075,0.0938,0.15},
274
{0,0,1},
// 170
275
{0.5,0.5,1},
276
{0,0,0.65},
277
{0.325,0.325,0.65},
278
{0,0,0.5},
279
{0.25,0.25,0.5},
280
{0,0,0.3},
281
{0.15,0.15,0.3},
282
{0,0,0.15},
283
{0.075,0.075,0.15},
284
{0.25,0,1},
// 180
285
{0.625,0.5,1},
286
{0.1625,0,0.65},
287
{0.4063,0.325,0.65},
288
{0.125,0,0.5},
289
{0.3125,0.25,0.5},
290
{0.075,0,0.3},
291
{0.1875,0.15,0.3},
292
{0.0375,0,0.15},
293
{0.0938,0.075,0.15},
294
{0.5,0,1},
// 190
295
{0.75,0.5,1},
296
{0.325,0,0.65},
297
{0.4875,0.325,0.65},
298
{0.25,0,0.5},
299
{0.375,0.25,0.5},
300
{0.15,0,0.3},
301
{0.225,0.15,0.3},
302
{0.075,0,0.15},
303
{0.1125,0.075,0.15},
304
{0.75,0,1},
// 200
305
{0.875,0.5,1},
306
{0.4875,0,0.65},
307
{0.5688,0.325,0.65},
308
{0.375,0,0.5},
309
{0.4375,0.25,0.5},
310
{0.225,0,0.3},
311
{0.2625,0.15,0.3},
312
{0.1125,0,0.15},
313
{0.1313,0.075,0.15},
314
{1,0,1},
// 210
315
{1,0.5,1},
316
{0.65,0,0.65},
317
{0.65,0.325,0.65},
318
{0.5,0,0.5},
319
{0.5,0.25,0.5},
320
{0.3,0,0.3},
321
{0.3,0.15,0.3},
322
{0.15,0,0.15},
323
{0.15,0.075,0.15},
324
{1,0,0.75},
// 220
325
{1,0.5,0.875},
326
{0.65,0,0.4875},
327
{0.65,0.325,0.5688},
328
{0.5,0,0.375},
329
{0.5,0.25,0.4375},
330
{0.3,0,0.225},
331
{0.3,0.15,0.2625},
332
{0.15,0,0.1125},
333
{0.15,0.075,0.1313},
334
{1,0,0.5},
// 230
335
{1,0.5,0.75},
336
{0.65,0,0.325},
337
{0.65,0.325,0.4875},
338
{0.5,0,0.25},
339
{0.5,0.25,0.375},
340
{0.3,0,0.15},
341
{0.3,0.15,0.225},
342
{0.15,0,0.075},
343
{0.15,0.075,0.1125},
344
{1,0,0.25},
// 240
345
{1,0.5,0.625},
346
{0.65,0,0.1625},
347
{0.65,0.325,0.4063},
348
{0.5,0,0.125},
349
{0.5,0.25,0.3125},
350
{0.3,0,0.075},
351
{0.3,0.15,0.1875},
352
{0.15,0,0.0375},
353
{0.15,0.075,0.0938},
354
{0.33,0.33,0.33},
// 250
355
{0.464,0.464,0.464},
356
{0.598,0.598,0.598},
357
{0.732,0.732,0.732},
358
{0.866,0.866,0.866},
359
{1,1,1}
// 255
360
}
361
;
362
363
364
// AutoCAD VERSION aliases
365
#define DL_VERSION_R12 DL_Codes::AC1009
366
#define DL_VERSION_LT2 DL_Codes::AC1009
367
#define DL_VERSION_R13 DL_Codes::AC1012 // not supported yet
368
#define DL_VERSION_LT95 DL_Codes::AC1012 // not supported yet
369
#define DL_VERSION_R14 DL_Codes::AC1014 // not supported yet
370
#define DL_VERSION_LT97 DL_Codes::AC1014 // not supported yet
371
#define DL_VERSION_LT98 DL_Codes::AC1014 // not supported yet
372
#define DL_VERSION_2000 DL_Codes::AC1015
373
#define DL_VERSION_2002 DL_Codes::AC1015
374
375
376
// DXF Group Codes:
377
378
// Strings
379
#define DL_STRGRP_START 0
380
#define DL_STRGRP_END 9
381
382
// Coordinates
383
#define DL_CRDGRP_START 10
384
#define DL_CRDGRP_END 19
385
386
// Real values
387
#define DL_RLGRP_START 38
388
#define DL_RLGRP_END 59
389
390
// Short integer values
391
#define DL_SHOGRP_START 60
392
#define DL_SHOGRP_END 79
393
394
// New in Release 13,
395
#define DL_SUBCLASS 100
396
397
// More coordinates
398
#define DL_CRD2GRP_START 210
399
#define DL_CRD2GRP_END 239
400
401
// Extended data strings
402
#define DL_ESTRGRP_START 1000
403
#define DL_ESTRGRP_END 1009
404
405
// Extended data reals
406
#define DL_ERLGRP_START 1010
407
#define DL_ERLGRP_END 1059
408
409
410
#define DL_Y8_COORD_CODE 28
411
#define DL_Z0_COORD_CODE 30
412
#define DL_Z8_COORD_CODE 38
413
414
#define DL_POINT_COORD_CODE 10
415
#define DL_INSERT_COORD_CODE 10
416
417
#define DL_CRD2GRP_START 210
418
#define DL_CRD2GRP_END 239
419
420
#define DL_THICKNESS 39
421
#define DL_FIRST_REAL_CODE THICKNESS
422
#define DL_LAST_REAL_CODE 59
423
#define DL_FIRST_INT_CODE 60
424
#define DL_ATTFLAGS_CODE 70
425
#define DL_PLINE_FLAGS_CODE 70
426
#define DL_LAYER_FLAGS_CODE 70
427
#define DL_FLD_LEN_CODE 73 // Inside ATTRIB resbuf
428
#define DL_LAST_INT_CODE 79
429
#define DL_X_EXTRU_CODE 210
430
#define DL_Y_EXTRU_CODE 220
431
#define DL_Z_EXTRU_CODE 230
432
#define DL_COMMENT_CODE 999
433
434
// Start and endpoints of a line
435
#define DL_LINE_START_CODE 10 // Followed by x coord
436
#define DL_LINE_END_CODE 11 // Followed by x coord
437
438
// Some codes used by blocks
439
#define DL_BLOCK_FLAGS_CODE 70 // An int containing flags
440
#define DL_BLOCK_BASE_CODE 10 // Origin of block definition
441
#define DL_XREF_DEPENDENT 16 // If a block contains an XREF
442
#define DL_XREF_RESOLVED 32 // If a XREF resolved ok
443
#define DL_REFERENCED 64 // If a block is ref'd in DWG
444
445
#define DL_XSCALE_CODE 41
446
#define DL_YSCALE_CODE 42
447
#define DL_ANGLE_CODE 50
448
#define DL_INS_POINT_CODE 10 // Followed by x of ins pnt
449
#define DL_NAME2_CODE 3 // Second appearance of name
450
451
// Some codes used by circle entities
452
#define DL_CENTER_CODE 10 // Followed by x of center
453
#define DL_RADIUS_CODE 40 // Followd by radius of circle
454
455
#define DL_COND_OP_CODE -4 // Conditional op,ads_ssget
456
457
// When using ads_buildlist you MUST use RTDXF0 instead of these
458
#define DL_ENTITY_TYPE_CODE 0 // Then there is LINE, 3DFACE..
459
#define DL_SES_CODE 0 // Start End String Code
460
#define DL_FILE_SEP_CODE 0 // File separator
461
#define DL_SOT_CODE 0 // Start Of Table
462
#define DL_TEXTVAL_CODE 1
463
#define DL_NAME_CODE 2
464
#define DL_BLOCK_NAME_CODE 2
465
#define DL_SECTION_NAME_CODE 2
466
#define DL_ENT_HAND_CODE 5 // What follows is hexa string
467
#define DL_TXT_STYLE_CODE 7 // Inside attributes
468
#define DL_LAYER_NAME_CODE 8 // What follows is layer name
469
#define DL_FIRST_XCOORD_CODE 10 // Group code x of 1st coord
470
#define DL_FIRST_YCOORD_CODE 20 // Group code y of 1st coord
471
#define DL_FIRST_ZCOORD_CODE 30 // Group code z of 1st coord
472
#define DL_L_START_CODE 10
473
#define DL_L_END_CODE 11
474
#define DL_TXTHI_CODE 40
475
#define DL_SCALE_X_CODE 41
476
#define DL_SCALE_Y_CODE 42
477
#define DL_SCALE_Z_CODE 43
478
#define DL_BULGE_CODE 42 // Used in PLINE verts for arcs
479
#define DL_ROTATION_CODE 50
480
#define DL_COLOUR_CODE 62 // What follows is a color int
481
#define DL_LTYPE_CODE 6 // What follows is a linetype
482
483
484
// Attribute flags
485
#define DL_ATTS_FOLLOW_CODE 66
486
#define DL_ATT_TAG_CODE 2
487
#define DL_ATT_VAL_CODE 1
488
#define DL_ATT_FLAGS_CODE 70 // 4 1 bit flags as follows...
489
#define DL_ATT_INVIS_FLAG 1
490
#define DL_ATT_CONST_FLAG 2
491
#define DL_ATT_VERIFY_FLAG 4 // Prompt and verify
492
#define DL_ATT_PRESET_FLAG 8 // No prompt and no verify
493
494
// PLINE defines
495
// Flags
496
#define DL_OPEN_PLINE 0x00
497
#define DL_CLOSED_PLINE 0x01
498
#define DL_POLYLINE3D 0x80
499
#define DL_PFACE_MESH 0x40
500
#define DL_PGON_MESH 0x10
501
// Vertices follow entity, required in POLYLINES
502
#define DL_VERTS_FOLLOW_CODE 66 // Value should always be 1
503
#define DL_VERTEX_COORD_CODE 10
504
505
506
// LAYER flags
507
#define DL_FROZEN 1
508
#define DL_FROZEN_BY_DEF 2
509
#define DL_LOCKED 4
510
#define DL_OBJECT_USED 64 // Object is ref'd in the dwg
511
512
#define DL_BLOCK_EN_CODE -2 // Block entity definition
513
#define DL_E_NAME -1 // Entity name
514
515
// Extended data codes
516
#define DL_EXTD_SENTINEL (-3)
517
#define DL_EXTD_STR 1000
518
#define DL_EXTD_APP_NAME 1001
519
#define DL_EXTD_CTL_STR 1002
520
#define DL_EXTD_LYR_STR 1003
521
#define DL_EXTD_CHUNK 1004
522
#define DL_EXTD_HANDLE 1005
523
#define DL_EXTD_POINT 1010
524
#define DL_EXTD_POS 1011
525
#define DL_EXTD_DISP 1012
526
#define DL_EXTD_DIR 1013
527
#define DL_EXTD_FLOAT 1040
528
#define DL_EXTD_DIST 1041
529
#define DL_EXTD_SCALE 1042
530
#define DL_EXTD_INT16 1070
531
#define DL_EXTD_INT32 1071
532
533
// UCS codes for use in ads_trans
534
#define DL_WCS_TRANS_CODE 0
535
#define DL_UCS_TRANS_CODE 1
536
#define DL_DCS_TRANS_CODE 2
537
#define DL_PCS_TRANS_CODE 3
538
539
#endif
540
src
io
dxf
dxflib
src
dl_codes.h
Generated on Tue Jun 26 2012 18:41:08 for QCAD Application Framework by
1.8.1.1