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

oddbhatch::appendloop exception
oddbhatch::appendloop exception
i am using the following code to create a hatch:
code:
dword dwrgb = 0;
oddbobjectidarray aobjs;
// ...fill the array with closed oddbpolyline objects
oddbhatchptr phatch;
phatch->setpattern(oddbhatch::kpredefined, "solid");
phatch->setassociative(true);
phatch->sethatchstyle(oddbhatch::knormal);
phatch->setcolorindex(lookupaci(dwrgb));
phatch->appendloop(oddbhatch::kexternal, aobjs);
the call to appendloop throws exception 5 (invalid input) every time i call appendloop and the oddbobjectidarray contains more than one object id. (it works fine when the array contains exactly one object id.) i also get the following exception: (kernel32.dll): 0xe06d7363: microsoft c++ exception.
what constitues "invalid input" for this method?
thanks,
bob
ps...i am using visual c++ 6.0 with dd version 1.11.01.
if you have a number of closed polylines they should be used for creating a number of loops.
from dbhatch.h"
code:
/** description:
appends a loop onto this hatch, in the form of a set of oddbentities.
a loop must be simple, closed, and continuous, intersecting itself only at its endpoints.
furthermore, its start point and end point must coincide. when defining the hatch boundary,
the application must ensure that the loops and edges are well defined and structured. if
the boundary contains two or more loops, they must be organized into a nested structure
in which the external loop is constructed first, then followed by all its internal loops
in nested order. if there is more than one external loop, repeat the process.
dwgdirect provides limited validation of the hatch boundary in order to maintain api efficiency
and performance.
arguments:
looptype (i) type of loop to be appended.
dbobjids (i) array of oddbentity object id's that make up the loop.
*/
void appendloop(odint32 looptype, const oddbobjectidarray& dbobjids);
sergey slezkin
precision problem?
i have a similar problem.
my oddbobjectidarray aobjs is a collection of oddblineptr
when it is
(x y) - (x y); z is always 0
(0.00083750 0.00112600) - (0.00103850 0.00112600)
(0.00103850 0.00112600) - (0.00103850 0.00113600)
(0.00103850 0.00113600) - (0.00083750 0.00113600)
(0.00083750 0.00113600) - (0.00083750 0.00112600)
everything is ok.
but when it is
(x y) - (x y)
(0.00008375 0.00011260) (0.00010385 0.00011260)
(0.00010385 0.00011260) (0.00010385 0.00011360)
(0.00010385 0.00011360) (0.00008375 0.00011360)
(0.00008375 0.00011360) (0.00008375 0.00011260)
i receive an exception: "invalid input"
what is the point of it? a precision?
thanks in advance
mk
last edited by michał krzesiak; 6th january 2006 at 05:56 amfff">.

you listed only first 8 digits after decimal comma. the default world tolerance is 1.0e-10. i. e. two points, a and b, are considered equal when a.distanceto(b) <= 1.0e-10. so possible reason of exception is difference in 9th or 10th digit.
sincerely yours,
george udov
there are only zeros:
(8.37500000000000e-005 1.12600000000000e-004) (1.03850000000000e-004 1.12600000000000e-004)
(1.03850000000000e-004 1.12600000000000e-004) (1.03850000000000e-004 1.13600000000000e-004)
(1.03850000000000e-004 1.13600000000000e-004) (8.37500000000000e-005 1.13600000000000e-004)
(8.37500000000000e-005 1.13600000000000e-004) (8.37500000000000e-005 1.12600000000000e-004)
error:
code = 209
description: "invalid input"
m_phostappservices->geterrordescription(code): "repair"
and besides, where can i read the world tolerane (the constant or function)

