高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】create objects another one
create objects another one.
create objects another one.
i have two version code to append a line:
version 1:
oddbline2dptr pline = oddbline::createobject();
pline->setstartpoint(odgepoint3d(0.,0.,0.));
pline->setendpoint(odgepoint3d(1.,1.,1.));
oddbblocktablerecordptr pstable = getmodelspaceid().safeopenobject(oddb::kforwrite);
pstable->appendoddbentity(pent);
----------------------------------------------------------------
version 2:
oddbline2dptr pline = oddbline::createobject();
oddbblocktablerecordptr pstable = getmodelspaceid().safeopenobject(oddb::kforwrite);
id = pstable->appendoddbentity(pent);
pline = id.safeopenobject(oddb::kforwrite);
pline->setstartpoint(odgepoint3d(0.,0.,0.));
pline->setendpoint(odgepoint3d(0.,0.,0.));
what is the better version?
why?
does the order change the results?
its the same code with exception to
pline = id.safeopenobject(oddb::kforwrite);
if i'm not mistaken, i believe that this line is not needed because ::createobject opens the object for write.
|