AcDbObjectId CPolylineUtil::Add(const AcGePoint2dArray &points,double width/* =0 */) { //点数量 int numVertices=points.length(); //定义多段线 AcDbPolyline *pPoly =new AcDbPolyline(numVertices); //将每个顶点添加到多段线中 for (int i=0;i<numVertices;i++) { //index,point,0:直线,1:半圆,>1:优弧,0~1:劣弧 pPoly->addVertexAt(i,points.at(i),0,width,width); } //定义多段线ID AcDbObjectId polyId; //将多段线添加到模型空间 polyId = CDwgDatabaseUtil::PostToModelSpace(pPoly); //返回多段线ID return polyId; } AcDbObjectId CPolylineUtil::Add(const AcGePoint2d &ptStart,const AcGePoint2d &ptEnd,double width) { AcGePoint2dArray points; points.append(ptStart); points.append(ptEnd); return Add(points,width); }