void Additional_Class::Get_PolyLine_Point( AcDbObjectId PolyLineId,AcGePoint3dArray &PointArray ) { AcDbEntity *pEnt_Temp = NULL; Acad::ErrorStatus es = acdbOpenAcDbEntity(pEnt_Temp, PolyLineId, AcDb::kForRead); if (es != Acad::eOk) { acutPrintf(_T("\nOPEN POLYLINE ERROR")); return; } if (!pEnt_Temp->isKindOf(AcDbPolyline::desc())) { acutPrintf(_T("\nENTITY IS NOT POLYLINE")); return; } AcDbPolyline *pPolyLine = AcDbPolyline::cast(pEnt_Temp); int num = pPolyLine->numVerts(); AcGePoint3d Start_temp_PT,End_temp_PT; for (int index=0; index<num; index++) { if (pPolyLine->segType(index) == AcDbPolyline::kLine) { AcGeLineSeg3d tempLine; pPolyLine->getLineSegAt(index,tempLine); Start_temp_PT = tempLine.startPoint(); End_temp_PT = tempLine.endPoint(); PointArray.append(Start_temp_PT); PointArray.append(End_temp_PT); } else if (pPolyLine->segType(index) == AcDbPolyline::kArc) { AcGeCircArc2d tempArc; pPolyLine->getArcSegAt(index,tempArc); Start_temp_PT.set(tempArc.startPoint().x,tempArc.startPoint().y,0); End_temp_PT.set(tempArc.endPoint().x,tempArc.endPoint().y,0); PointArray.append(Start_temp_PT); PointArray.append(End_temp_PT); } } pEnt_Temp->close(); AcGeIntArray IndexArray; for (int i=1; i<PointArray.length();i++) { if (PointArray[i] == PointArray[i-1]) { IndexArray.append(i); PointArray.remove(PointArray[i]); } } }
void CreateCircleLoop( AcDbHatch* pHatch, const AcGePoint3d& pt, double radius ) { AcGeCircArc2d* cirArc = new AcGeCircArc2d(); cirArc->setCenter( Point3D_To_2D( pt ) ); cirArc->setRadius( radius ); cirArc->setAngles( 0.0, PI * 2 ); AcGeIntArray edgeTypes; AcGeVoidPointerArray edgePtrs; edgeTypes.append( AcDbHatch::kCirArc ); edgePtrs.append( ( void* )cirArc ); pHatch->appendLoop( AcDbHatch::kDefault, edgePtrs, edgeTypes ); }
void CreatePolygonLoop( AcDbHatch* pHatch, const AcGePoint3dArray& pts ) { AcGeIntArray edgeTypes; AcGeVoidPointerArray edgePtrs; int n = pts.length(); for( int i = 0; i < n; i++ ) { AcGePoint2d p1 = Point3D_To_2D( pts[i] ); AcGePoint2d p2 = Point3D_To_2D( pts[( i + 1 ) % n] ); AcGeLineSeg2d* pLine = new AcGeLineSeg2d( p1, p2 ); edgePtrs.append( pLine ); edgeTypes.append( AcDbHatch::kLine ); } pHatch->appendLoop( AcDbHatch::kDefault, edgePtrs, edgeTypes ); }