高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】oddbentmod90 not able to change handle
oddbentmod() not able to change handle
oddbentmod() not able to change handle
hi,
i am trying to change handle value for an oddbobject. i am using oddbentmod() procedure to change handle, but the handle value never gets changed. there is no exception being thrown either. here is sample code:
code:
//get resbuf for objects
odresbufptr rbold = oddbentget(idold);
odresbufptr rbnew = oddbentget(newid);
odresbufptr start = rbold;
//iterate through to get handle
while(oddxfcode::_gettype( rbold->restype() )!= oddxfcode::handle)
{
rbold = rbold->next();
if(rbold.isnull())
break;
}
while(oddxfcode::_gettype( rbnew->restype() )!= oddxfcode::handle)
{
rbnew = rbnew->next();
if(rbnew.isnull())
break;
}
//get handles
oddbhandle hold = rbold->gethandle();
oddbhandle hnew = rbnew->gethandle();
//change handle value
rbold->sethandle(hnew);
oddbentmod(idold, start);
oddbhandle checkhandle = idold.gethandle(); //here, checkhandle = hold, i expect it to be equal to hnew.
i also tried oddbobject::swapidwith() function if the hnew value was already in the database, but the handle is reverted back to old values on document save and reopen.
can somebody suggest the correct way to modify handle values? is there any example in oda's source?
thanks,
samir
more questions
hi,
any answers/suggestions are welcome that help me figure out "how to modify handles?" as described in above post.
i have another confusion/question too:
what is the difference between odresbuf::valuetype values of krthandle, kdxfhandle, kdxfarbhandle, kdxfxdhandle? i couldn't find any documentation on which handle type should be used for what purpose?
thanks,
samir
whats the purpose of modifying handles of existing objects?
btw, maybe the topic from faq in documentation may help to resolve the problem?
sergey slezkin
hi sergey,
thanks for reply.
quote:
originally posted by sergey slezkin
whats the purpose of modifying handles of existing objects?
a module of our application requires to assign custom handles defined outside drawing to entities in an existing drawing.
well, i think we can alternatively use external data objects. and that is why i was wondering which handle type i should use from krthandle, kdxfhandle, kdxfarbhandle, kdxfxdhandle. i tried to write xdata as kdxfhandle(valuetype = 5) type but when i try to retrieve that handle type it is being reported back as valuetype = 1029 !!!
handle of object existing in database can't be altered by oddbentmod() or by any other method. you can only create a clone of existing object, add it to database with another handle value (if it does not conflict with existing objects) and erase the old one.
valid xdata group codes must be greater than 1000.
sergey slezkin
quote:
originally posted by sergey slezkin
valid xdata group codes must be greater than 1000.
i see, thanks very much for the information. i get correct results by using handle type of kdxfxdhandle.
thanks again.
samir
|