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

oddbdatabase::insert
oddbdatabase::insert
hi
i want to insert several drawings into one target drawing. the code looks like:
code:
odstaticrxobject<myservices> *svcs = new odstaticrxobject<myservices>();
odinitialize(svcs);
...
// created this and already added some entities
oddbdatabaseptr targetdb = ...;
// srcfiles is an array containing all (3 in this simple case) src file names
for (int i=0; i<3; i++) {
oddbdatabaseptr srcdb = svcs->readfile(srcfiles[i]);
targetdb->insert(/* some block name */, srcdb);
}
odwrfilebuf filebuffer(targetfilename);
targetdb->writefile(&filebuffer, oddb::kdwg, oddb::vac18);
oduninitialize();
the writefile call fails with a "zugriffsverletzung-leseposition 0x013659d4" (freely translated 'accessviolation-address'). below is the stack trace.
code:
tbdwgbuilder.dll!odobjectdwgoutstream::wrsoftpointerid() + 0x16 c++
tbdwgbuilder.dll!oddbobject::dwgoutfields() + 0x13c c++
tbdwgbuilder.dll!oddbentity::dwgoutfields() + 0x2b c++
tbdwgbuilder.dll!oddbline::dwgoutfields() + 0x35 c++
tbdwgbuilder.dll!oddwgstream::wrbool() + 0x67 c++
tbdwgbuilder.dll!oddwgwriter::saveobject() + 0x383 c++
tbdwgbuilder.dll!oddwgwriter::wrobjects() + 0xd7 c++
tbdwgbuilder.dll!oddwgr18filewriter::wrobjects() + 0xf5 c++
tbdwgbuilder.dll!oddwgr18filewriter::writedatabase() + 0xb7 c++
tbdwgbuilder.dll!oddbdatabase::writefile() + 0x5eb c++
i did a very simple application that inserts one dwg into a target dwg and this simple example worked. so it might be that nothing is wrong with the code.
what else could be wrong? do i miss to initialize everything properly?
i'm using visual studio .net 2003 on windows xp, just in case that this matters.
???
simon
oddbdatabase:insert problem (additional information)
ok, i created a simple test program (see below) that fails with the described exception (see my last post). can anybody tell me what's wrong with the code? another interesting point: if i omit the for loop it works!!! i'm sure i'm just missing something.
any help?
simon
code:
#include "odacommon.h"
#include "dbdatabase.h"
#include "tables.h"
#include "entities.h"
#include "objects.h"
#include "rxobjectimpl.h"
#include "exsystemservices.h"
#include "exhostappservices.h"
#include "odfilebuf.h"
using namespace std;
class myservices : public exsystemservices, public exhostappservices
{
protected:
using exsystemservices:perator new;
using exsystemservices:perator delete;
};
int _tmain(int argc, _tchar* argv[])
{
odrxobjectimpl<myservices> svcs;
odinitialize(&svcs);
oddbdatabaseptr psrcdb = svcs.createdatabase();
if (argc > 1)
{
{
oddblayertableptr players = psrcdb->getlayertableid().safeopenobject(oddb::kforwrite);
oddblayertablerecordptr player = oddblayertablerecord::createobject();
player->setname(odstring("test"));
players->add(player);
}
for (int i=1; i<argc; i++)
{
odstring blockname;
blockname.format("%i", i);
oddbdatabaseptr pdb = svcs.readfile(argv[i], false, false);
psrcdb->insert(blockname, pdb, true);
}
odwrfilebuf fb("out.dwg");
psrcdb->writefile(&fb, oddb::kdwg, oddb::vac18);
}
psrcdb.release();
oduninitialize();
return 0;
}
hi,
the code seems ok. i tested on vs6, win2000 (i don not think that .net is the cause).
what version of ddt do you use? if it is the last one, could you send me a file that produces crash?
best regards,
sergey
hi,
i have the same problem. what is ddt?
dwgdirect toolkit
regards,
sergey vishnevetsky
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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



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


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