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

oddbellipse problem
oddbellipse problem
hi,
i use the oddbellipse object to create elliptical arcs. i set all the data with the "set" method from oddbellipse. but i have a problem with the start and end angle. when i open my dwg file, the start an end angles of elliptical arcs are not correct.
in the old opendwg i used the start and end param instead of the angles, but if i try to set the start and end param in dwgdirect, the loading of the dwg file fails.
does anybody know how to set the start and end param, or what may be wrong with my start and end angles?
thanks for any help.
could you please post sample code reproducing the problem, with all numeric values (sample of set method creating "invalid" ellipse and ellipse, which fails to load)
sincerely yours,
george udov
hi,
sorry for the delay, but here is some more information.
numerical values:
majoraxis: 3.5 / 6.06 / 0
minoraxis: -3.5 / 2.02 / 0
normal: 0 / 0 / 1
center: 0 / 0 / 0
ratio: 0.577
startangle: 329 degree
endangle: 210 degree
code with dwgdirect:
oddbellipseptr ent=oddbellipse::createobject();
oddbblocktablerecordptr modelspace=database->getmodelspaceid().safeopenobject(oddb::kforwrite) ;
modelspace->appendoddbentity(ent);
ell->set(center,normal,majoraxis,ratio,startangle*pi/180.0,endangle*pi/180);
this creates a different elliptical arc as the code from opendwg libraries.
the following code causes a crash when loading the dwg file in acad:
ell->set(center,normal,majoraxis,ratio);
ell->setstartparam(startangle*pi/180.0);
ell->setendparam(endangle*pi/180.0);
any ideas?

all these methods works just like objectarx's ones. i can't reproduce any issues with such input data on release 1.10 update 2.
also i can't reproduce autocad's crash. which version of autocad crashes?
you should pass angles to oddbellipse::set method. angles are calculated from major axis around normal.
you should pass parameters to oddbellipse::setstartparam and oddbellipse::setendparam methods. parameters are calculated from major axis around normal too.
sincerely yours,
george udov
have the same ellipse problem
was this issue ever resolved?
i am having the same or a similar problem. we use this code to produce an ellipse:
oddbellipseptr pellipse = oddbellipse::createobject();
odgepoint3d center(p->pt0[0], p->pt0[1], p->pt0[2]);
oddbobjectid id = pblock->appendoddbentity(pellipse);
odgevector3d normal_vector(0,0,1), major;
major.x = p->pt1offset[0];
major.y = p->pt1offset[1];
major.z = p->pt1offset[2];
pellipse->set(center, normal_vector, major, p->minortomajorratio,
p->startparam, p->endparam);
with center of (0,0,0), major of (2.5,0,0) ratio of 0.4, startparam of 1.19 and endparam of 5.09 we end up with a dxf 41 entry of 1.41 and 42 entry of 4.87 instead of the expected 1.19 and 5.09.
thanks,
barry
add the following code after the set method, that worked for me (starting with dwgf direct 1.11)
pellipse->setstartparam(p->startparam);
pellipse->setendparam(p->endparam);
i cannot explain why, but the results are correct.
thanks for the tip
quote:
originally posted by stefan waldner
add the following code after the set method, that worked for me (starting with dwgf direct 1.11)
pellipse->setstartparam(p->startparam);
pellipse->setendparam(p->endparam);
i cannot explain why, but the results are correct.
that worked like a charm. thanks alot.
oddbellipse::set() method expects not start and end parameters but angles.
ellipse parametrization is:
point = center + major_vector * cos(param) + minor_vector * sin(param)
sergey slezkin
the above posted code is working fine in most of the cases but in this specific case this code is not working an converting a normal elliptical arc to a closed elliptical arc,
please check the code
sds_point centerpoint;
pellipse->get_10(centerpoint);
sds_point majaxis;
pellipse->get_11(majaxis);
double axisratio;
pellipse->get_40(&axisratio);
double startparam, endparam;
pellipse->get_41(&startparam);
pellipse->get_42(&endparam);
sds_point extrusion;
pellipse->get_210(extrusion);
poddbellipse->set(odgepoint3d(centerpoint[0],
centerpoint[1],
centerpoint[2]),
odgevector3d(extrusion[0],extrusion[1], extrusion[2]),
odgevector3d(majaxis[0], majaxis[1], majaxis[2]),
axisratio,
startparam,
endparam);
please also check the file
attached files (28.1 kb, 3 views)

this is in continuation of the above post......
****please this code to the code written above.
poddbellipse->setcenter(odgepoint3d(centerpoint[0], centerpoint[1],
centerpoint[2]));
poddbellipse->setradiusratio(axisratio);
poddbellipse->setstartparam(startparam); ..................(1)
poddbellipse->setendparam(endparam);.......................(2 )
if i comment the line (1) & (2) then this specific ellipse displayed fine, but
then normal ellipse goes hayward.
........plz tell me if i m making mistakes, or anything i have to add.........
........thanks in advanced
ellipse angles and parameters are not the same.
set() expects angles and setstartparam() and setendparam() - parameters.
in your file both start and end parameters are larger than 2 pi.
setstartparam() and setendparam() implementation in dd follows arx description of these methods (below) as a result 2 pi is subtracted from start parameter if it's larger than 2 pi but not from end parameter. as a result ellipse looks like closed.
----------------------------------
acad::errorstatus
setstartparam(
double startparam);
startparam input new start parameter for the ellipse
sets startparam to be the new start parameter of the ellipse. if startparam is larger than the current end parameter, then it is decremented in steps of 2pi until it is less than the current end parameter.
----------------------------------
acad::errorstatus
setendparam(
double endparam);
endparam input new end parameter for the ellipse
sets endparam to be the new end parameter of the ellipse. if endparam is less than the current start parameter, then it is incremented in steps of 2pi until it is larger than the current start parameter.
sergey slezkin
thanks a lot, it was really nice info,,
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】oda 1.06 vs new 1.08 and 1.09 nls problem yang686526 DirectDWG 0 2009-05-06 06:50 PM
【转帖】dimentions problem in import export using dwgdirec yang686526 DirectDWG 0 2009-05-04 07:43 PM
【转帖】color conversion problem dd 1.14.01 yang686526 DirectDWG 0 2009-05-04 05:53 PM
【转帖】cannot open a dwg file in autocad - random problem yang686526 DirectDWG 0 2009-05-04 05:28 PM
【转帖】vista and addin dll problem yang686526 SolidWorks二次开发 0 2009-04-13 03:19 PM


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


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