![]() |
【转帖】creating block with name starting with
creating block with name starting with *
creating block with name starting with * i try to create a block with a name starting with a * the blockname needs to start with a '*' because in autocad, blocks starting with a * do not appear in the block explorer. when i use the blockname "*d0", dwgdirect converts the blockname to "*d01". is there a way, that i can create a block with name "*d0" without dwgdirect changing the name? the code i use is here below oddbblocktablerecordptr pentry; oddbblocktablerecordptr pblock; oddbblocktableptr ptable; pentry = oddbblocktablerecord::createobject(); pentry->setname("*d0"); ptable = pdb->getblocktableid().safeopenobject(oddb::kforwrite) ; cur_blockid = ptable->add(pentry); block "*d01" is created instead of "*d0" hi, dd, just like autocad, uses *d# block names for dimensions. blocks prefixed with '*' are anonymous and it's allowed to create a few such blocks with the same name, these blocks are always postfixed with a number that is the index of a block in table in current session. so such blocks always should be referenced by their object id. ptable = pdb->getblocktableid().safeopenobject(oddb::kforwrite) ; pentry = oddbblocktablerecord::createobject(); pentry->setname("*d"); oddbobjectid id1 = ptable->add(pentry); pentry = oddbblocktablerecord::createobject(); pentry->setname("*d"); oddbobjectid id2 = ptable->add(pentry); this code will create 2 blocks: *dn (e.g. *d0) *dn+1 (e.g. *d1) the appended numbers depend on how many blocks (besides *model_space and *paper_space) there are in the block table. so the answer to your question is no. you can't create anonymous block with without dwgdirect changing the name. last edited by dmitry a. novikov; 2nd february 2006 at 02:36 amfff">. besides, anonymous blocks may have only one letter for name. the only exceptions are space names. vladimir ...and non-referenced anonymous blocks are purged by autocad at file load... sergey slezkin quote: originally posted by wvk besides, anonymous blocks may have only one letter for name. the only exceptions are space names. acad does something strange with names of anonymous blocks... i tried to create anonymous block with "*anon0" in dxf file. every time acad (both 2000 and 2006) opens this file it appends index, so after 2 saves and openings i got block with name "*anon000". then i tried "*a0" and got the same result. so only "*u0" name would not grow (it also works with "*d", but does not work with "*e","*h"). hi, thanks very much for the explanation. i will use the object id instead of the blockname. the reason i use an anonymous block, is that an anonymous block does not appear in the block explorer in autocad. i use anonymous blocks to group elements. this blocks do not have a meaningfull name for the user. |
所有的时间均为北京时间。 现在的时间是 09:01 AM. |