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

dwf read
dwf read
i want read a dwf file and add to oddbdatabase.
i write:
odgsmoduleptr pmodule = :drxdynamiclinker()->loadmodule("dd_svgexport.drx");
if (pmodule.isnull())
afxmessagebox( "dd_svgexport.drx is missing" );
else
{
???
}
what i do write?
there isn't an example for this?
help me
see \examples\oddwfexportex\oddwfexportex.cpp, 190 - 205
vladimir
vladimir,
i, too, have been trying to load a dwf file into an oddbdatabase. i built a test 'app' based upon the example you mention, but when i do the following ...
odstaticrxobject<myservices> svcs;
odinitialize(&svcs);
oddwfimportptr importer = createimporter();
if (!importer.isnull())
{
oddbdatabaseptr pdb = svcs.createdatabase();
importer->properties()->putat( "database", pdb );
" "
" "
}
...the putat() call throws an exception where the exception string in ....
svcs.geterrordescription(e.code()).c_str())
.... says "not yet initialized"....
any idea what i'm missing?
smallest program that takes dwf file as input and writes dwg as output looks like this.
i checked it on latest 1.14 and it works.
code:
#include "odacommon.h"
#include "dbdatabase.h"
#include "rxobjectimpl.h"
#include "exsystemservices.h"
#include "exhostappservices.h"
#include "odfilebuf.h"
#include "rxvariantvalue.h"
#include "../../imports/dwfimport/include/dwfimport.h"
class myservices : public exsystemservices, public exhostappservices
{
odrx_using_heap_operators(exsystemservices);
};
int main(int argc, char* argv[])
{
odstaticrxobject<myservices> svcs;
odinitialize(&svcs);
oddwfimportptr importer = createimporter();
oddbdatabaseptr pdb = svcs.createdatabase();
importer->properties()->putat( "database", pdb );
importer->properties()->putat( "dwfpath", odrxvariantvalue( odstring(argv[1]) ) );
importer->import();
importer = 0;
odwrfilebuf fb(argv[2]);
pdb->writefile(&fb, oddb::kdwg, oddb::kdhl_current);
pdb = 0;
oduninitialize();
return 0;
}
"not initialized yet" is thrown when anything is done when odinitialize was not called yet.
vladimir
vladimir,
i played around some more with the .libs i was building with and i did finally manage to get past that exception.
thanks for your help and for the simple example.
- pete
but now i'm getting a different exception. it looks like everything's working beautifully until i try...
odwrfilebuf fb(newfilename);
pdb->writefile(&fb, oddb::kdwg, oddb::vac15);
...the writefile() function seems to work for a while but then it throws an exception that says "was open for write".
it does manage to create a .dwg file, but autocad says it's not valid, so something obviously went wrong in writing it. i can upload the .dwf if you like (it's the autocad sample "blocks and tables.dwf".
- pete
kill importer before writing database
vladimir
vladimir,
thanks - you're right i had not noticed that i was skipping that step from your example.
thanks again.
pete
memory leak dwf import
import dwf work fine but there are memory leaks.
i try to import a dwf file with odamfcapp and when exit compile detected memory leaks. i work with visual studo 6.
i must kill importer?
how i do this?
i use your smallest program write above.
easy....
// kill importer
importer = 0;
quote:
originally posted by rareba
i must kill importer?
how i do this?
i use your smallest program write above.
there were some memory leaks found/fixed in dwfimport in 1.14.02
did you try it?
vladimir
quote:
originally posted by wvk
there were some memory leaks found/fixed in dwfimport in 1.14.02
did you try it?
i try it.
in odamfcappdoc when i export (exportdwf) if use
params.format = dw_uncompressed_binary;
params.version = ndwf_v60;
or
params.format = dw_ascii;
params.version = ndwf_v60;
my compiler detected memory leaks.
i said only about import
vladimir
in import there aren't memory leak but there are some dwf file i read with 1.14.01 and make error with 1.14.02.in attach file error's image.
attached images (27.6 kb, 16 views)
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】can only read file once yang686526 DirectDWG 0 2009-05-04 05:24 PM
【转帖】avoiding to read block definitions as entities yang686526 DirectDWG 0 2009-05-04 04:33 PM
【转帖】notes on drawings not being read yang686526 American standards 0 2009-04-29 09:00 PM
【转帖】dont prompt to save read-only reference documents 9discard yang686526 SolidWorks二次开发 0 2009-04-13 10:30 AM


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


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