cad二次开发-线段合并

        /// <summary>
        /// 向多线段Pol的尾部添加多线段newPol,前提是两个线段必须是首尾相连
        /// </summary>
        /// <param name="Pol"></param>
        /// <param name="newPol"></param>
        /// <returns></returns>
        private static Polyline poAddPath(Polyline Pol,Polyline newPol)
        {

            Point3d poRefer = Pol.EndPoint;

            Point3d pos3 = newPol.GetPoint3dAt(0);
            Point3d poe3 = newPol.GetPoint3dAt(newPol.NumberOfVertices - 1);
            Point2d po2;
            double dis = class1.getDistance(poRefer.X, poRefer.Y,pos3.X,pos3.Y);
            double dise = class1.getDistance(poRefer.X, poRefer.Y,poe3.X,poe3.Y);
            if (dis < 0.1)
            {
                for (int i = 0; i < newPol.NumberOfVertices; i++)
                {
                    double bule = -Math.Abs(newPol.GetBulgeAt(i));
                    po2 = new Point2d(newPol.GetPoint3dAt(i).X, newPol.GetPoint3dAt(i).Y);
                    Pol.AddVertexAt(Pol.NumberOfVertices, po2, bule, newPol.GetStartWidthAt(i), newPol.GetEndWidthAt(i));
                }
            } else if (dise<0.1)
            {
                for (int i = newPol.NumberOfVertices-1; i >=0; i--)
                {
                    int j = newPol.NumberOfVertices - 1 - i;
                    double bule = -Math.Abs(newPol.GetBulgeAt(j));
                    //bule = 0- bule;
                    po2 = new Point2d(newPol.GetPoint3dAt(i).X, newPol.GetPoint3dAt(i).Y);
                    Pol.AddVertexAt(Pol.NumberOfVertices, po2, bule, newPol.GetStartWidthAt(i), newPol.GetEndWidthAt(i));
                }
            }
            double bul3e = Pol.GetBulgeAt(14);

            return Pol;
        }
  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值