查看单个帖子
旧 2009-05-04, 04:38 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】basic question about explodegeometrytoblock

basic question about explodegeometrytoblock
basic question about explodegeometrytoblock
hello,
i am certainly doing some very basic stuff wrong. i am trying to explode a oddbentity ("ent" in the following code) into a block. but all ids turn out to be zero. the entity originates from an iteration over the entities of a modelspace of a preiously opened database. i do have access to all properties of the entity, which in my case is a mtext entity.
code:
odsmartptr<oddbblocktablerecord> res = oddbblocktablerecord::createobject();
oddbobjectidarray ids;
odresult ok = ent->explodegeometrytoblock(res, &ids);
int l = ids.length();
for (int i=0; i<l; ++i)
{
if (!(ids[i].isnull()))
{
oddbobjectid id = ids[i];
oddbobjectptr entity = id.safeopenobject();
}
}i broke the code down from a c# program where i am using a c# wrapper to dwgdirect, so i could test it with c++. so my code may look a bit awkward.
thank you for any hint and especially a for a reference where i would have found the solution myself.
gerhard
you explode entities to a non-database resident block, therefore explode results are ndbro too, they have no ids.
vladimir
thank you vladimir!
this was the information i was missing. where could i have found it?
i had to safeopenobject the blocktableid of the database as oddb::kforwrite and then add my oddbblocktablerecord to that database. now it works.
thanks
gerhard
quote:
where could i have found it?
i don't think it is explicitly stated anywhere. it is just logical - object id is a property of a database resident object, i.e. no database = no object id.
vladimir
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)