![]() |
【转帖】[arx]自定义实体类中添加外部文件中已定义的图块--相关问题
[arx]自定义实体类中添加外部文件中已定义的图块--相关问题
[arx]自定义实体类中添加外部文件中已定义的图块--相关问题 初学arx已三个月,虽然还未入门,为答谢论坛各位给我的帮助,将我目前收集的关于自定义实体类的相关内容组织成一个小程序,提供大家分享,同时希望高手可以更好的对我指导。 晓东也有我发布的相关帖子,你可以得到其她相关信息 当前程序已经完成: 1. 一个简单的矩形框的自定义实体类创建,内有五个夹点。已经完成了对其基本函数的重载: virtual acad::errorstatus dxfoutfields(acdbdxffiler* pfiler) const; virtual acad::errorstatus dxfinfields(acdbdxffiler* pfiler); virtual acad::errorstatus dwgoutfields(acdbdwgfiler* pfiler) const; virtual acad::errorstatus dwginfields(acdbdwgfiler* pfiler); virtual adesk::boolean worlddraw(acgiworlddraw* mode); virtual acad::errorstatus getosnappoints(acdb::osnapmode osnapmode, int gsselectionmark, const acgepoint3d& pickpoint, const acgepoint3d& lastpoint, const acgematrix3d& viewxform, acgepoint3darray& snappoints, acdbintarray& geomids) const; virtual acad::errorstatus getgrippoints(acgepoint3darray& grippoints, acdbintarray& osnapmodes, acdbintarray& geomids) const; virtual acad::errorstatus movegrippointsat(const acdbintarray& indices, const acgevector3d& offset); virtual acad::errorstatus transformby(const acgematrix3d& xform); 2. 可以已经可以显示图块了,添加了一个函数acdbobjectid cascocentity::getblockidfromname(const char *dwgname, const char *blockname)〔还很不完善,编译会出错,再编译就行,希望各位大侠指导,除去这个问题。〕 在函数virtual adesk::boolean worlddraw(acgiworlddraw* mode);给出了一些操作。 ...... acdbblockreference *ref = new acdbblockreference(); ref->setcolorindex(5); ref->setblocktransform(m_xform); ref->setposition(mcenter); acdbobjectid recordid; recordid = getblockidfromname("drawing0.dwg", "circle"); //two_rect //circle if(recordid != null) ref->setblocktablerecord(recordid); ref->worlddraw(mode); ...... 编译环境、操作步骤、和问题(更为详细的说明参见cenity工程) 本程序为vc60+acad2下调试过,使用方法先编译centity工程,然后编译entitytest工程。加载后执行test命令就可以。 单独编译和执行(*.dbx 和*.arx以及*.dwg中的图块要对应起来)two_rect或者circle都不会有问题。如果调用错了就会出错,我调试能力有限,不知道如何操作。 目的: 希望能够使用这样的方法(只在自定义实体中创建关联图块名称、夹点等关键属性)创建的自定义实体,使用该实体类,用户只需要选择该实体关联的图块和自定义夹点的位置等属性,就可以用一个或少数几个特征夹点的类实现acad自定义的实体类,这样的类定义出的实体具有更大的灵活性。 可是如何进一步控制图块的的操作? 1. 能够同一个*.dbx 和*.arx就可以显示不同块的、保存后再打开也是一样。 2. 可以拖动自定义实体,完成与自定义实体相连的直线的自动拉伸? 2. 比如完成对图块里面图元的具体操作? 欢迎大家参与讨论,也希望您们和我联系! qq:19154480 msn:freejustinji@hotmail.com e-mail:justin3@citiz.net 目前已经可以重载不同的图块了,而且图块也可以自由设置大小,但是在复制的时候,还是不能和修改后的自定义实体一样,只是原来自定义实体的copy,这需要在那里重载? |
| 所有的时间均为北京时间。 现在的时间是 07:35 AM. |