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

dwf export problem
dwf export problem
hi,
i have problems with dwf export. i have built a database (pddb) which i am able to export either in dwg or in dxf formats. however, if i try to export in dwf format i got error messages related to the heap (then an unhandled exception), when i am using the following code:
dwexportparams params;
params.binkedarea = false;
params.bcolormapoptimize = false;
if (!strcmp(version,"b6"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v60;
}
...//other cases here
else
{
std(cout) << "unknown <outversion>." << std(endl);
return;
}
params.pdb = pddb;
params.sdwffilename = exportfile + ".dwf";
params.background = odrgb(255, 255, 255);
params.ppalette = odcmacadlightpalette();
exportdwf(params);
i can avoid this using a hack: first export in dwg format, then import using a locally generated service object and then export in dwf format (i am not particularly fond of this solution, but at least it worked.)
the hacked code:
dwexportparams params;
params.binkedarea = false;
params.bcolormapoptimize = false;
if (!strcmp(version,"b6"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v60;
}
...//other cases here
else
{
std(cout) << "unknown <outversion>." << std(endl);
return;
}
//hack
odrxobjectimpl<dwgservices> svcs1;
odinitialize(&svcs1);
oddbdatabaseptr pdb;
//hack, there is a heap problem...
pdb = svcs1.readfile(gui::gettempfilepath( gui::getdoctitle()+ ".dwg" )); //this is tjhe previous exported file
params.pdb = pdb;
params.sdwffilename = exportfile + ".dwf";
params.background = odrgb(255, 255, 255);
params.ppalette = odcmacadlightpalette();
exportdwf(params);
oduninitialize();
my main problem (i have many :-) now is that even this does not work in release mode.
any suggestions?
thanks, miklos
what i forgot ...
i forgot to mention that i am using the 1.13 version of the toolkit, windows xp, dd_vc6 and dd_vc6dbg and that the dwf file produced in release mode contains no data, only this (in debug the result seems ok):
(dwf v00.42)
(endofdwf)
thanks again, miklos
quote:
originally posted by erdelyiszabo
hi,
i have problems with dwf export. i have built a database (pddb) which i am able to export either in dwg or in dxf formats. however, if i try to export in dwf format i got error messages related to the heap (then an unhandled exception), when i am using the following code:
dwexportparams params;
params.binkedarea = false;
params.bcolormapoptimize = false;
if (!strcmp(version,"b6"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v60;
}
...//other cases here
else
{
std(cout) << "unknown <outversion>." << std(endl);
return;
}
params.pdb = pddb;
params.sdwffilename = exportfile + ".dwf";
params.background = odrgb(255, 255, 255);
params.ppalette = odcmacadlightpalette();
exportdwf(params);
i can avoid this using a hack: first export in dwg format, then import using a locally generated service object and then export in dwf format (i am not particularly fond of this solution, but at least it worked.)
the hacked code:
dwexportparams params;
params.binkedarea = false;
params.bcolormapoptimize = false;
if (!strcmp(version,"b6"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v60;
}
...//other cases here
else
{
std(cout) << "unknown <outversion>." << std(endl);
return;
}
//hack
odrxobjectimpl<dwgservices> svcs1;
odinitialize(&svcs1);
oddbdatabaseptr pdb;
//hack, there is a heap problem...
pdb = svcs1.readfile(gui::gettempfilepath( gui::getdoctitle()+ ".dwg" )); //this is tjhe previous exported file
params.pdb = pdb;
params.sdwffilename = exportfile + ".dwf";
params.background = odrgb(255, 255, 255);
params.ppalette = odcmacadlightpalette();
exportdwf(params);
oduninitialize();
my main problem (i have many :-) now is that even this does not work in release mode.
any suggestions?
thanks, miklos
i would advise you to have a look on oddwfexportex and odamfcapp samples once more.
oddwfexportex is the simplest sample using dwfexport.
misha kuzinets
thank you, that was really helpful. especially, since that was the code fragment i started with.
btw it was possible to eliminate the detour to dwg (that was a rather unfortunate effort to make things work ). still i cannot produce a dwf file in release mode, and i can in debug. what made things work in debug (i think, maybe wrong) is the construction of a local service object (a strange requirement...) and it seems less then enough in release mode.
but since you are not interested, i stop here.
miklos
quote:
originally posted by misha kuzinets
i would advise you to have a look on oddwfexportex and odamfcapp samples once more.
oddwfexportex is the simplest sample using dwfexport.
miklos,
your code looks like oddwfexportex. looking at this fragment of code i can't see whether your sample has all necessary things as odinitialize and others.
you could compare your sample with oddwfexportex for checking an environment around dwf export. the first idea is you miss something but i can't determine what from given fragment.
also you can send your sample wholly or complete part of dwf export code by private message. i could include this one into sample for checking.
misha kuzinets
misha,
sorry i sounded pissed, i was just frustrated. my code is now this (still works only in debug, and practically the same as the one i have sent, though i am through with lots of experimentations:-)
note: pdddb below is a member of the class gdxfview, and its content is ok when the execution reaches this point: i am able to export it in any formats (debug or release, dxf, dwg, dwf) except release dwf. the class here (gdxfview) already has a services member - that caused no problems before this (ie before i tried dwf export). that i needed a new object (svcs1) below was sort of a surprise - but without that even the 'debug dwf' did not work.
odinitialize and oduninitialize are your original functions - they were not overwritten, i don't know if that's even possible (or would have any use).
void gdxfview::writedwf( const char* version )
{
odrxobjectimpl<dwgservices> svcs1;
odinitialize(&svcs1);
dwexportparams params;
params.binkedarea = false;
params.bcolormapoptimize = false;
if (!strcmp(version,"b6"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v60;
}
else if (!strcmp(version,"a6"))
{
params.format = dw_ascii;
params.version = ndwf_v60;
}
else if (!strcmp(version,"c5.5"))
{
params.format = dw_compressed_binary;
params.version = ndwf_v55;
}
else if (!strcmp(version,"b5.5"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v55;
}
else if (!strcmp(version,"a5.5"))
{
params.format = dw_ascii;
params.version = ndwf_v55;
}
else if (!strcmp(version,"c4"))
{
params.format = dw_compressed_binary;
params.version = ndwf_v42;
}
else if (!strcmp(version,"b4"))
{
params.format = dw_uncompressed_binary;
params.version = ndwf_v42;
}
else if (!strcmp(version,"a4"))
{
params.format = dw_ascii;
params.version = ndwf_v42;
}
else
{
std(cout) << "unknown <outversion>." << std(endl);
return;
}
params.pdb = pdddb;
params.sdwffilename = exportfile + ".dwf";
params.background = odrgb(255, 255, 255);
params.ppalette = odcmacadlightpalette();
try
{
exportdwf(params);//opendwg function call
}
catch( oderror& e )
{
cstring err = svcs.geterrordescription(e.code()).c_str();
std(cout) << "error :" << err << std(endl);
}
pdddb.release();
oduninitialize();
}
thanks, miklos
quote:
originally posted by misha kuzinets
miklos,
your code looks like oddwfexportex. looking at this fragment of code i can't see whether your sample has all necessary things as odinitialize and others.
you could compare your sample with oddwfexportex for checking an environment around dwf export. the first idea is you miss something but i can't determine what from given fragment.
also you can send your sample wholly or complete part of dwf export code by private message. i could include this one into sample for checking.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】dwf export problem - compressed binary 6.0 yang686526 DirectDWG 0 2009-05-04 08:19 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


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


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