其他分享
首页 > 其他分享> > cad二次开发-线段合并

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;
        }

标签:GetPoint3dAt,poRefer,线段,NumberOfVertices,Pol,newPol,二次开发,bule,cad
来源: https://blog.csdn.net/MieTuBrother/article/details/114300254