本人要在CAD里面弄一个画缓和曲线的ARX程序,源代码已经有了。但是对于ARX及VC++不了解,所以想请哪为高手帮忙!最好是已经编译好的了。谢谢!
AcDbObjectId CreateArc(AcGePoint3d center,double r,double starangle,double endangle)
{
AcDbArc * Parc = new AcDbArc (center,r,starangle,endangle);
AcDbBlockTable * pBlockTable;
AcdbHostApplicationServices() - > workingDatabase() - > getSymbolTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord* pBockTableRecord;
pBlockTable- > getAt(ACDB_MODEL_SPACE, pBockTableRecord,AcDb:: kForWrite);
pBlockTable- >close();
AcDbObjectId ArcID;
pBockTableRecord- >appendAcDbEntity(ArcID,pArc);
pBockTableRecord- > close();
pArc- > close();
Return ArcID;
}
用SPLINE线模拟缓和曲线:在ObjectARX系统中,系统向二次开发程序员提供了类AcDbSpline,利用AcDbSpline可以较好地模拟缓和曲线。
首先根据工程设计的精度要求,确定在缓和曲线上没间隔多少距离计算一个加点才能模拟缓和曲线,利用式(2)将加点计算后存放在数组类AcGePoint3dArray points中,然后生成SPLINE线:
AcDbObjectId CreateSPLINE(AcGePoint3dArray points)
{
AcDbSpline * pSpline = new AcDbSpline(Points,4,0.0);
AcDbBlockTable * pBlockTable;
AcdbHostApplicationServices() - > workingDatabase() - > getSymbolTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord* pBockTableRecord;
pBlockTable- > getAt(ACDB_MODEL_SPACE, pBockTableRecord,AcDb:: kForWrite);
pBlockTable- >close();
AcDbObjectId SplineId;
pBockTableRecord- >appendAcDbEntity(ArcId,pArc);
pBockTableRecord- > close();
pArc- > close();
Return SplineId;
} |