几何尺寸与公差论坛------致力于产品几何量公差标准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-06, 03:49 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】incorrect mirroring on 2d polylines

incorrect mirroring on 2d polylines ?
incorrect mirroring on 2d polylines ?
in the attached file there are numerous 2d polylines that are mirrored about the x and/or y axis. my application is creating the transformation matrix, applying it to the entity, and then exploding the result into the individual entities. it seems that after the transformation and mirroring about an axis the arc entities within the polyline are not being reversed. all the arc normals remain at 0,0,1. the code below illustrates the issue: i am using version 2.01
static void debug11314 (oddbdatabaseptr pdb)
{
oddbentityptr pentinsert, pent, pentcopy;
v_entity_type entitytype;
odgematrix3d odobjectmatrix;
odresult odret;
oddb:oly2dtype polytype;
//blockref
pentinsert = pdb->getoddbobjectid(oddbhandle("4f697")).openobject() ;
//get the transformation matrix
if (getobjecttransform (pentinsert, entitytype, &odobjectmatrix) == false)
return;
//entity
pent = pdb->getoddbobjectid(oddbhandle("4f5d0")).openobject() ;
odret = pent->gettransformedcopy (odobjectmatrix, pentcopy);
// print out arc data for original & transformed entity
debug11314readbyexplosion (pent);
debug11314readbyexplosion (pentcopy);
return;
}
static void debug11314readbyexplosion (oddbentityptr pent)
{
odrxobjectptrarray entityset;
odresult odret;
odret = ((oddb2dpolylineptr)pent)->explode (entityset);
noentries = entityset.length ();
if (noentries == 0)
return;
odrxobjectptrarray::iterator pit = entityset.begin();
for(; pit != entityset.end(); ++pit)
{
pobj = pit->get();
if (pobj->iskindof(oddbarc::desc()) == false)
continue;
parc = pobj;
as = parc->startangle ();
af = parc->endangle ();
debug_printf ("angles = %f, %f \n", as, af);
normal = parc->normal();
debug_printf ("normal = %f, %f, %f \n", normal.x, normal.y, normal.z);
}
}
regards
gerry
as i am unable to upload file i will mail separately
mirroring transformation about x or y does not reverse normal.
explode produces arcs having the same normal as original polyline entity. this causes direction of clock-wise segents to be changed (start and end points are exchanged).
this is intended behavior (like autocad does).
sergey slezkin
thank you. i did not realise that mirroring retained the same normal, and in effect reversed the polyline. nevertheless in this example the mirroring on arcs does seem to be incorrect. to simplify the data i have used the same transformation matrix (handle 4f697), but set the translation co-ordinates to zero, using the statements
n.x = 0.0; n.y = n.z = 0.0;
odobjectmatrix.settranslation (n);
the matrix now represents a mirroring about the x axis. if i explode the polyline (handle 4f5d0) and examine the 2nd line and 5th arc (because they are physically close to each other) of the original and transformed polylines i get the following results. all z co-ordinates are 0.0
for the 2nd line from the original polyline
start x-12.711 y35.094
end x-44.526 y0.387
for the 2nd line from the transformed polyline
start x-12.711 y-35.094
end x-44.526 y-0.387
these results show a mirroring around the x axis.
for the 5th arc from the original polyline
centre x-55.055 y-0.000000 rad 9.0 (y is actually -6e-11)
start x-58.797 y8.185
end x-46.576 y-3.018
normal x0.000000 y0.000000 z1.000000
for the 5th arc from the transformed polyline
centre x-50.318 y-5.167 rad 9.0
start x-58.797 y-8.185
end x-46.576 y3.018
normal x0.000000 y0.000000 z1.000000
clearly not mirrored about the axis. the centre co-ordinates should not change in x, and if the centre y co-ordinate is 0.0, then the mirrored object co-ordinate should also be zero.
regards
gerry
i reproduced the problem. the defect is in oddb2dpolyline::transformby(). it should negate bulge value if tranformation is mirroring.
sergey slezkin
is this a bug that is going to be fixed?
is this a bug that is going to be fixed?
what is the best workaround?
this bug was fixed in 2.3.1
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】explode polylines with different segment width yang686526 DirectDWG 0 2009-05-05 10:08 AM
【转帖】dxf polylines showing numvertices == 0 yang686526 DirectDWG 0 2009-05-05 08:51 AM
【转帖】2d界最好的看图软件!!! yang686526 数据库ObjectDBX 0 2009-04-27 05:22 PM
2d界最好的看图软件!!! yang686526 ObjectARX(AutoLISP) 0 2009-04-25 05:53 PM
【求助】【转帖】"> 重复2d和3d距离的测量话题 huangyhg PC-DMIS 0 2009-04-08 12:57 AM


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


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