查看单个帖子
旧 2009-05-04, 06:43 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)