几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】opendwg and vc==.ne (http://www.dimcax.com/hust/showthread.php?t=17803)

yang686526 2009-05-06 09:24 PM

【转帖】opendwg and vc==.ne
 
opendwg and vc++.net
opendwg and vc++.net
hi,
i've modified the odreadex.cpp file of the odreadex sample. the program compiles and runs well. now i want to put the modified code in a new project without all the unnessary stuff of the odreadex sample and use this code in a vc++.net project (with managed code). how can i realise this? which files e.g. do i need to include?
the code i want to use in my .net app is as follows:
try
{
// create a database and load the drawing into it.
oddbdatabaseptr pdb;
pdb = svcs.readfile(filename, false, false, oda::ksharedenyno );
if (!pdb.isnull())
{
oddbblocktablerecordptr pspace = pdb->getmodelspaceid().safeopenobject();
oddbobjectiteratorptr pi = pspace->newiterator();
for (pi->start(); !pi->done(); pi->step()) {
oddbentityptr pent = pi->entity();
if (pent->iskindof(oddbblockreference::desc())) {
oddbblockreferenceptr pblockref = pent;
oddbobjectiteratorptr poi = pblockref->attributeiterator();
while( !poi->done() )
{
oddbattributeptr pattr = poi->entity();
if (!pattr->isconstant())
std(cout) << pattr->tag() << pattr->textstring());
poi->step();
}
}
}
}
else
{
std(cout) << "error: cannot open file.";
}
}
catch (oderror& e)
{
std(cout) << "dwgdirect error: " << svcs.geterrordescription(e.code()).c_str()
<< std(endl) << std(endl);
}
catch (...)
{
std(cout) << "unknown error." << std(endl) << std(endl);
}
}
you need to include your implementation of oddbhostappservices and oddbsystemservices interfaces. or you can use exhostappservices and exsystemservices sample implementations.
if you use them you'll need to include odfilebuf.
as for exgirasterimage and exundocontroller you can exclude them from the project but remove references to them from exservices - simply return null from corresponding functions.
sergey slezkin
thanks for your reply. i've done what you said. now i want to make a dll from the project so that i can invoke the function that i've made from my managed c++ project. do you know how i can realize that?
thanks in advance.


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