adding attributes
adding attributes
hi!
i need to add some attributes in a dxf file, thickness and material type. i'm kind of new to this and have managed to puzzle below function together.
code:
oddbobjectid centity_utils:

ncreateblock( oddbdatabaseptr pdb, odstring blkname )
{
// open the block table
oddbblocktableptr pblocks = pdb->getblocktableid().safeopenobject(oddb::kforwrite) ;
//attempt to find the block before inserting
oddbobjectid blkid = pblocks->getat(blkname);
if(blkid.isnull()){
//create block here
oddbblocktablerecordptr pentry = oddbblocktablerecord::createobject();
// block must have a name before adding it to the table.
pentry->setname(blkname);
//create text attribute material type
oddbattributedefinitionptr def = oddbattributedefinition::createobject();
odstring strmaterialtype = (lpctstr)::api_fcc_get_view()->m_strmaterialstring;
def->setprompt("enter material type");
def->settag("material");
def->settextstring( strmaterialtype );
def->setinvisible(false);
pentry->appendoddbentity(def);
//create text attribute material thickness
oddbattributedefinitionptr mydef = oddbattributedefinition::createobject();
odstring strmaterialthickness = (lpctstr)::api_fcc_get_view()->m_strmmvalue;
mydef->setprompt("enter material thickness");
mydef->settag("thickness");
mydef->settextstring( strmaterialthickness );//default value
mydef->setinvisible(false);
pentry->appendoddbentity(mydef);
blkid = pblocks->add(pentry);
}
return blkid;
}i would very much like it to show up in the "autocad text window" ( command line: list/all ) as a block but there's nothing so far.
please! any help would be much appreciated.
thanks!
kennet
afaik "list" lists only entities.
perhaps you may create an insert of your block.
vladimir