Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

dl_codes.h

00001 /****************************************************************************
00002 ** $Id: dl_codes.h 3591 2006-10-18 21:23:25Z andrew $
00003 **
00004 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
00005 ** Copyright (C) 2001 Robert J. Campbell Jr.
00006 **
00007 ** This file is part of the dxflib project.
00008 **
00009 ** This file may be distributed and/or modified under the terms of the
00010 ** GNU General Public License version 2 as published by the Free Software
00011 ** Foundation and appearing in the file LICENSE.GPL included in the
00012 ** packaging of this file.
00013 **
00014 ** Licensees holding valid dxflib Professional Edition licenses may use 
00015 ** this file in accordance with the dxflib Commercial License
00016 ** Agreement provided with the Software.
00017 **
00018 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00019 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00020 **
00021 ** See http://www.ribbonsoft.com for further details.
00022 **
00023 ** Contact [email protected] if any conditions of this licensing are
00024 ** not clear to you.
00025 **
00026 **********************************************************************/
00027 
00032 #ifndef DXF_CODES_H
00033 #define DXF_CODES_H
00034 
00035 #if _MSC_VER > 1000
00036 #pragma once
00037 #endif // _MSC_VER > 1000
00038 
00039 #if defined(__OS2__)||defined(__EMX__)||defined(_WIN32)
00040 #define strcasecmp(s,t) stricmp(s,t)
00041 #endif
00042 
00043 #ifdef _WIN32
00044 #undef M_PI
00045 #define M_PI   3.14159265358979323846
00046 #pragma warning(disable : 4800)
00047 #endif
00048 
00049 #ifndef M_PI
00050 #define M_PI 3.1415926535897932384626433832795
00051 #endif
00052 
00053 #define DL_DXF_MAXLINE 1024
00054 #define DL_DXF_MAXGROUPCODE 1100
00055 
00056 // used to mark invalid vectors:
00057 //#define DL_DXF_MAXDOUBLE 1.0E+10
00058 
00062 class DL_Codes {
00063 public:
00067     enum color {
00068         black = 250,
00069         green = 3,
00070         red = 1,
00071         brown = 15,
00072         yellow = 2,
00073         cyan = 4,
00074         magenta = 6,
00075         gray = 8,
00076         blue = 5,
00077         l_blue = 163,
00078         l_green = 121,
00079         l_cyan = 131,
00080         l_red = 23,
00081         l_magenta = 221,
00082         l_gray = 252,
00083         white = 7,
00084         bylayer = 256,
00085         byblock = 0
00086     };
00087 
00091     enum version {
00092         AC1009, AC1012, AC1014, AC1015
00093     };
00094 };
00095 
00096 
00097 // Extended color palette:
00098 // The first entry is only for direct indexing starting with [1]
00099 // Color 1 is red (1,0,0)
00100 const double dxfColors[][3] = {
00101                                   {0,0,0},                // unused
00102                                   {1,0,0},                // 1
00103                                   {1,1,0},
00104                                   {0,1,0},
00105                                   {0,1,1},
00106                                   {0,0,1},
00107                                   {1,0,1},
00108                                   {1,1,1},                // black or white
00109                                   {0.5,0.5,0.5},
00110                                   {0.75,0.75,0.75},
00111                                   {1,0,0},                // 10
00112                                   {1,0.5,0.5},
00113                                   {0.65,0,0},
00114                                   {0.65,0.325,0.325},
00115                                   {0.5,0,0},
00116                                   {0.5,0.25,0.25},
00117                                   {0.3,0,0},
00118                                   {0.3,0.15,0.15},
00119                                   {0.15,0,0},
00120                                   {0.15,0.075,0.075},
00121                                   {1,0.25,0},             // 20
00122                                   {1,0.625,0.5},
00123                                   {0.65,0.1625,0},
00124                                   {0.65,0.4063,0.325},
00125                                   {0.5,0.125,0},
00126                                   {0.5,0.3125,0.25},
00127                                   {0.3,0.075,0},
00128                                   {0.3,0.1875,0.15},
00129                                   {0.15,0.0375,0},
00130                                   {0.15,0.0938,0.075},
00131                                   {1,0.5,0},              // 30
00132                                   {1,0.75,0.5},
00133                                   {0.65,0.325,0},
00134                                   {0.65,0.4875,0.325},
00135                                   {0.5,0.25,0},
00136                                   {0.5,0.375,0.25},
00137                                   {0.3,0.15,0},
00138                                   {0.3,0.225,0.15},
00139                                   {0.15,0.075,0},
00140                                   {0.15,0.1125,0.075},
00141                                   {1,0.75,0},             // 40
00142                                   {1,0.875,0.5},
00143                                   {0.65,0.4875,0},
00144                                   {0.65,0.5688,0.325},
00145                                   {0.5,0.375,0},
00146                                   {0.5,0.4375,0.25},
00147                                   {0.3,0.225,0},
00148                                   {0.3,0.2625,0.15},
00149                                   {0.15,0.1125,0},
00150                                   {0.15,0.1313,0.075},
00151                                   {1,1,0},                // 50
00152                                   {1,1,0.5},
00153                                   {0.65,0.65,0},
00154                                   {0.65,0.65,0.325},
00155                                   {0.5,0.5,0},
00156                                   {0.5,0.5,0.25},
00157                                   {0.3,0.3,0},
00158                                   {0.3,0.3,0.15},
00159                                   {0.15,0.15,0},
00160                                   {0.15,0.15,0.075},
00161                                   {0.75,1,0},             // 60
00162                                   {0.875,1,0.5},
00163                                   {0.4875,0.65,0},
00164                                   {0.5688,0.65,0.325},
00165                                   {0.375,0.5,0},
00166                                   {0.4375,0.5,0.25},
00167                                   {0.225,0.3,0},
00168                                   {0.2625,0.3,0.15},
00169                                   {0.1125,0.15,0},
00170                                   {0.1313,0.15,0.075},
00171                                   {0.5,1,0},              // 70
00172                                   {0.75,1,0.5},
00173                                   {0.325,0.65,0},
00174                                   {0.4875,0.65,0.325},
00175                                   {0.25,0.5,0},
00176                                   {0.375,0.5,0.25},
00177                                   {0.15,0.3,0},
00178                                   {0.225,0.3,0.15},
00179                                   {0.075,0.15,0},
00180                                   {0.1125,0.15,0.075},
00181                                   {0.25,1,0},             // 80
00182                                   {0.625,1,0.5},
00183                                   {0.1625,0.65,0},
00184                                   {0.4063,0.65,0.325},
00185                                   {0.125,0.5,0},
00186                                   {0.3125,0.5,0.25},
00187                                   {0.075,0.3,0},
00188                                   {0.1875,0.3,0.15},
00189                                   {0.0375,0.15,0},
00190                                   {0.0938,0.15,0.075},
00191                                   {0,1,0},                // 90
00192                                   {0.5,1,0.5},
00193                                   {0,0.65,0},
00194                                   {0.325,0.65,0.325},
00195                                   {0,0.5,0},
00196                                   {0.25,0.5,0.25},
00197                                   {0,0.3,0},
00198                                   {0.15,0.3,0.15},
00199                                   {0,0.15,0},
00200                                   {0.075,0.15,0.075},
00201                                   {0,1,0.25},             // 100
00202                                   {0.5,1,0.625},
00203                                   {0,0.65,0.1625},
00204                                   {0.325,0.65,0.4063},
00205                                   {0,0.5,0.125},
00206                                   {0.25,0.5,0.3125},
00207                                   {0,0.3,0.075},
00208                                   {0.15,0.3,0.1875},
00209                                   {0,0.15,0.0375},
00210                                   {0.075,0.15,0.0938},
00211                                   {0,1,0.5},              // 110
00212                                   {0.5,1,0.75},
00213                                   {0,0.65,0.325},
00214                                   {0.325,0.65,0.4875},
00215                                   {0,0.5,0.25},
00216                                   {0.25,0.5,0.375},
00217                                   {0,0.3,0.15},
00218                                   {0.15,0.3,0.225},
00219                                   {0,0.15,0.075},
00220                                   {0.075,0.15,0.1125},
00221                                   {0,1,0.75},             // 120
00222                                   {0.5,1,0.875},
00223                                   {0,0.65,0.4875},
00224                                   {0.325,0.65,0.5688},
00225                                   {0,0.5,0.375},
00226                                   {0.25,0.5,0.4375},
00227                                   {0,0.3,0.225},
00228                                   {0.15,0.3,0.2625},
00229                                   {0,0.15,0.1125},
00230                                   {0.075,0.15,0.1313},
00231                                   {0,1,1},                // 130
00232                                   {0.5,1,1},
00233                                   {0,0.65,0.65},
00234                                   {0.325,0.65,0.65},
00235                                   {0,0.5,0.5},
00236                                   {0.25,0.5,0.5},
00237                                   {0,0.3,0.3},
00238                                   {0.15,0.3,0.3},
00239                                   {0,0.15,0.15},
00240                                   {0.075,0.15,0.15},
00241                                   {0,0.75,1},             // 140
00242                                   {0.5,0.875,1},
00243                                   {0,0.4875,0.65},
00244                                   {0.325,0.5688,0.65},
00245                                   {0,0.375,0.5},
00246                                   {0.25,0.4375,0.5},
00247                                   {0,0.225,0.3},
00248                                   {0.15,0.2625,0.3},
00249                                   {0,0.1125,0.15},
00250                                   {0.075,0.1313,0.15},
00251                                   {0,0.5,1},              // 150
00252                                   {0.5,0.75,1},
00253                                   {0,0.325,0.65},
00254                                   {0.325,0.4875,0.65},
00255                                   {0,0.25,0.5},
00256                                   {0.25,0.375,0.5},
00257                                   {0,0.15,0.3},
00258                                   {0.15,0.225,0.3},
00259                                   {0,0.075,0.15},
00260                                   {0.075,0.1125,0.15},
00261                                   {0,0.25,1},             // 160
00262                                   {0.5,0.625,1},
00263                                   {0,0.1625,0.65},
00264                                   {0.325,0.4063,0.65},
00265                                   {0,0.125,0.5},
00266                                   {0.25,0.3125,0.5},
00267                                   {0,0.075,0.3},
00268                                   {0.15,0.1875,0.3},
00269                                   {0,0.0375,0.15},
00270                                   {0.075,0.0938,0.15},
00271                                   {0,0,1},                // 170
00272                                   {0.5,0.5,1},
00273                                   {0,0,0.65},
00274                                   {0.325,0.325,0.65},
00275                                   {0,0,0.5},
00276                                   {0.25,0.25,0.5},
00277                                   {0,0,0.3},
00278                                   {0.15,0.15,0.3},
00279                                   {0,0,0.15},
00280                                   {0.075,0.075,0.15},
00281                                   {0.25,0,1},             // 180
00282                                   {0.625,0.5,1},
00283                                   {0.1625,0,0.65},
00284                                   {0.4063,0.325,0.65},
00285                                   {0.125,0,0.5},
00286                                   {0.3125,0.25,0.5},
00287                                   {0.075,0,0.3},
00288                                   {0.1875,0.15,0.3},
00289                                   {0.0375,0,0.15},
00290                                   {0.0938,0.075,0.15},
00291                                   {0.5,0,1},              // 190
00292                                   {0.75,0.5,1},
00293                                   {0.325,0,0.65},
00294                                   {0.4875,0.325,0.65},
00295                                   {0.25,0,0.5},
00296                                   {0.375,0.25,0.5},
00297                                   {0.15,0,0.3},
00298                                   {0.225,0.15,0.3},
00299                                   {0.075,0,0.15},
00300                                   {0.1125,0.075,0.15},
00301                                   {0.75,0,1},             // 200
00302                                   {0.875,0.5,1},
00303                                   {0.4875,0,0.65},
00304                                   {0.5688,0.325,0.65},
00305                                   {0.375,0,0.5},
00306                                   {0.4375,0.25,0.5},
00307                                   {0.225,0,0.3},
00308                                   {0.2625,0.15,0.3},
00309                                   {0.1125,0,0.15},
00310                                   {0.1313,0.075,0.15},
00311                                   {1,0,1},                // 210
00312                                   {1,0.5,1},
00313                                   {0.65,0,0.65},
00314                                   {0.65,0.325,0.65},
00315                                   {0.5,0,0.5},
00316                                   {0.5,0.25,0.5},
00317                                   {0.3,0,0.3},
00318                                   {0.3,0.15,0.3},
00319                                   {0.15,0,0.15},
00320                                   {0.15,0.075,0.15},
00321                                   {1,0,0.75},             // 220
00322                                   {1,0.5,0.875},
00323                                   {0.65,0,0.4875},
00324                                   {0.65,0.325,0.5688},
00325                                   {0.5,0,0.375},
00326                                   {0.5,0.25,0.4375},
00327                                   {0.3,0,0.225},
00328                                   {0.3,0.15,0.2625},
00329                                   {0.15,0,0.1125},
00330                                   {0.15,0.075,0.1313},
00331                                   {1,0,0.5},              // 230
00332                                   {1,0.5,0.75},
00333                                   {0.65,0,0.325},
00334                                   {0.65,0.325,0.4875},
00335                                   {0.5,0,0.25},
00336                                   {0.5,0.25,0.375},
00337                                   {0.3,0,0.15},
00338                                   {0.3,0.15,0.225},
00339                                   {0.15,0,0.075},
00340                                   {0.15,0.075,0.1125},
00341                                   {1,0,0.25},             // 240
00342                                   {1,0.5,0.625},
00343                                   {0.65,0,0.1625},
00344                                   {0.65,0.325,0.4063},
00345                                   {0.5,0,0.125},
00346                                   {0.5,0.25,0.3125},
00347                                   {0.3,0,0.075},
00348                                   {0.3,0.15,0.1875},
00349                                   {0.15,0,0.0375},
00350                                   {0.15,0.075,0.0938},
00351                                   {0.33,0.33,0.33},       // 250
00352                                   {0.464,0.464,0.464},
00353                                   {0.598,0.598,0.598},
00354                                   {0.732,0.732,0.732},
00355                                   {0.866,0.866,0.866},
00356                                   {1,1,1}                 // 255
00357                               }
00358                               ;
00359 
00360 
00361 // AutoCAD VERSION aliases
00362 #define VER_R12    DL_Codes::AC1009
00363 #define VER_LT2    DL_Codes::AC1009
00364 #define VER_R13    DL_Codes::AC1012   // not supported yet
00365 #define VER_LT95   DL_Codes::AC1012   // not supported yet
00366 #define VER_R14    DL_Codes::AC1014   // not supported yet
00367 #define VER_LT97   DL_Codes::AC1014   // not supported yet
00368 #define VER_LT98   DL_Codes::AC1014   // not supported yet
00369 #define VER_2000   DL_Codes::AC1015
00370 #define VER_2002   DL_Codes::AC1015
00371 
00372 
00373 // DXF Group Codes:
00374 
00375 // Strings
00376 #define STRGRP_START      0
00377 #define STRGRP_END        9
00378 
00379 // Coordinates
00380 #define CRDGRP_START     10
00381 #define CRDGRP_END       19
00382 
00383 // Real values
00384 #define RLGRP_START      38
00385 #define RLGRP_END        59
00386 
00387 // Short integer values
00388 #define SHOGRP_START     60
00389 #define SHOGRP_END       79
00390 
00391 // New in Release 13,
00392 #define SUBCLASS        100
00393 
00394 // More coordinates
00395 #define CRD2GRP_START   210
00396 #define CRD2GRP_END     239
00397 
00398 // Extended data strings
00399 #define ESTRGRP_START  1000
00400 #define ESTRGRP_END    1009
00401 
00402 // Extended data reals
00403 #define ERLGRP_START   1010
00404 #define ERLGRP_END     1059
00405 
00406 
00407 #define Y8_COORD_CODE       28
00408 #define Z0_COORD_CODE       30
00409 #define Z8_COORD_CODE       38
00410 
00411 #define POINT_COORD_CODE    10
00412 #define INSERT_COORD_CODE   10
00413 
00414 #define CRD2GRP_START      210
00415 #define CRD2GRP_END        239
00416 
00417 #define THICKNESS            39
00418 #define FIRST_REAL_CODE      THICKNESS
00419 #define LAST_REAL_CODE       59
00420 #define FIRST_INT_CODE       60
00421 #define ATTFLAGS_CODE        70
00422 #define PLINE_FLAGS_CODE     70
00423 #define LAYER_FLAGS_CODE     70
00424 #define FLD_LEN_CODE         73 // Inside ATTRIB resbuf
00425 #define LAST_INT_CODE        79
00426 #define X_EXTRU_CODE        210
00427 #define Y_EXTRU_CODE        220
00428 #define Z_EXTRU_CODE        230
00429 #define COMMENT_CODE        999
00430 
00431 // Start and endpoints of a line
00432 #define LINE_START_CODE      10  // Followed by x coord
00433 #define LINE_END_CODE        11  // Followed by x coord
00434 
00435 // Some codes used by blocks
00436 #define BLOCK_FLAGS_CODE     70  // An int containing flags
00437 #define BLOCK_BASE_CODE      10  // Origin of block definition
00438 #define XREF_DEPENDENT       16  // If a block contains an XREF
00439 #define XREF_RESOLVED        32  // If a XREF resolved ok
00440 #define REFERENCED           64  // If a block is ref'd in DWG
00441 
00442 #define XSCALE_CODE          41
00443 #define YSCALE_CODE          42
00444 #define ANGLE_CODE           50
00445 #define INS_POINT_CODE       10  // Followed by x of ins pnt
00446 #define NAME2_CODE            3  // Second appearance of name
00447 
00448 // Some codes used by circle entities
00449 #define CENTER_CODE          10  // Followed by x of center
00450 #define RADIUS_CODE          40  // Followd by radius of circle
00451 
00452 #define COND_OP_CODE         -4  // Conditional op,ads_ssget
00453 
00454 // When using ads_buildlist you MUST use RTDXF0 instead of these
00455 #define ENTITY_TYPE_CODE      0  // Then there is LINE, 3DFACE..
00456 #define SES_CODE              0  // Start End String Code
00457 #define FILE_SEP_CODE         0  // File separator
00458 #define SOT_CODE              0  // Start Of Table
00459 #define TEXTVAL_CODE          1
00460 #define NAME_CODE             2
00461 #define BLOCK_NAME_CODE       2
00462 #define SECTION_NAME_CODE     2
00463 #define ENT_HAND_CODE         5  // What follows is hexa string
00464 #define TXT_STYLE_CODE        7  // Inside attributes
00465 #define LAYER_NAME_CODE       8  // What follows is layer name
00466 #define FIRST_XCOORD_CODE    10  // Group code x of 1st coord
00467 #define FIRST_YCOORD_CODE    20  // Group code y of 1st coord
00468 #define FIRST_ZCOORD_CODE    30  // Group code z of 1st coord
00469 #define L_START_CODE         10
00470 #define L_END_CODE           11
00471 #define TXTHI_CODE           40
00472 #define SCALE_X_CODE         41
00473 #define SCALE_Y_CODE         42
00474 #define SCALE_Z_CODE         43
00475 #define BULGE_CODE           42  // Used in PLINE verts for arcs
00476 #define ROTATION_CODE        50
00477 #define COLOUR_CODE          62  // What follows is a color int
00478 #define LTYPE_CODE            6  // What follows is a linetype
00479 
00480 
00481 // Attribute flags
00482 #define ATTS_FOLLOW_CODE     66
00483 #define ATT_TAG_CODE          2
00484 #define ATT_VAL_CODE          1
00485 #define ATT_FLAGS_CODE       70  // 4 1 bit flags as follows...
00486 #define ATT_INVIS_FLAG        1
00487 #define ATT_CONST_FLAG        2
00488 #define ATT_VERIFY_FLAG       4 // Prompt and verify
00489 #define ATT_PRESET_FLAG       8 // No prompt and no verify
00490 
00491 // PLINE defines
00492 // Flags
00493 #define OPEN_PLINE       0x00
00494 #define CLOSED_PLINE     0x01
00495 #define POLYLINE3D       0x80
00496 #define PFACE_MESH       0x40
00497 #define PGON_MESH        0x10
00498 // Vertices follow entity, required in POLYLINES
00499 #define VERTS_FOLLOW_CODE   66 // Value should always be 1
00500 #define VERTEX_COORD_CODE   10
00501 
00502 
00503 // LAYER flags
00504 #define FROZEN           1
00505 #define FROZEN_BY_DEF    2
00506 #define LOCKED           4
00507 #define OBJECT_USED     64   // Object is ref'd in the dwg
00508 
00509 #define BLOCK_EN_CODE   -2   // Block entity definition
00510 #define E_NAME          -1   // Entity name
00511 
00512 // Extended data codes
00513 #define EXTD_SENTINEL    (-3)
00514 #define EXTD_STR         1000
00515 #define EXTD_APP_NAME    1001
00516 #define EXTD_CTL_STR     1002
00517 #define EXTD_LYR_STR     1003
00518 #define EXTD_CHUNK       1004
00519 #define EXTD_HANDLE      1005
00520 #define EXTD_POINT       1010
00521 #define EXTD_POS         1011
00522 #define EXTD_DISP        1012
00523 #define EXTD_DIR         1013
00524 #define EXTD_FLOAT       1040
00525 #define EXTD_DIST        1041
00526 #define EXTD_SCALE       1042
00527 #define EXTD_INT16       1070
00528 #define EXTD_INT32       1071
00529 
00530 // UCS codes for use in ads_trans
00531 #define WCS_TRANS_CODE      0
00532 #define UCS_TRANS_CODE      1
00533 #define DCS_TRANS_CODE      2
00534 #define PCS_TRANS_CODE      3
00535 
00536 #endif
00537 

Generated on Sat Jan 6 13:48:19 2007 for dxflib by  doxygen 1.4.4