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