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

oddbpolyline::getparamatpoint() missed point
oddbpolyline::getparamatpoint() missed point
hello. all.
did find out that oddbpolyline::getparamatpoint() method is unstable and sometimes is missing points with "invalidinput" error message.

shouldn't this method be used with a tolerance parameter?
this is a schema of my code:
ppoly is a oddbpolyline object.
1. step polyline segments and find intersection:
odgelineseg2d::intersectwith(<odgelineseg2d>, <odgepoint2d>, tol);
2. convert intersection point to 3d:
odgepoint3d::set(odgepoint2d::x, odgepoint2d::y, ppoly->elevation());
3. extract parameter at 3d crossing point:
ppoly->getparamatpoint(<odgepoint3d>, double&); // error: invalidinput
if it is know issue what would be work around?
regards,
gok
life would be so much easier if we could just look at the source codefff">fff">
the conversion to 3d
code:
odgepoint3d::set(odgepoint2d::x, odgepoint2d::y, ppoly->elevation());
is incorrect if polyline's normal differs from (0,0,1)
if your polyline has normal (0,0,1) and you use latest dd version (2.2) please provide more information how to reproduce the problem. (some tolerance issues were fixed in latest release).
sergey slezkin
hello, sergey.
did double check polyline normal and it is (0,0,1). and i'm with latest ddwg 2.2.0.
did cook small app for your testing and putted it on my ftp (yours attach on web page is broken):
go to gok/ddwg folder for getparam.zip. it is a msvc6.0 project with sample drawing in debug folder.
i think tolerance should be an input parameter or served by global var for this method.
please, let me know the debugging results and your thoughts.
regards,
gok
life would be so much easier if we could just look at the source codefff">fff">

additional info might help to narrow down the problem.
was trying to "improve" point position and add closest point command:
odgepoint3d closest;
odresult res = ppoly->getclosestpointto(pp3d, closest);
res = ppoly->getparamatpoint(closest, param);
even 'closest' is exact the same as pp3d i'm loosing all my crossing points with einvalidinput.
help!!
life would be so much easier if we could just look at the source codefff">fff">
last edited by gok; 1st march 2007 at 05:32 pmfff">.
in your sample drawing coordinates are of values like 1.e+6 - 1.e+7.
double values have 16-17 valid decimal digits. so default tolerance 1.e-10 does not work for your drawing.
most ge functions accept tolerance as parameter but db (like getparamatpoint()) - not. they use default tolerance.
the default tolerance can be altered:
code:
odgetol tol(1e-9);
odgecontext::gtol = tol;
but it would be better to restore it after your intersection operation to avoid possible problems in other places.
for example:
code:
class temptolerance
{
odgetol m_savedtol;
public:
temptolerance(double tolval)
{
m_savedtol = odgecontext::gtol;
odgecontext::gtol.setequalpoint(tolval);
odgecontext::gtol.setequalvector(tolval);
}
~temptolerance()
{
odgecontext::gtol = m_savedtol;
}
};
// usage:
.....
{
temptolerance mytol(1.e-9); // set temporary tolerance
...
// do something
...
} // mytol goes out of scope. default is restored
the default will be restored in case of exception also
sergey slezkin

hello, sergey.
following your results i shifted origin for polylines and it works fine with default tolerance. do you think acadmap doing the same thing for each command or there is some global origin shift to improve accuracy?
by the way, what is the future of odgepolyline3d::setfitpointat()? it exists for 2d polyline so it shouldn't be a problem to add the same for 3d.
best regards,
gok
life would be so much easier if we could just look at the source codefff">fff">
you are absolutely right that the reason of precision loss is subtracting large values that are "close" to each other. i don't know how acad handles this situation (moving the points to an area around origin improves the precision but causes an overhead).
fit points and other spline-related functionality is not implemented in odgepolyline2d too.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】getting a poin yang686526 DirectDWG 0 2009-05-05 11:25 AM
【转帖】position of a surface poin yang686526 American standards 0 2009-04-29 09:19 PM
【转帖】how to select the arc by a named center reference poin yang686526 SolidWorks二次开发 0 2009-04-13 12:02 PM
【转帖】creating a reference poin on a surface yang686526 SolidWorks二次开发 0 2009-04-12 08:36 PM


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


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