CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ObjectARX 开发指南

DXF 集团代码

2023-1-1 00:08| 发布者: admin| 查看: 303| 评论: 0|来自: AutoCAD

许多 ObjectARX 函数返回上表中定义的类型代码。但是,在处理实体的函数的结果中,该字段包含 DXF 组代码,这些代码在AutoCAD 自定义指南中进行了描述。例如,在实体列表中,afield of 10 表示一个点,而 aof 41 表示实际值。restyperestyperestype

AutoCAD 图形由具有以下组件的数据库对象的结构化容器组成:

  • 始终启用并在图形生存期内持续存在的唯一手柄
  • 可选的 xdata 列表
  • 可选的持久反应器组
  • 指向扩展字典的可选所有权指针,该字典拥有应用程序放置在其中的其他数据库对象

数据库对象是没有图层、线型、颜色或任何其他几何或图形属性的对象,实体派生自对象并具有几何和图形属性。

由于 DXF 代码始终小于 2,000,并且结果类型代码始终较大,因此应用程序可以轻松确定结果缓冲区列表何时包含结果值(例如,返回者)或包含实体定义数据(返回者和其他实体函数)。acedGetArgs()acdbEntGet()

下图显示了检索的圆的结果缓冲区格式:acdbEntGet()

下面的示例代码片段显示了一个函数,该函数传递了 DXF 组代码和关联的实体,并返回相应的类型代码。类型代码指示可以表示数据的数据类型:指示双精度浮点值,指示 an 等。实体的类型(例如,普通实体,如圆、块定义或表条目,如视口)由此函数附带的类型定义指示:dxftype()RTREALRT3DPOINTads_point

#define ET_NORM 1 // Normal entity  
#define ET_TBL  2 // Table  
#define ET_VPORT  3 // Table numbers  
#define ET_LTYPE  4 
#define ET_LAYER  5 
#define ET_STYLE  6 
#define ET_VIEW   7 
#define ET_UCS    8 
#define ET_BLOCK  9 
// Get basic C-language type from AutoCAD DXF group code (RTREAL,
// RTANG are doubles, RTPOINT double[2], RT3DPOINT double[3], 
// RTENAME long[2]). The etype argument is one of the ET_
// definitions. 
//
// Returns RTNONE if grpcode isn't one of the known group codes. 
// Also, sets "inxdata" argument to TRUE if DXF group is in XDATA.  
//
short dxftype(short grpcode, short etype, int *inxdata) 
{ 
    short rbtype = RTNONE; 
    *inxdata = FALSE; 
    if (grpcode >= 1000) {  // Extended data (XDATA) groups
        *inxdata = TRUE; 
        if (grpcode == 1071) 
            rbtype = RTLONG; // Special XDATA case  
        else 
            grpcode %= 1000; // All other XDATA groups match.  
    } // regular DXF code ranges  
    if (grpcode <= 49) { 
        if (grpcode >= 20) // 20 to 49  
            rbtype = RTREAL; 
        else if (grpcode >= 10) { // 10 to 19  
            if (etype == ET_VIEW) // Special table cases
                rbtype = RTPOINT; 
            else if (etype == ET_VPORT && grpcode <= 15) 
                rbtype = RTPOINT; 
            else // Normal point  
                rbtype = RT3DPOINT; // 10: start point, 11: endpoint
        } 
        else if (grpcode >= 0) // 0 to 9  
            rbtype = RTSTR; // Group 1004 in XDATA is binary
        else if (grpcode >= -2) 
            // -1 = start of normal entity -2 = sequence end, etc.  
            rbtype = RTENAME; 
        else if (grpcode == -3) 
            rbtype = RTSHORT; // Extended data (XDATA) sentinel 
    } 
    else { 
        if (grpcode <= 59) // 50 to 59  
            rbtype = RTANG; // double  
        else if (grpcode <= 79) // 60 to 79  
            rbtype = RTSHORT; 
        else if (grpcode < 210) 
            ;  
        else if (grpcode <= 239) // 210 to 239  
            rbtype = RT3DPOINT; 
        else if (grpcode == 999) // Comment  
            rbtype = RTSTR; 
    } 
    return rbtype; 
} 

应用程序获取结果缓冲区列表(调用),表示视区符号表中的条目,以及以下 C 语句调用:rbdxftype()

ctype = dxftype(rb->restype, ET_VPORT, &inxdata); 

假设等于 10。then返回,指示实体是一个二维点,其坐标(类型)为 inand。rb->restypedxftype()RTPOINTads_realrb->resval.rpoint[X]rb->resval.rpoint[Y]


路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 12:25

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部