几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】create objects another one (http://www.dimcax.com/hust/showthread.php?t=15562)

yang686526 2009-05-04 06:43 PM

【转帖】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.


所有的时间均为北京时间。 现在的时间是 09:16 AM.