几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】problem in dwf impor (http://www.dimcax.com/hust/showthread.php?t=18027)

yang686526 2009-05-06 10:45 PM

【转帖】problem in dwf impor
 
problem in dwf import
problem in dwf import
hi,
i m using dwgdirect 1.14.02.00, i m facing a problem in importing the dwf file, using this code
pmodule = :drxdynamiclinker()->loadmodule("dd_dwf7import.drx");
hmodule hmodule = reinterpret_cast<hmodule>(pmodule->sysdata());
if(hmodule)
{
typedef oddwfimportptr (*pimporterfactory) ();
if ( pimporterfactory importerfac = (pimporterfactory)getprocaddress( hmodule,
"?createimporter@@ya?av?$odsmartptr@voddwfimport@@ @@xz" ) )
importer = importerfac();
}
#endif
#if _toolkit_in_dll_ || _msc_ver < 1300
oddwfimportptr pimporter = createimporter();
{
m_breadingdwf = true;
odrxobjectptr pt=null;
importresult pres;
oddbdatabaseptr pdb;
odstaticrxobject<myservices> svcs;
odinitialize(&svcs);
pdb = svcs.createdatabase();
pt=importer->properties()->putat("database", pdb);
pt=importer->properties()->putat("dwfpath", odrxvariantvalue(odstring(filename)));
pt=importer->properties()->putat("password", odrxvariantvalue(odstring("")));
pt=importer->properties()->putat("paperwidth", odrxvariantvalue(297.0));
pt=importer->properties()->putat("paperheight", odrxvariantvalue(210.0));
pt=importer->properties()->putat( "preservecolorindices", odrxvariantvalue( true ) );
importer->properties()->putat( "layoutnumber", odrxvariantvalue(odint32(-1)) );
importer->properties()->putat( "importw3d", odrxvariantvalue(true) );
pres = (importresult)importer->import();
////////////////////////////////////////////////////////////////////////////////
/////////////
import() function returns with a success,
but database ptr remain empty.......no entities are loaded in it......
is there any specific drx that causes this problem, that i forget to link, or anything i needed to do in the code to get it done............
thanks
mani
last edited by cad-mind; 13th november 2006 at 12:34 amfff">.
for me the code is right.maybe all data are set into paperspace. try to post the file.
nope......i create a new file all entities in model space....
export it as dwf (it export it... fine).........then try to import it............
this import function excutes successfully........but then db pointer remains empty......
when you export have you tried to set version "binary dwf v5.5" or version more older? have you obtain the same result when you import? if you open the file with autodesk dwf viewer can you see right the file?
yeah....i do
autocad dwf viewer display the file absolutly fine.....
the thread with title "import dwf in dwgdirect 2.0.03" maybe it can help you.
can you read the file in attach?
attached files (2.0 kb, 14 views)

same as others.......import ends up with success but db pointer still empty
i have the some problem if i use release version of dll. can you try to use debug version?
well....sry, but it is not working still.....
r u using the same version 1.14.02
now i am using 2.1 version, but it is the same when i use 1.14.03 1.14.02 and 1.14.01. code work fine if use 1.13. i use visual c++ 6.0. i see odamfcappdll.exe work fine. it is the same with your dwf file?
try to add reactor to database. see if it is called.
(look at e.g. odamfcappdoc.cpp, 200 - 230)
vladimir
in debug version there isn't problem to read dwf file so the trace i think it is not util.
reactor may print debug message to file, not to debug window.
are you also having problems with import? (you did not specify what problems)
vladimir
yes i do. i don't read dwf file in release version when they are "binary dwf v6.0" or "zipped ascii enc.2d st.v6.0". the code is like above.
i tried to use reactor. i add to my code
class tracedbreactor : public odstaticrxobject<oddbdatabasereactor>
{
public:
void objectappended(const oddbdatabase* /*pdb*/, const oddbobject* pobj)
{
oda_trace2("<objectappended : %s, %s>\n", pobj->isa()->name().c_str(), pobj->objectid().gethandle().ascii().c_str());
}
.....
....
}
}
g_tracedb
into my database i add pdb->addreactor(&g_tracedb);
how i can do to write the trace route into file?


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