zoukankan      html  css  js  c++  java
  • 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)) ;
    

    实际效果

    左边是线边界框,右边红色是实际效果,模拟闭合(本质上就是假闭合)。

  • 相关阅读:
    Spring简介和基础
    el表达式
    Spring MVC 文件上传下载
    el表达式的function标签
    JSTL核心标签库使用
    基于注解的SpringMVC
    new一个Object对象占用多少内存?
    leetcode-第k个排列(Java和c++版)
    使用maven构建web项目(简易版)
    leetcode-电话号码的字母组合
  • 原文地址:https://www.cnblogs.com/edata/p/15506038.html
Copyright © 2011-2022 走看看