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

yang686526 2009-05-06 07:57 PM

【转帖】oddbobjectid to charin
 
oddbobjectid to char/int ..
oddbobjectid to char/int ..
hi,
i need to get oddbobjectid in terms of int or char.
is it possible to get that?
basically i am trying to get unique character/integer value for each entity, so could you please help me out??
thanks in advance.
would using an oddbhandle work for you?

i use the following code to get the object id based on the handle:
code:
void getobjectid(char *ahandle)
{
oddbhandle objhandle(ahandle);
oddbobjectid objid = pdb->getoddbobjectid(objhandle);
}you can see that i am using handles to retrieve the object ids. i read somewhere that handles are unique in the database. if you have a better way i would also like to know about it.
to get the handle i use:
code:
#define handle_size 20
void gethandle(char **ahandle)
{
// add entity
...
// allocate memory for handle
(*ahandle) = (char *) malloc(handle_size * sizeof(char));
oddbhandle objhandle = pobj->getdbhandle();
odchar odhandle[handle_size];
objhandle.getintoasciibuffer(odhandle);
for (int j = 0; j < handle_size; j++)
(*ahandle)[j] = (char) odhandle[j];


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