查看单个帖子
旧 2009-05-06, 09:24 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)