- UID
- 3684
- 积分
- 844
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-4-8
- 最后登录
- 1970-1-1
|
发表于 2004-6-11 19:15:28
|
显示全部楼层
- [FONT=courier new]
- Acad::ErrorStatus acqHatch1()
- {
- AcDbHatch* pHatch = new AcDbHatch();
- // Set hatch plane
- //
- AcGeVector3d normal(0.0, 0.0, 1.0);
- pHatch->setNormal(normal);
- pHatch->setElevation(0.0);
- // Set non associative hatch
- //
- pHatch->setAssociative(Adesk::kFalse);
- // Set hatch pattern to SolidFill type
- //
- pHatch->setPattern(AcDbHatch::kPreDefined, "SOLID");
- // Set hatch style to kNormal
- //
- pHatch->setStyle(AcDbHatch::kNormal);
- // Construct hatch external boundary
- //
- AcGePoint2dArray vertexPts;
- AcGeDoubleArray vertexBulges;
- vertexPts.setPhysicalLength(0).setLogicalLength(5);
- vertexPts[0].set(2.0, 2.0);
- vertexPts[1].set(8.0, 2.0);
- vertexPts[2].set(8.0, 8.0);
- vertexPts[3].set(2.0, 8.0);
- vertexPts[4].set(2.0, 2.0);
- vertexBulges.setPhysicalLength(0).setLogicalLength(5);
- for (int i = 0; i < 5, i++)
- vertexBulges[i] = 0.0;
- // Append an external loop (rectangle) to hatch boundary
-
- pHatch->appendLoop(AcDbHatch::kExternal, vertexPts, vertexBulges);
- // Construct a circle
- //
- AcGePoint2d cenPt(5.0, 5.0);
- double TWOPI = 2.0 * 3.1415926535897932;
- AcGeCircArc2d *cirArc = new AcGeCircArc2d();
- cirArc->setCenter(cenPt);
- cirArc->setRadius(1.0);
- cirArc->setAngles(0.0, TWOPI);
- // Append an internal circular loop to hatch boundary
- //
- AcGeIntArray edgeTypes;
- AcGeVoidPointerArray edgePtrs;
- edgeTypes.append(AcDbHatch::kCirArc);
- edgePtrs.append((void*)cirArc);
- pHatch->appendLoop(AcDbHatch::kDefault, edgePtrs, edgeTypes);
-
- // Elaborate solid fill
- //
- pHatch->evaluateHatch();
- // Post hatch entity to database
- //
- pHatch->postToDb(pHatch);
- return eOk;
- }
- [/FONT]
复制代码 |
|