高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】oddbdatabasewblock9outobjids, basepoint0 bug
oddbdatabase::wblock(outobjids, basepoint) bug?
oddbdatabase::wblock(outobjids, basepoint) bug?
hi,
can somebody confirm that there is a bug in wblock(outobjids, basepoint), that neglects the basepoint and always considers ucs origin of source database as basepoint(wcs for new cloned database).
i am trying following code to clone a single entity but it is always cloned at an offset (wcs-ucs offset in source database):
code:
oddblineptr pline = id.safeopenobject();
odgepoint3d startpt, endpt;
pline->getstartpoint( startpt ); //startpt = (0, 0, 0)
pline->getendpoint( endpt ); //endpt = (10, 0, 0)
class clonereactor : public odstaticrxobject<odrxeventreactor>
{
oddbobjectid _origid;
oddbobjectid _cloneid;
public:
clonereactor( oddbobjectid origid ) : _origid( origid ) { }
virtual void enddeepclone( oddbidmapping& im )
{
oddbidpair pair( _origid );
if ( im.compute( pair ) )
_cloneid = pair.value();
}
oddbobjectid getcloneid() const { return _cloneid; }
}
cr( id );
odrxeventptr evt = odrxsysregistry()->getat(odrx_event_obj);
evt->addreactor(&cr);
odgepoint3d ucsorg;
if(id.database()->gettilemode())
ucsorg = id.database()->getucsorg(); //ucsorg = (10, 10, 0)
else
ucsorg = id.database()->getpucsorg();
//using any one of below statment doesn't change cloned entity
m_pclonedb = id.database()->wblock( ia, odgepoint3d::korigin );
//m_pclonedb = id.database()->wblock( ia, ucsorg );
evt->removereactor(&cr);
m_pclonedb->disableundorecording(true);
if ( !cr.getcloneid().isnull() )
m_pclone = cr.getcloneid().safeopenobject(oddb::kforread);
else
m_pclonedb.release();
pline = m_pclone;
//no matter what i pass as basept in wblock(), i get following result
pline->getstartpoint( startpt ); //startpt = (-10, -10, 0)
pline->getendpoint( endpt ); //endpt = (0, -10, 0)
thanks.
this is not a bug. base point parameter of wblock is not used for transforming entities. it's set to wblocked database insbase.
(it will effect entity transformations while insert operation on cloned database).
autocad does the same.
sergey slezkin
hi sergey,
thanks very much for the explanation. that clears my misunderstanding.
thanks again.
|