我想输入两个点的坐标之后出来两条直线,下面是画直线的代码,大家帮我看看 按照这段代码这样执行的话pLine是一个点,pLine2的直线倒能画出来,请问是怎么回事? 另ads_point,ads_name的定义哪里有得查啊? 谢谢 Acad::ErrorStatus postToDatabase(AcDbEntity* pEnt,AcDbObjectId& idObj) { Acad::ErrorStatus es; AcDbBlockTable* pBlockTable; AcDbBlockTableRecord* pSpaceRecord; if(acdbHostApplicationServices()->workingDatabase()==NULL) return Acad::eNoDatabase; if ((es=acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable,AcDb::kForRead))==Acad::eOk) { if((es=pBlockTable->getAt(ACDB_MODEL_SPACE,pSpaceRecord,AcDb::kForWrite))==Acad::eOk) { if((es=pSpaceRecord->appendAcDbEntity(idObj,pEnt))==Acad::eOk) pEnt->close(); pSpaceRecord->close(); } pBlockTable->close(); } return es; } //-----------------以下开始添加直线------------------------------------ Acad::ErrorStatus newLine() { ads_point pt1,pt2; ads_point pt3,pt4; int retval; try { if((retval=acedGetPoint(NULL, "\nSelect lower left:",pt1))!=RTNORM) throw retval; if((retval=acedGetPoint(pt1,"\nSelect upper right:",pt2))!=RTNORM) throw retval; } catch (int e) { if(e==RTCAN) return Acad::eUserBreak ; if(e==RTERROR) return Acad::eInvalidInput ; } pt3[X]=pt1[X]; pt3[Y]=pt1[Y]+10; pt3[Z]=pt1[Z]; pt4[X]=pt1[X]; pt4[Y]=pt1[Y]+10; pt4[Z]=pt1[Z]; AcDbLine* pLine =new AcDbLine(asPnt3d(pt1),asPnt3d(pt2)); AcDbLine* pLine2 =new AcDbLine(asPnt3d(pt3),asPnt3d(pt4)); if(!pLine || !pLine2) { acedAlert("Not enough memory to create a Line!"); return Acad::eOutOfMemory ; } AcDbObjectId id; postToDatabase(pLine,id); return postToDatabase(pLine2,id);
}
|