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

yang686526 2009-05-05 11:15 AM

【转帖】get line name
 
get line name
get line name
hello
i have a problem when obtaining the name of an object of the following form
code:
odstring (circle_->isa()->name());
whit this exception:
code:
excepci髇 no controlada en 0x20e0f921 (dwgannotd.dll) en 3dviewerd.exe: 0xc0000005: infracci髇 de acceso al leer la ubicaci髇 0x00000000.
thanks klvin
hello
are you sure that pointers are not null ?
the first line work ok but the second try exception...
code:
odgepoint3d centerpoint = circle_->center();
std::string isa (circle_->isa()->name());
thx klvin
does
code:
circle_->isa()->name();
throw exception too ?
did circle_->isa() return null ?
did circle_->isa() return null ?
yes the result that line is null!!!
there is some other form to obtain the name?
rxobject.h has odrxclass* classname::isa() const { return g_pdesc; }
g_pdesc must be initialized by oddbcircle::rxinit() call in user application. i think that mfcapp hasn't problems with your code. very big changes that your application forgot about oddbcircle::rxinit().
one moment also - toolkit has method odinitialize(this); it calls rxinit for all libraries classes.
quote:
one moment also - toolkit has method odinitialize(this); it calls rxinit for all libraries classes.
i already initialize the bookstores without no error
code:
bool dwgapplication::launch()
{
std::cout << "launching dwg" << std::endl;

//inicializamos dwgdirect
boost::format berr ("\nerror al inicializar directdwg: %1%");
try
{
// funci髇 para la inicializaci髇 de dwgdirect.
odinitialize(&svcs_);
} catch (const oderror& e)
{
berr % svcs_.geterrordescription(e.code());
std::cout << berr.str().c_str() << std::endl;
return false;
}
return true;
}
hello,
does your application fully based on mfcapp or other our sample ?
please, insert next code after odinitialize and in place before exception. is it return exception in both variants?
odrxclass* prx = oddbcircle::desc();
oddbcircleptr pc = oddbcircle::createobject();
odrxclass* prx2 = pc->isa();
thanks for the aid, already i have solved it?the problem is that it made a call to
code:
oduninitialize ();
now i have the following code
code:
std::string isa (circle_->isa()->name());
std::string name (circle_->getdbhandle().ascii());
return (isa + " - " + name);
i obtain isa correctly () but the sentence getdbhandle () gives back 0 to me, i don磘 know!!!
is oduint64 n = getdbhandle() return '0' ?
it means that your object is non database resident yet. object was created by ::createobject, but it wasn't added to database.
next code will add pcircle to modelspace.
oddbdatabaseptr pdb = ...;
oddbblocktablerecordptr pms = pdb->getmodelspaceid().safeopenobject(oddb::kforwrite) ;
pms->appendoddbentity( pcircle );


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