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

what error will cause the "was open for write" exception?
what error will cause the "was open for write" exception?
hi,
now i am using the dd2.1.1 for net2003. for some case, when calling oddbdatabase::writefile to write the dwg file, it throws the "was open for write" exception. what error will cause this exception?
any help appreciated.
you might try checking the smart pointer you used.
any smart pointer object that's opened must be released before writing to file.
is there any way let me know which smart pointer is not releaqsed?
is there any way let me know which smart pointer is not released before writing file?
oderror::description() may help you to find out object id of opened object (but not a smart pointer in your programm).
sergey slezkin
if i call the detach() on some smart pointers, then there is no the "was open for write" exception. but i found that in some case i need call this function, in other cases i should not call it, or it will cause other issues.
is there any better way to fix it?
any help appreciated
by the moment you call writefile() you should have no smart pointers pointing to database (which is to written to file) objects except the pointer to the database.
detach() is wrong method to use.
you should call
pointer = 0;
or
pointer.release() // !! not pointer->release()
or if you your pointers go put of scope it's safe too.
{
oddbobjectptr pobj;
.....
}
// here you can safely call writefile()
sergey slezkin
thanks for your reply.
actually, i always use smart pointer in my application for any oddb... object.
now if i call the release function on the smart pointer, it will throw an "invalid input" exception.
so, how can i know which input is invalid when the release function is called on the dim style record smart pointer?
is "invalid input" exception thrown at the moment you release smart pointer or at the moment you call writefile()?
the pointer is to dimstyle table record or dimension?
sergey slezkin
"invalid input" exception thrown at the moment i released the smart pointer to the dimstyle table record.
any suggestions?
what's the contents of call stack at the moment exception is thrown?
sergey slezkin
there is an assert in the release of the dimstyle table record smart point. please refer to the attached invalidinput.jpg.
when thrown the "invalid input" exception, the call stack is as following:
msvcr71d.dll!_assert(const char * expr=0x0886d4b8, const char * filename=0x0886d480, unsigned int lineno=24) ?295 c
dd_root.dll!086cf088()
dd_root.dll!086cf108()
dd_ge.dll!087fad40()
dd_ge.dll!087cfe70()
dd_ge.dll!0885fe67()
recomputedimblock.drx!14a38800()
attached images (22.7 kb, 4 views)

without debug info in stack (function names, line numbers) i only can say that:
at the moment you close the dimension style record blocks for dimension entities referencing this dimstyle are recomputed.
most likely some dimension entity referencing this style has invalid geometry. block recomputing fails while attempting to normalize some vector or trying to calculate normal to a plane.
to determine which dimension entity is incorrect you can try:
1. create dimension style and release its smart pointer.
2. create dimension entities for this style and release their smart pointers.
you'll get the exception releasing smart pointer for the offending dimension entity.
most probably the defect will be obvious like coincident points which must differ.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】what Does Exception Ewasopenforwrite Indicat yang686526 DirectDWG 0 2009-05-07 06:46 PM
【转帖】odgsinitialize90 throwing exception yang686526 DirectDWG 0 2009-05-06 08:56 PM
【转帖】appendloop90 exception question yang686526 DirectDWG 0 2009-05-04 04:05 PM
【转帖】ado.net access操作方法 yang686526 ObjectARX(VB.NET/C#) 0 2009-04-19 09:37 PM
【转帖】open with....edrawings2009 yang686526 SolidWorks二次开发 0 2009-04-13 01:13 PM


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


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