//添加函数,用于创建轻量多段线
AcDbObjectId CircleLine::CreatePolyline(AcGePoint2dArray points, double width)
{
int numVertices = points.length();
AcDbPolyline *pPoly = new AcDbPolyline(numVertices);
double bulge[5] = {0,-1,0,0,0.5}; //凸度:0.5是1/4圆弧,1是半圆
for (int i = 0; i < numVertices; i++)
{
pPoly->addVertexAt(i, points.at(i), bulge[i], width, width);
}
AcDbObjectId polyId;
polyId = CircleLine::PostToModelSpace(pPoly);
return polyId;
AcDbObjectId CircleLine::CreatePolyline(AcGePoint2dArray points, double width)
{
int numVertices = points.length();
AcDbPolyline *pPoly = new AcDbPolyline(numVertices);
double bulge[5] = {0,-1,0,0,0.5}; //凸度:0.5是1/4圆弧,1是半圆
for (int i = 0; i < numVertices; i++)
{
pPoly->addVertexAt(i, points.at(i), bulge[i], width, width);
}
AcDbObjectId polyId;
polyId = CircleLine::PostToModelSpace(pPoly);
return polyId;
}
//按照指定的角度(用弧度值表示)旋转指定的实体,其实现代码为:
Acad::ErrorStatus CircleLine::Rotate(AcDbObjectId entId, AcGePoint2d ptBase, double rotation)
{
AcGeMatrix3d xform;
AcGeVector3d vec(0, 0, 1);
AcGePoint3d point;
point.x = ptBase.x;
point.y = ptBase.y;
point.z = 0;
xform.setToRotation(rotation, vec, point);
AcDbEntity *pEnt;
Acad::ErrorStatus es = acdbOpenObject(pEnt, entId, AcDb::kForWrite, false);
pEnt->transformBy(xform);
pEnt->close();
return es;
}