ObjectARX自定义实体中使用实体填充之类似多段线带弧形宽度
作者:互联网
代码
多段线带弧形宽度闭合效果
assertReadEnabled () ;
AcGePoint2d p1(0,0);
AcGePoint2d p2(10,0);
AcGePoint2d p3(10,10);
AcGePoint2d p4(0,10);
AcGePoint2d p1x(0,1);
AcGePoint2d p2x(9,1);
AcGePoint2d p3x(9,9);
AcGePoint2d p4x(0,9);
AcArray <AcGeCurve2d*>edgs;
AcGeLineSeg2d line1(p1,p2);
AcGeLineSeg2d line2(p2,p3);
AcGeLineSeg2d line3(p3,p4);
AcGeLineSeg2d line4(p1,p1x);
AcGeCircArc2d cir(p4,p1,1.0,Adesk::kFalse);
AcGeLineSeg2d line1x(p1x,p2x);
AcGeLineSeg2d line2x(p2x,p3x);
AcGeLineSeg2d line3x(p3x,p4x);
AcGeLineSeg2d line4x(p1x,p1);
AcGeCircArc2d cirx(p4x,p1x,1.0,Adesk::kFalse);
edgs.append(&line4x);
edgs.append(&line1);
edgs.append(&line2);
edgs.append(&line3);
edgs.append(&cir);
edgs.append(&line4);
edgs.append(&line1x);
edgs.append(&line2x);
edgs.append(&line3x);
edgs.append(&cirx);
mode->geometry().edge(edgs);
Adesk::Boolean result = Adesk::kFalse;
AcArray<AcGeCurve2d*> geCurves;
double hatchDev = mode->deviation(kAcGiMaxDevForCurve, AcGePoint3d::kOrigin);
AcGiFill acgiSolidFill;
acgiSolidFill.setDeviation(hatchDev);
// int nSegs = -1;
// AcGeLineSeg2d line;
// AcGeLineSeg2d *pLine;
// nSegs = this->numVerts() ;
// for(int i = 0; i < nSegs; i++)
// {
// if(this->segType(i) == AcDbPolyline::kLine)
// {
// this->getLineSegAt(i, line);
// pLine = new AcGeLineSeg2d(line);
// geCurves.append(pLine);
//
// }
// }
mode->subEntityTraits().setColor(1);
mode->subEntityTraits().setFill(&acgiSolidFill);
/* geCurves represents boundary of hatch*/
mode->geometry().edge(edgs);
return (AcDbEntity::subWorldDraw (mode)) ;
实际效果
左边是线边界框,右边红色是实际效果,模拟闭合(本质上就是假闭合)。
标签:AcGePoint2d,edgs,自定义,实体,ObjectARX,mode,AcGeLineSeg2d,p1x,append 来源: https://www.cnblogs.com/edata/p/15506038.html