Пример #1
0
        public static double _GetLength3d(this BrepLoop loop)
        {
            double res = 0;

            foreach (var trim in loop.Trims_ThreadSafe())
            {
                if (trim.TrimType == BrepTrimType.Singular)
                {
                    continue;
                }
                res += trim.Edge._GetLength_ThreadSafe();
            }
            return(res);
        }
Пример #2
0
        public static Curve[] _GetJoinedEdges(this BrepLoop loop, double tol = 1)
        {
            var crvs = new List <Curve>();

            foreach (var trim in loop.Trims_ThreadSafe())
            {
                if (trim.TrimType == BrepTrimType.Singular)
                {
                    continue;
                }
                var crv3d = trim.Edge._Complexify(100);
                crvs.Add(crv3d);
            }

            var res = Curve.JoinCurves(crvs, tol);

            return(res);
        }
Пример #3
0
        public static Curve[] _GetJoinedTrims3d(this BrepLoop loop, double tol = 1)
        {
            var crvs = new List <Curve>();

            foreach (var trim in loop.Trims_ThreadSafe())
            {
                if (trim.TrimType == BrepTrimType.Singular)
                {
                    continue;
                }
                //var crv3d = Srf._Convert2dCurveTo3d(trim.Crv);
                var crv3d = trim._2dTo3d(trim._Srf())._Complexify(100);
                crvs.Add(crv3d);
            }

            var res = Curve.JoinCurves(crvs, tol);

            return(res);
        }
Пример #4
0
        /// <summary>
        /// Return index of vertexes used by this loop
        /// </summary>
        /// <param name="loop"></param>
        /// <param name="indexesCircular">each index that will be in this list point to circular vertexes: crv start and end points are same - zero length or cirvular or wrong defined points</param>
        /// <returns></returns>
        public static List <int> _GetVertexesIndex(this BrepLoop loop, out List <int> indexesCircular)
        {
            var vertices = loop.Brep.Vertices;
            var indexes  = new List <int>();

            indexesCircular = new List <int>(); //crv start and end points are same - zero length or cirvular or wrong defined points

            foreach (var t in loop.Trims_ThreadSafe())
            {
                //check for supported trim types
                switch (t.TrimType)
                {
                case BrepTrimType.Boundary:
                case BrepTrimType.Mated:
                case BrepTrimType.Seam:
                case BrepTrimType.Singular:
                    break;

                default:
                    throw new Exception("Exception: class _BrepLoop._GetVertexesIndex - Not supported type in trims: " + t.ObjectType);
                }

                int indexBegin = t._StartVertexIndex();
                if (!indexes.Contains(indexBegin))
                {
                    indexes.Add(indexBegin);
                }

                int indexEnd = t._EndVertexIndex();
                if (!indexes.Contains(indexEnd))
                {
                    indexes.Add(indexEnd);
                }

                if (indexBegin == indexEnd && t.TrimType != BrepTrimType.Singular)
                {
                    indexesCircular.Add(indexBegin);
                }
            }

            indexes.Sort();
            return(indexes);
        }