1 /****************************************************************************
2 ** $Id: dl_codes.h 273 2005-02-28 18:14:39Z andrew $
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
5 ** Copyright (C) 2001 Robert J. Campbell Jr.
7 ** This file is part of the dxflib project.
9 ** This file may be distributed and/or modified under the terms of the
10 ** GNU General Public License version 2 as published by the Free Software
11 ** Foundation and appearing in the file LICENSE.GPL included in the
12 ** packaging of this file.
14 ** Licensees holding valid dxflib Professional Edition licenses may use
15 ** this file in accordance with the dxflib Commercial License
16 ** Agreement provided with the Software.
18 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
19 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 ** See http://www.ribbonsoft.com for further details.
23 ** Contact info@ribbonsoft.com if any conditions of this licensing are
26 **********************************************************************/
29 * Defines common DXF codes and constants.
37 #endif // _MSC_VER > 1000
39 #if defined(__OS2__)||defined(__EMX__)||defined(_WIN32)
40 #define strcasecmp(s,t) stricmp(s,t)
45 #define M_PI 3.14159265358979323846
46 #pragma warning(disable : 4800)
50 #define M_PI 3.1415926535897932384626433832795
53 #define DL_DXF_MAXLINE 1024
54 #define DL_DXF_MAXGROUPCODE 1100
56 // used to mark invalid vectors:
57 //#define DL_DXF_MAXDOUBLE 1.0E+10
60 * Codes for colors and DXF versions.
65 * Standard DXF colors.
89 * Version numbers for the DXF Format.
92 AC1009, AC1012, AC1014, AC1015
97 // Extended color palette:
98 // The first entry is only for direct indexing starting with [1]
99 // Color 1 is red (1,0,0)
100 const double dxfColors[][3] = {
108 {1,1,1}, // black or white
351 {0.33,0.33,0.33}, // 250
361 // AutoCAD VERSION aliases
362 #define VER_R12 DL_Codes::AC1009
363 #define VER_LT2 DL_Codes::AC1009
364 #define VER_R13 DL_Codes::AC1012 // not supported yet
365 #define VER_LT95 DL_Codes::AC1012 // not supported yet
366 #define VER_R14 DL_Codes::AC1014 // not supported yet
367 #define VER_LT97 DL_Codes::AC1014 // not supported yet
368 #define VER_LT98 DL_Codes::AC1014 // not supported yet
369 #define VER_2000 DL_Codes::AC1015
370 #define VER_2002 DL_Codes::AC1015
376 #define STRGRP_START 0
380 #define CRDGRP_START 10
381 #define CRDGRP_END 19
384 #define RLGRP_START 38
387 // Short integer values
388 #define SHOGRP_START 60
389 #define SHOGRP_END 79
391 // New in Release 13,
395 #define CRD2GRP_START 210
396 #define CRD2GRP_END 239
398 // Extended data strings
399 #define ESTRGRP_START 1000
400 #define ESTRGRP_END 1009
402 // Extended data reals
403 #define ERLGRP_START 1010
404 #define ERLGRP_END 1059
407 #define Y8_COORD_CODE 28
408 #define Z0_COORD_CODE 30
409 #define Z8_COORD_CODE 38
411 #define POINT_COORD_CODE 10
412 #define INSERT_COORD_CODE 10
414 #define CRD2GRP_START 210
415 #define CRD2GRP_END 239
418 #define FIRST_REAL_CODE THICKNESS
419 #define LAST_REAL_CODE 59
420 #define FIRST_INT_CODE 60
421 #define ATTFLAGS_CODE 70
422 #define PLINE_FLAGS_CODE 70
423 #define LAYER_FLAGS_CODE 70
424 #define FLD_LEN_CODE 73 // Inside ATTRIB resbuf
425 #define LAST_INT_CODE 79
426 #define X_EXTRU_CODE 210
427 #define Y_EXTRU_CODE 220
428 #define Z_EXTRU_CODE 230
429 #define COMMENT_CODE 999
431 // Start and endpoints of a line
432 #define LINE_START_CODE 10 // Followed by x coord
433 #define LINE_END_CODE 11 // Followed by x coord
435 // Some codes used by blocks
436 #define BLOCK_FLAGS_CODE 70 // An int containing flags
437 #define BLOCK_BASE_CODE 10 // Origin of block definition
438 #define XREF_DEPENDENT 16 // If a block contains an XREF
439 #define XREF_RESOLVED 32 // If a XREF resolved ok
440 #define REFERENCED 64 // If a block is ref'd in DWG
442 #define XSCALE_CODE 41
443 #define YSCALE_CODE 42
444 #define ANGLE_CODE 50
445 #define INS_POINT_CODE 10 // Followed by x of ins pnt
446 #define NAME2_CODE 3 // Second appearance of name
448 // Some codes used by circle entities
449 #define CENTER_CODE 10 // Followed by x of center
450 #define RADIUS_CODE 40 // Followd by radius of circle
452 #define COND_OP_CODE -4 // Conditional op,ads_ssget
454 // When using ads_buildlist you MUST use RTDXF0 instead of these
455 #define ENTITY_TYPE_CODE 0 // Then there is LINE, 3DFACE..
456 #define SES_CODE 0 // Start End String Code
457 #define FILE_SEP_CODE 0 // File separator
458 #define SOT_CODE 0 // Start Of Table
459 #define TEXTVAL_CODE 1
461 #define BLOCK_NAME_CODE 2
462 #define SECTION_NAME_CODE 2
463 #define ENT_HAND_CODE 5 // What follows is hexa string
464 #define TXT_STYLE_CODE 7 // Inside attributes
465 #define LAYER_NAME_CODE 8 // What follows is layer name
466 #define FIRST_XCOORD_CODE 10 // Group code x of 1st coord
467 #define FIRST_YCOORD_CODE 20 // Group code y of 1st coord
468 #define FIRST_ZCOORD_CODE 30 // Group code z of 1st coord
469 #define L_START_CODE 10
470 #define L_END_CODE 11
471 #define TXTHI_CODE 40
472 #define SCALE_X_CODE 41
473 #define SCALE_Y_CODE 42
474 #define SCALE_Z_CODE 43
475 #define BULGE_CODE 42 // Used in PLINE verts for arcs
476 #define ROTATION_CODE 50
477 #define COLOUR_CODE 62 // What follows is a color int
478 #define LTYPE_CODE 6 // What follows is a linetype
482 #define ATTS_FOLLOW_CODE 66
483 #define ATT_TAG_CODE 2
484 #define ATT_VAL_CODE 1
485 #define ATT_FLAGS_CODE 70 // 4 1 bit flags as follows...
486 #define ATT_INVIS_FLAG 1
487 #define ATT_CONST_FLAG 2
488 #define ATT_VERIFY_FLAG 4 // Prompt and verify
489 #define ATT_PRESET_FLAG 8 // No prompt and no verify
493 #define OPEN_PLINE 0x00
494 #define CLOSED_PLINE 0x01
495 #define POLYLINE3D 0x80
496 #define PFACE_MESH 0x40
497 #define PGON_MESH 0x10
498 // Vertices follow entity, required in POLYLINES
499 #define VERTS_FOLLOW_CODE 66 // Value should always be 1
500 #define VERTEX_COORD_CODE 10
505 #define FROZEN_BY_DEF 2
507 #define OBJECT_USED 64 // Object is ref'd in the dwg
509 #define BLOCK_EN_CODE -2 // Block entity definition
510 #define E_NAME -1 // Entity name
512 // Extended data codes
513 #define EXTD_SENTINEL (-3)
514 #define EXTD_STR 1000
515 #define EXTD_APP_NAME 1001
516 #define EXTD_CTL_STR 1002
517 #define EXTD_LYR_STR 1003
518 #define EXTD_CHUNK 1004
519 #define EXTD_HANDLE 1005
520 #define EXTD_POINT 1010
521 #define EXTD_POS 1011
522 #define EXTD_DISP 1012
523 #define EXTD_DIR 1013
524 #define EXTD_FLOAT 1040
525 #define EXTD_DIST 1041
526 #define EXTD_SCALE 1042
527 #define EXTD_INT16 1070
528 #define EXTD_INT32 1071
530 // UCS codes for use in ads_trans
531 #define WCS_TRANS_CODE 0
532 #define UCS_TRANS_CODE 1
533 #define DCS_TRANS_CODE 2
534 #define PCS_TRANS_CODE 3