![]() |
【转帖】请各位帮忙
请各位帮忙
请各位帮忙 提示 用户选择两个点,将两点联成直线 为何不能实现啊 ,代码如下: 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. |