几何尺寸与公差论坛------致力于产品几何量公差标准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-05, 10:56 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】find entity within area

find entity within area
find entity within area
hi
i'm trying to find all entities that lie within or intersect a certain area. the area is rectangular, aligned to the x- and y-axis (defined by 4 lines). z-coordinates are ignored, all entities will be projected to the xy-plane.
this is not so hard to accomplish. i came up with a solution using odgeextents2d. unfortunately my code is very slow, it seems that calculating the extents for an entity takes quite long...
code:
bool functions::lieswithinarea( oddbentityptr entityptr, odgeextents2d &inftotalextents)
{
bool lieswithin = false;
odgeextents3d entityextents;
odresult extentsresult = entityptr->getgeomextents( entityextents );
if( extentsresult == eok && entityextents.isvalidextents() && inftotalextents.isvalidextents() ){
//project extents to xy-plane
odgeextents2d entityextents2d( entityextents.minpoint().convert2d(), entityextents.maxpoint().convert2d() );
if( !entityextents2d.isdisjoint( inftotalextents ) ){
lieswithin = true;
}
}
return lieswithin;
}another attempt to solve this problem: get a position of an entity and see if it is contained in the area. drawbacks of this is, that i have to find out what entity i'm dealing with and how to get a valid position (not all entities have methods to get a wcs position of any kind). in addition to that, the position could be out of the area but some part of the entity still intersects with it.
do you have any suggestions? what classes/methods should i use?
thanks
martin
hi
mfcapp - our viewer sample - has selection by box functionality. could you check the performance of this selection tool with your sample file ? is it ok for you? i am not sure that you can use this selection functionality in your application, but as first step, please, check the performance...
we have functionality named selectionset. it used inside selection by box. in fact it should do the same comparing like yours, but may be faster.
thanks for your swift answer. i realized that i had made some unnecessary iterations calling "blockid()" instead of the "dimblockid()" on the dimension-object. now that this is corrected, the code is faster (one 3rd of the time) and i can live with that. however, i will keep your proposal in mind. thanks again.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】entity and material yang686526 DirectDWG 0 2009-05-05 09:28 AM
【转帖】correct use of extended entity data yang686526 DirectDWG 0 2009-05-04 06:20 PM
【转帖】『theswamp』炸开多段线出错 - 精华帖集合 yang686526 ObjectARX(VB.NET/C#) 0 2009-04-29 05:06 PM
【转帖】objectarx&dummies教程(十三)—— deriving from acdbentity yang686526 ObjectARX(C++) 0 2009-04-16 10:40 AM
【转帖】macro to figure open area of a face yang686526 SolidWorks二次开发 0 2009-04-12 06:55 PM


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


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