michal,
odgecontest::gtol is used by dd as world tolerance.
which version of dd do you use?
is it possible to prepare a short fragment of code, that will let me to reproduce the problem on my side?
sincerely yours,
george udov
last edited by george udov; 26th october 2005 at 01:20 amfff">.
hello
thanks for a fast reply.
my version is 1.13.02
i attached the dwg file (eksport_1.dwg) with a hatch from the example above, (that one i can save)
and the code, that generate exception - i've tested it and hope is ok
code:
void addhatch()
{
oddbblocktablerecordptr pms = m_pdb->getmodelspaceid().safeopenobject(oddb::kforwrite);
oddbhatchptr poddbhatch = oddbhatch::createobject();
poddbhatch->setdatabasedefaults(m_pdb);
poddbhatch->setlayer(m_player->getname());
poddbhatch->setpattern(oddbhatch::kpredefined, "solid");
poddbhatch->setassociative(true);
poddbhatch->sethatchstyle(oddbhatch::hatchstyle::knormal);
poddbhatch->appendseedpoint(odgepoint2d(0, 0));
oddbobjectidarray varray;
testtoedgearray(pms, varray);
poddbhatch->appendloop(oddbhatch::kexternal, varray); // <- error
pms->appendoddbentity(poddbhatch);
poddbhatch->evaluatehatch();
if (!m_pview.isnull())
m_pview->add(poddbhatch, 0);
}
void testtoedgearray(oddbblocktablerecordptr pms, oddbobjectidarray &aarray)
{
const int size = 4;
odgepoint3d p[size];
p[0] = odgepoint3d(8.37500000000000e-005, 1.12600000000000e-004, 0);
p[1] = odgepoint3d(1.03850000000000e-004, 1.12600000000000e-004, 0);
p[2] = odgepoint3d(1.03850000000000e-004, 1.13600000000000e-004, 0);
p[3] = odgepoint3d(8.37500000000000e-005, 1.13600000000000e-004, 0);
for (int i=0; i<size; i++)
{
int j = (i+1 < size ? i+1 : 0);
if (p[i].distanceto(p[j]) > 1.0e-10)
{
trace("(%0.14e %0.14e) (%0.14e %0.14e)\n", p[i].x, p[i].y, p[j].x, p[j].y);
oddblineptr pline = oddbline::createobject();
pline->setdatabasedefaults(m_pdb);
pline->setstartpoint(p[i]);
pline->setendpoint(p[j]);
oddbobjectid id = pms->appendoddbentity(pline);
aarray.push_back(id);
pline = null;
}
}
}
attached files (8.4 kb, 5 views)


michal, its bug of 1.13.02. fix will be available in 1.14.
sincerely yours,
george udov
quote:
originally posted by george udov
michal, its bug of 1.13.02. fix will be available in 1.14.
does it works correct now in 1.14.02?
best regards,
mk

dear michal,
was fixed in 1.14.
now oddbhatch::appendloop works same with objectarx's one acdbhatch::appendloop.
objectarx's function acdbhatch::appendloop uses absolute tolerance 1.0e-6 to compare loop points. so your points
code:
p[1] = odgepoint3d(1.03850000000000e-004, 1.12600000000000e-004, 0);
p[2] = odgepoint3d(1.03850000000000e-004, 1.13600000000000e-004, 0);
and
code:
p[0] = odgepoint3d(8.37500000000000e-005, 1.12600000000000e-004, 0);
p[3] = odgepoint3d(8.37500000000000e-005, 1.13600000000000e-004, 0);
will be considered equal. so your piece of code will still throw an invalid input exception
sincerely yours,
george udov
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】loadlinetypefile throws exception yang686526 DirectDWG 0 2009-05-06 05:17 PM
【转帖】first-chance exception yang686526 DirectDWG 0 2009-05-05 10:59 AM
【转帖】exception using inser yang686526 DirectDWG 0 2009-05-05 10:01 AM
【转帖】exception in safeopenobject90 yang686526 DirectDWG 0 2009-05-05 09:59 AM
【转帖】appendloop90 exception question yang686526 DirectDWG 0 2009-05-04 04:05 PM


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


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