高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】creating a proxy entity
creating a proxy entity
creating a proxy entity
our application uses it's own entity database (not oddb database).
when we load a dwg, we can read proxy entity data (using oddbentget).
however, we also need to save proxy entities (or "round-trip" them).
dwgdirect seems designed to make proxy entity "read-only".
1. is there any way we can create an oddbproxyentity and set it's application name, class id, xdata etc?
2. if (1) is not possible, is there any way to "round-trip" the proxy entity by moving it from the "input" dwgdirect database to the "output" dwgdirect database?
theoretically it's possible to call oddbproxyentity::createobject() and fill it by oddbentmod(). but round-tripping proxies is no-trivial task. they may have links to other objects. these objects and links (references) must be round-tripped too.
first way is to create objects with exactly the same handles as they had in initial drawing. another way is to translate handles to keep references valid.
one more potential problem is that something which was referenced by proxy entity (linetype, layer, other proxy entity or object) can be erased while living in non-dwgdirect database.
so the risk to corrupt the drawing is rather high.
sergey slezkin
i have not been able to get oddbentmod() to work:
here is the code i am using:
oddbproxyentityptr pproxy = oddbproxyentity::createobject();
//pproxy->setdatabasedefaults(pdb);
//pblock->appendoddbentity(pproxy);
oddbentmod(destproxy, m_xdata);
(m_xdata is the proxy xdata that i have stored from when the dwg was read).
the error i get with the code above is "no database".
if i try pproxy->setdatabasedefaults(pdb), then i get "no classid" message.
what am i doing wrong?
thanks - jh
oddbentmod() should get not xdata but result of oddbentget().
are you sure that you are getting "no class id" from setdatabasedefaults()? not from appendoddbentity()?
sergey slezkin
thanks for your reply.
i am giving oddbentmod() the result of oddbentget() (ie: when i said "proxy xdata" above i mean the results of oddbentget(), let us call it "dxfdata").
setdatabasedefaults() gives an exception when it tries to set the colour (because it tries to get the proxyflags to see if the setcolour() is allowed for this proxy, and the proxyflags() function uses m_pproxyclass, which is not defined at this time.
appendoddbentity() gives "no classid" exception.
oddbentmod() gives "no database" exception (if i leave out setdatabasedefaults() and appendoddbentity()).
problem seems to me to be how to set up the m_pproxyclass in the oddbproxyentity.
is there any example code anywhere that shows how to create a proxy entity and populate it?
- jh
still need some help finding sample code for creating a proxy entitiy, as above.
hi
i still need to be able to create a proxy entity and add it to the database.
please supply code to do this, or provide a link to example code.
thanks
james higgs
|