几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   ObjectARX(C++) (http://www.dimcax.com/hust/forumdisplay.php?f=34)
-   -   【转帖】请各位帮忙 (http://www.dimcax.com/hust/showthread.php?t=8071)

yang686526 2009-04-18 07:33 PM

【转帖】请各位帮忙
 
请各位帮忙
请各位帮忙
提示 用户选择两个点,将两点联成直线
为何不能实现啊 ,代码如下:
ads_point startpt, endpt;
acedgetpoint(null,"\nlocate start point : ", startpt);
acedgetpoint(null,"\nlocate end point : ", endpt);
acdbline *pline = new acdbline(startpt,endpt);
//error c2664: '__thiscall acdbline::acdbline(const class acgepoint3d &,const class acgepoint3d &)' : cannot convert parameter 1 from 'double [3]' to 'const class acgepoint3d &'
reason: cannot convert from 'double [3]' to 'const class acgepoint3d'
no constructor could take the source type, or constructor overload resolution was ambiguous
请各位帮忙指点一二
第一点,acdbline接受的不是ads_point而是acgepoint3d,要把ads_point 转换为acgepoint3d,可以这样写:
(假定 ads_point s;acgepoint3d p;)
p.set(s[0],s[1],s[2]);
但是你得程序可以有更快的写法:
acdbline *pline = new acdbline(*(acgepoint3d*)startpt,*(acgepoint3d*)endpt);
第二点,你必须把你的图元加入到数据库中才行,这个可以参考sdk上的写法:
acdbblocktable *pblocktable;
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(pblocktable, acdb::kforread);
acdbblocktablerecord *pblocktablerecord;
pblocktable->getat(acdb_model_space, pblocktablerecord,
acdb::kforwrite);
pblocktable->close();
acdbobjectid lineid;
pblocktablerecord->appendacdbentity(lineid, pline);
pblocktablerecord->close();
pline->close();
我的qq 172522850


所有的时间均为北京时间。 现在的时间是 11:36 PM.