几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-04, 06:06 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】conting entitites in a database

conting entitites in a database
conting entitites in a database
i need to count the number of each entity in an oddatabase model space.
so i iterate over the entities and get pent->isa()->name() and dxfname().
that is the only way, i guess , to know the entity type.
but i cant find a .h file in the kit which would contain an enumeration of all
the rxclass names or dxf names.
where are they ?
thanks for any help.
jp
last edited by dublin; 3rd september 2006 at 09:45 pmfff">.
there is no such single file. we have defines like
for .h files (declaration macros)
oddb_declare_members(oddbblockbegin);
and for .cpp (definition macros)
odrx_no_cons_define_members_altname(oddbdimension, oddbentity, dd_t("acdbdimension"))
ps : mfcapp has view\classes info. it shows all registered classes.
last edited by sslezkin; 4th september 2006 at 12:28 amfff">.
i need to count entities....
hi alexande,
so how can i design a switch/case on entity types with new kit...?
with the old kit, we did a switch/case on adenhd->enttype:
adgetblockhandle(rdhandle,mspaceblkobjhandle,ad_mo delspace_handle);
entlist=adentitylist(rdhandle,mspaceblkobjhandle);
adstartentityget(entlist);
for (entset=0; entset<2; entset++)
{
do
{
if (!(returnval=adgetentity(entlist,adenhd,aden))) continue;
switch (adenhd->enttype)
{
case ad_ent_line: ilines++; break;
case ad_ent_point: ipoints++; break;
etc..
how to do this with the new kit ?
thanks
jph
hi,
new toolkit uses odrxclass* instead entityid. unfortunately, switch\case construction cannot be used with.
the next is entity test for oddbregion.
code:
bool b = pent->isa() == oddbregion::desc();
or something like
code:
if (!pent.isnull()
&& (pent->iskindof(oddbregion::desc())
|| pent->iskindof(oddbbody::desc())
|| pent->iskindof(oddb3dsolid::desc())))
ps : readex example is database dump example. it can be useful for your task.
odreadex demonstrates more efficient method than
if (iskindof())
..
else if(
it uses protocol extensions.
sergey slezkin
understood !
thanks to all of you
jp
nevertheless ...
neverthe less, whatever the method we use , i stay convinced that there should be somewhere in the kit an enumaration of all dbobjects that the kit knows about because the client must supply a class for each known entities.
for exemple, the odreadex sample supplies a set of dumpers, enumerated in the class dumpers{}; and it looks to me that some entities are missing :
oddb2dvertex, oddbattribute, oddbattributedefinition, and may be others...
instead of having to dig around all the .h files with a good chance to miss some entities ( not all of us know the internals of autocad !) , it would be better to have a summ-up of all entities. and what about the next dd release if ac adds new db objects ?
jp
class dumpers
{
odstaticrxobject< oddb2lineangulardimension_dumper > m_2lineangulardimensiondumper;
odstaticrxobject< oddb2dpolyline_dumper > m_2dpolylinedumper;
odstaticrxobject< oddb3pointangulardimension_dumper > m_3pointangulardimensiondumper;
odstaticrxobject< oddb3dpolyline_dumper > m_3dpolylinedumper;
odstaticrxobject< oddb3dsolid_dumper > m_3dsoliddumper;
odstaticrxobject< oddbaligneddimension_dumper > m_aligneddimensiondumper;
odstaticrxobject< oddbarcalignedtext_dumper > m_arcalignedtextdumper;
odstaticrxobject< oddbarcdimension_dumper > m_arcdimensiondumper;
odstaticrxobject< oddbarc_dumper > m_arcdumper;
odstaticrxobject< oddbblockreference_dumper > m_blockreference;
odstaticrxobject< oddbbody_dumper > m_bodydumper;
odstaticrxobject< oddbcircle_dumper > m_circledumper;
odstaticrxobject< oddbdiametricdimension_dumper > m_diametricdimensiondumper;
odstaticrxobject< oddbellipse_dumper > m_ellipsedumper;
odstaticrxobject< oddbentity_dumper > m_entitydumper;
odstaticrxobject< oddbface_dumper > m_facedumper;
odstaticrxobject< oddbfcf_dumper > m_fcfdumper;
odstaticrxobject< oddbhatch_dumper > m_hatchdumper;
odstaticrxobject< oddbleader_dumper > m_leaderdumper;
odstaticrxobject< oddbline_dumper > m_linedumper;
odstaticrxobject< oddbminsertblock_dumper > m_minsertblock;
odstaticrxobject< oddbmtext_dumper > m_mtextdumper;
odstaticrxobject< oddbmline_dumper > m_mlinedumper;
odstaticrxobject< oddbole2frame_dumper > m_ole2framedumper;
odstaticrxobject< oddbordinatedimension_dumper > m_ordinatedimensiondumper;
odstaticrxobject< oddbpoint_dumper > m_pointdumper;
odstaticrxobject< oddbpolyfacemesh_dumper > m_polyfacemeshdumper;
odstaticrxobject< oddbpolygonmesh_dumper > m_polygonmesh;
odstaticrxobject< oddbpolyline_dumper > m_polylinedumper;
odstaticrxobject< oddbproxyentity_dumper > m_proxyentitydumper;
odstaticrxobject< oddbradialdimension_dumper > m_radialdimensiondumper;
odstaticrxobject< oddbrasterimage_dumper > m_imagedumper;
odstaticrxobject< oddbray_dumper > m_raydumper;
odstaticrxobject< oddbregion_dumper > m_regiondumper;
odstaticrxobject< oddbrotateddimension_dumper > m_rotateddimensiondumper;
odstaticrxobject< oddbshape_dumper > m_shapedumper;
odstaticrxobject< oddbsolid_dumper > m_soliddumper;
odstaticrxobject< oddbspline_dumper > m_splinedumper;
odstaticrxobject< oddbtable_dumper > m_tabledumper;
odstaticrxobject< oddbtext_dumper > m_textdumper;
odstaticrxobject< oddbtrace_dumper > m_tracedumper;
odstaticrxobject< oddbviewport_dumper > m_viewportdumper;
odstaticrxobject< oddbwipeout_dumper > m_wipeoutdumper;
odstaticrxobject< oddbxline_dumper > m_xlinedumper;
... what about oddb2dvertex, oddbattribute, oddbattributedefinition, ??
}
in autocad where is a set of built-in (say r12) entities which is stable. other db classes are an extensions from file format point of view. they are enumerated in classes section of dwg or dxf file.
some of them are added in latest autocad releases. but some of them are custom (client created) classes which are implemented by plug-ins. in autocad such plug-ins (dlls) are called .arx applications. in dd where is an equivalent - drx (can be dll or statically linked modules). any autocad user has ability to implement his own db classes using autocad's arx interface. or dd user can implement his db classes using drx (see excustobjs sample).
so you can never be sure that you know all classes which may present in drawing.
the set of "known" classes depends on the set of modules available for application (plug-ins).
if autocad (or dd) loads a file with unknown classes they come as proxy object or proxy entity. proxies store original data which is used to restore original objects if a module implementing this class is available. proxy entitiy also can store its graphic representation to draw the entity if its class is unknown for application.
as for readex its only a sample and does not pretend to dump even all r12 classes.
sergey slezkin
so the question remains to know where we can find the list of ac "stable" entities ( excluding proxies of course..). i mean the entities that autocad itself produces when there are no user .arx objects ...
rgds
jp
autocad itself contains a set of arx applications which varies not only between autocad versions but between different installations of the same version. for example if you chose "install expresstools" while installing autocad a few classes is added to "known" ones: wipeout, arcalignedtext, rtext...
the "fixed" set presents in old c toolkit enum for enttype.
btw, variable set of "optional" classes is the reason why some classes in odt have "floating" enttype value.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】cloning a database yang686526 DirectDWG 0 2009-05-04 05:51 PM
【转帖】database 不能作为字段? yang686526 ObjectARX(VB.NET/C#) 0 2009-04-20 10:58 AM
【转帖】c#.net+arx public void insertouterfile() { db.database dbase = new database(); db yang686526 ObjectARX(VB.NET/C#) 0 2009-04-20 09:48 AM
【转帖】database-resident entity与not database-resident entity有什么区别? yang686526 ObjectARX(C++) 0 2009-04-16 09:47 AM


所有的时间均为北京时间。 现在的时间是 08:48 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多