|
[code]void ZffCHAP2AddPolyline()
{
// 创建仅包含一段直线的多段线
AcGePoint2d ptStart(0, 0), ptEnd(100, 100);
CCreateEnt::CreatePolyline(ptStart, ptEnd, 1);
//创建二维多义线
//设置顶点坐标
AcGePoint3dArray ptArr;
ptArr.setLogicalLength(4);
for(int i = 0; i < 4; i++)
{
ptArr[i].set((double)(i/2),(double)(i%2),0.0);
}
CCreateEnt::Create2dPolyLine(ptArr);
// 创建三维多段线
AcGePoint3d pt1(0, 0, 0), pt2(100, 0, 0), pt3(100, 100, 0);
AcGePoint3dArray points;
points.append(pt1);
points.append(pt2);
points.append(pt3);
CCreateEnt::Create3dPolyline(points);
// 创建正多边形
CCreateEnt::CreatePolygon(AcGePoint2d::kOrigin, 6, 30, 0, 1);
// 创建矩形
AcGePoint2d pt(60, 70);
CCreateEnt::CreateRectangle(pt, ptEnd, 1);
// 创建圆
pt.set(50, 50);
CCreateEnt::CreatePolyCircle(pt, 30, 1);
// 创建圆弧
CCreateEnt::CreatePolyArc(pt, 50, CCalculation::GtoR(45),
CCalculation::GtoR(225), 1);
}[/code] |
|