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;
        }
上一篇:学习Lowdb小型本地JSON数据库


下一篇:JAVA链接数据库 增删改查