高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】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)
|