乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 63|回复: 4

如果用vc读取dxf的属性数据(有尝)

[复制链接]

3

主题

5

帖子

1

银币

初来乍到

Rank: 1

铜币
17
发表于 2003-10-29 16:44:00 | 显示全部楼层 |阅读模式
如果用vc读取dxf的属性数据(有尝)
急!
QQ 16976004
MSN alan_lus@hotmail.com
回复

使用道具 举报

29

主题

92

帖子

3

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
208
发表于 2003-10-31 20:04:00 | 显示全部楼层
通过检索“printdxf”得到一份帮助代码:
void getlast()
{
    struct resbuf *ebuf, *eb;
    ads_name ent1;

    acdbEntLast(ent1);
    ebuf = acdbEntGet(ent1);

    eb = ebuf;

    acutPrintf("\nResults of entgetting last entity\n");

// Print items in the list.
    for (eb = ebuf; eb != NULL; eb = eb->rbnext)
        printdxf(eb);          //printdxf此函数没有类型定义????报错一

// Release the acdbEntGet() list.
    acutRelRb(ebuf);
}

int printdxf(eb)
struct resbuf *eb;      //这句就更不清楚是怎么回事了?又是int,又是struct
                               //而且一个指针*eb没有赋值
   
{
    int rt;

    if (eb == NULL)
        return RTNONE;

    if ((eb->restype >= 0) && (eb->restype restype >= 10) && (eb->restype restype >= 38) && (eb->restype restype >= 60) && (eb->restype restype >= 210) && (eb->restype restype restype;
    else
        rt = RTNONE;

    switch (rt) {

    case RTSHORT:
        acutPrintf("(%d . %d)\n", eb->restype,
            eb->resval.rint);
        break;

    case RTREAL:
        acutPrintf("(%d . %0.3f)\n", eb->restype,
            eb->resval.rreal);
        break;

    case RTSTR:
        acutPrintf("(%d . \"%s\")\n", eb->restype,
            eb->resval.rstring);
        break;

    case RT3DPOINT:
        acutPrintf("(%d . %0.3f %0.3f %0.3f)\n",
            eb->restype,
            eb->resval.rpoint[X], eb->resval.rpoint[Y],
            eb->resval.rpoint[Z]);
        break;

    case RTNONE:
        acutPrintf("(%d . Unknown type)\n", eb->restype);
        break;

    case -1:
    case -2:  
// First block entity
        acutPrintf("(%d . )\n",
            eb->restype, eb->resval.rlname[0]);
    }

    return eb->restype;
回复

使用道具 举报

29

主题

92

帖子

3

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
208
发表于 2003-10-31 20:25:00 | 显示全部楼层
可将帮助文件里的功能实现部分添加到你的程序当中,为何不能以函数的形式添加,
我也不知道。
void myEntityContext:nCommand(Adesk::UInt32 cmdIndex)
{
        
        struct resbuf *ebuf, *eb;
        ads_name  en;
    acdbEntLast(en);
    ebuf = acdbEntGet(en);

    eb = ebuf;

    acutPrintf("\nResults of entgetting last entity\n");

// Print items in the list.
for (eb = ebuf; eb != NULL; eb = eb->rbnext)
        {  
         int rt;
//所选实体为形位公差类型,从autocad自带的lisp编辑器中可看到相关图元参数
        /* if (eb->restype ==-1 )
                        {acutPrintf("(%d . )\n",eb->restype, eb->resval.rlname[0]); }
         else if(eb->restype ==0)
                        {acutPrintf("(%d . \"%s\")\n", eb->restype,eb->resval.rstring); }
         else if(eb->restype ==330)
                        {acutPrintf("(%d . )\n",eb->restype, eb->resval.rlname[0]); }
         else if(eb->restype ==5)
                        {acutPrintf("(%d . \"%s\")\n", eb->restype,eb->resval.rstring); }
         else if(eb->restype ==67)
                        {acutPrintf("(%d . %d)\n", eb->restype,eb->resval.rint); }
         //else if(eb->restype ==410)
                //        {acutPrintf("(%d . %d)\n", eb->restype,eb->resval.rint); }
         
        if ((eb->restype >= 0) && (eb->restype restype,eb->resval.rstring); }
    else if ((eb->restype >= 10) && (eb->restype restype >= 210) && (eb->restype restype,eb->resval.rpoint[X], eb->resval.rpoint[Y], eb->resval.rpoint[Z]); }
    else if ((eb->restype >= 38) && (eb->restype restype,eb->resval.rreal); }
    else if ((eb->restype >= 60) && (eb->restype restype,eb->resval.rint); }
    //else if ((eb->restype >= 210) && (eb->restype restype restype;        acutPrintf("(%d . )\n",eb->restype, eb->resval.rlname[0]); }
    else
                { rt = RTNONE;acutPrintf("(%d . Unknown type)\n", eb->restype);  }
}
从帮助项中提取的源代码,还有写Unknown type,不过,你按合适的判断语句和输出语句就可看到在正确的参数。
回复

使用道具 举报

29

主题

92

帖子

3

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
208
发表于 2003-10-31 20:31:00 | 显示全部楼层
//再整理一下,从程序中拷出来有点乱
void myEntityContext:nCommand(Adesk::UInt32 cmdIndex)
{

struct resbuf *ebuf, *eb;
ads_name  en;
    acdbEntLast(en);
    ebuf = acdbEntGet(en);

    eb = ebuf;

    acutPrintf("\nResults of entgetting last entity\n");

// Print items in the list.
for (eb = ebuf; eb != NULL; eb = eb->rbnext)
{  
  int rt;
     if ((eb->restype >= 0) && (eb->restype restype,eb->resval.rstring); }
    else if ((eb->restype >= 10) && (eb->restype restype >= 210) && (eb->restype restype,eb->resval.rpoint[X], eb->resval.rpoint[Y], eb->resval.rpoint[Z]); }
    else if ((eb->restype >= 38) && (eb->restype restype,eb->resval.rreal); }
    else if ((eb->restype >= 60) && (eb->restype restype,eb->resval.rint); }
    else if (eb->restype restype; acutPrintf("(%d . )\n",eb->restype, eb->resval.rlname[0]); }
    else
  { rt = RTNONE;acutPrintf("(%d . Unknown type)\n", eb->restype);  }
}
}
呵呵,用紫光老死机,而这个又没有tab键,那就这样了
回复

使用道具 举报

3

主题

5

帖子

1

银币

初来乍到

Rank: 1

铜币
17
发表于 2003-11-1 07:45:00 | 显示全部楼层
您的程序不是在vc里吧?
我是要脱离cad的环境
我已经基本搞定了
谢谢您
QQ 16976440
msn alan_lus@hotmail.com
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-2-4 15:03 , Processed in 0.149217 second(s), 62 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表