几何尺寸与公差论坛------致力于产品几何量公差标准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 naming a block record (http://www.dimcax.com/hust/showthread.php?t=18030)

yang686526 2009-05-06 10:46 PM

【转帖】problem in naming a block record
 
problem in naming a block record
problem in naming a block record
hi
when i execute this code i get a null insted of the block record which i added. please note that the block record starts with a '*'.
================================================== ========
pdatabase = svcs.createdatabase(true, oddb::kmetric);
char symbol_name[char_buffer_lenght];
odstring block_name(symbol_name);
oddbblocktableptr pblocktable;
oddbblocktablerecordptr pblock;
// getting block table from a database
pblocktable = pdatabase->getblocktableid().safeopenobject(oddb::kforwrite) ;
// creating a new block
pblock = oddbblocktablerecord::createobject();
pblock->setname(block_name = "*test");
// adding it to a block table
pblocktable->add(pblock);
pblock.release();
oddbobjectid objid = pblocktable->getat(block_name);
================================================== ========
the object objid.isnull() = true
"*" is invalid symbol for "ordinary" block names. anonymous block names start with "*".
anonymous block names do not need to be set unique. a numbers representing index of the block in block table is appended to the name.
after you add "*test" block to the block table it actually gets name "*test<nnn>"
names starting with "*" should not be used for non-anonymous blocks.
sergey slezkin


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