void DrawPolyLine( AcGiWorldDraw* mode, const AcGePoint3d& spt, const AcGePoint3d& ept, double width ) { AcDbPolyline pl( 2 ); pl.addVertexAt( 0, Point3D_To_2D( spt ) ); pl.addVertexAt( 1, Point3D_To_2D( ept ) ); pl.setConstantWidth( width ); pl.worldDraw( mode ); }
void DrawPolyLine( AcGiWorldDraw* mode, const AcGePoint3d& pt, double angle, double length, double width ) { AcGeVector3d v( AcGeVector3d::kXAxis ); v.rotateBy( angle, AcGeVector3d::kZAxis ); AcDbPolyline pl( 2 ); pl.addVertexAt( 0, Point3D_To_2D( pt ) ); pl.addVertexAt( 1, Point3D_To_2D( pt + v * length ) ); pl.setConstantWidth( width ); pl.worldDraw( mode ); }
// 绘制箭头 void DrawArrow( AcGiWorldDraw* mode, const AcGePoint3d& insertPt, double angle, double width, double length ) { AcGeVector3d v( AcGeVector3d::kXAxis ); v.rotateBy( angle, AcGeVector3d::kZAxis ); AcDbPolyline pl( 2 ); pl.addVertexAt( 0, Point3D_To_2D( insertPt ) ); pl.addVertexAt( 1, Point3D_To_2D( insertPt + v * length ) ); pl.setWidthsAt( 0, width, 0 ); pl.setWidthsAt( 1, 0, 0 ); pl.worldDraw( mode ); }
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 ); }
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 ); }