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

exploding polyline in region
exploding polyline in region
hello,
i am trying to explode a polyline contained inside a region using the explode command in dwgdirect.
it appears that explode generates ellipses instead of the arcs and lines contained in the original polyline.
is this normal behavior?
thanks
no this isn't normal. explode should generate arcs, not full ellipse. what toolkit version did you use? did you try it with last releases? could you please attach sample file ?
attached sample drawing with polyline inside region
hi alexander,
i am attaching an autocad 2002 drawing with a region containing a polyline with two lines and three arcs. when exploding the region using autocad, you get the original entities.
when exploding the region with dwglib v2.4 (the last release before 2.5.1), you get two lines and three ellipses.
thanks
attached files (19.4 kb, 4 views)

last edited by robertpantangco@hotmail.com; 18th march 2008 at 10:49 pmfff">. reason: missing text
hi,
i have checked your file. the problem with explode of region is very old. it was fixed in 2.4.2. i have tested explode in 2.4.2 and 2.5.2 production. results are in attachment.
attached images (29.3 kb, 8 views)

hi alexander,
actually i was using 2.4.2 released in october 2007. did you use explode() or explodegeometry()?
nevertheless, i will wait for 2.5.2.
thanks
hi,
i just call for explode command in the mfcapp. some time ago i got report about region explode bug. i dont remember the date, but it was fixed.
btw : 2.5.2 production is available now. i dont know about member area, but it is already available from gridzone ftp.
alexander,
i have updated my files to 2.5.2 and the results are the same.
if i explode a polyline containing arcs inside a region, the arcs are converted to elliptical arcs!
if the polyline is not inside a region, the arcs are converted normally to regular arcs!
i think that when you tested my sample drawing, you thought that the exploded arcs are regular arcs. if you would test it again, you will find that they are elliptical arcs.
if this is so, the question remains, is this a bug? if it is by design, how do i convert the elliptical arcs to regular arcs?
o!
now i understand your question i thought that you asked about full ellipse generation insead elliptical arc, but you asked about elliptical arc instead circle arc.
this isn't defect, but i can implement your suggestion later. there is no information inside region about original elements type. it stores arcs as some 'elliptical curve type'. so i can only redesign explode in the way of oddbarc creation instead oddbellipse, if major radius is equal to minor. but it is possible to create region from oddbellipse with equal radiuses and explode will generate oddbarc (or dbcircle for full arc).
you got entities array after call of explode() or explodegeometry(). so you should iterate through array and replace all r=r oddbellipse to oddbarc or oddbcircle.
hi alexander,
thank you for your response. by the way, autocad returns circular arcs instead of elliptical arcs when exploding from a region so they must have some information or that it checks for equal radii.
i am not sure how to replace oddbellipse with oddbarc in the array after testing if radius ratio = 1. do you have any sample code?
my existing code is currently:
odrxobjectptrarray array;
entity->explode(array);
// insert code to examine array and replace elliptical arcs with circular arcs
entity->erase(); // crashes with invalid execution
the application also crashes when doing the entity->erase() after explode with "invalid execution" on dbtransactimpl.cpp at line 288. any suggestion on how to fix it?
happy easter!
hi,
please, check that objects\tables are opened for kwrite. line 288 is throw oderror(enotopenforwrite);
code:
odrxobjectptrarray entityset;
oddbregionptr(pent)->explode(entityset);
odrxobjectptrarray::iterator pit = entityset.begin();
odrxobjectptrarray::iterator ped = entityset.end();
while(pit != ped)
{
oddbellipseptr pel = oddbellipse::cast(*pit);
if (!pel.isnull())
{
if (odequal(pel->radiusratio(), 1.))
{
odgepoint3d center;
odgevector3d unitnormal, majoraxis;
double radiusratio, startangle, endangle;
pel->get(center, unitnormal, majoraxis, radiusratio, startangle, endangle);
double angle = unitnormal.perpvector().angleto(pel->majoraxis(), unitnormal);
oddbarcptr pc = oddbarc::createobject();
pc->setpropertiesfrom(pel);

pc->setcenter(center);
pc->setradius(majoraxis.length());
pc->setnormal(unitnormal);

pc->setstartangle(startangle + angle);
pc->setendangle(endangle + angle);
*pit = pc;
//pms->appendoddbentity(pc);
}
}
++pit;
thanks a lot alexander.
the code works except that the original extrusions for the arcs got changed from z-extrusion of 0 to -1. the start and end angles also were changed to correspond to the change of z-extrusion (group code 230).
see output of list command following based on sample drawing sent earlier in this thread on one of the arcs:
after autocad explode (it still corresponds to original polyline)
arc layer: "0"
space: model space
handle = 34
center point, x= 6.2298 y= 3.3278 z= 0.0000
radius 2.7347
start angle 168
end angle 316
length 7.0449
after your code transformation:
arc layer: "0"
space: model space
handle = 55
center point, x= 6.2298 y= 3.3278 z= 0.0000
radius 2.7347
extrusion direction relative to ucs:
x= 0.0000 y= 0.0000 z= -1.0000
length 7.0449
total angle 148
the dxfout after your code replacing elliptical arc with circular arc now shows
arc
5
55
330
1f
100
acdbentity
8
0
100
acdbcircle
10
-6.229767603933802 (note: change of sign)
20
3.32778604616263
30
0.0
40
2.734733019176701
210
0.0
220
0.0
230
-1.0
100
acdbarc
50
224.0245308389181 (note change of start angle)
51
11.62247665517381 (note change of end angle)
0
-----------------
future request:
what would be nice if possible for a future version of the library is a dwgdirect function to convert any ellipse to a polyline.
that is for those autocad applications whose pellipse variable was not set to 1.
thanks again.
last edited by robertpantangco@hotmail.com; 25th march 2008 at 09:13 pmfff">. reason: additional request
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
旧 2010-04-26, 10:28 AM   #2
Chamtak 帅哥
初级会员
 
注册日期: 10-04
来自: USA
帖子: 1
精华: 0
现金: 12 标准币
资产: 12 标准币
Chamtak 向着好的方向发展
默认 adopting a dog

隐藏帖
您没有登陆,无法查看此帖内容,请登陆或注册。
此帖为金钱出售帖,价格: 5标准币 [看谁购买]
此帖为财富帖,只有拥有 100标准币 以上的会员才可查看此帖
此帖为资历帖,只有帖子数 10 以上的会员才可查看此帖
Chamtak离线中   回复时引用此帖
旧 2010-04-27, 11:05 PM   #3
Smaxia 帅哥
初级会员
 
注册日期: 10-04
来自: USA
帖子: 1
精华: 0
现金: 12 标准币
资产: 12 标准币
Smaxia 向着好的方向发展
默认 unlock iphone 3g

隐藏帖
您没有登陆,无法查看此帖内容,请登陆或注册。
此帖为金钱出售帖,价格: 5标准币 [看谁购买]
此帖为财富帖,只有拥有 100标准币 以上的会员才可查看此帖
此帖为资历帖,只有帖子数 10 以上的会员才可查看此帖
Smaxia离线中   回复时引用此帖
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】ellipse geometry inside a region yang686526 DirectDWG 0 2009-05-05 09:00 AM
【转帖】自己写的:等高线(二维多线段polyline2d)转换为多线段(polyline)类 - 精华帖集合 yang686526 ObjectARX(VB.NET/C#) 0 2009-04-29 05:44 PM
已知一个polyline,在线上选择一点,如何判断这个点是不是和别的polyline的交点? yang686526 ObjectARX(VB.NET/C#) 0 2009-04-21 11:56 AM
【转帖】如何将polyline转化为region yang686526 ObjectARX(VB.NET/C#) 0 2009-04-21 10:07 AM
【转帖】利用选择集对polyline进行过滤 yang686526 ObjectARX(VB.NET/C#) 0 2009-04-20 08:35 PM


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


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