Exemplo n.º 1
0
        /// <summary>
        /// Create Rebar following a selected surface
        /// </summary>
        /// <param name="face">Surface</param>
        /// <param name="numberOfCurves">Define number of curves or distance between bars</param>
        /// <param name="distanceBetweenCurves">Define distance between curves or number of bars</param>
        /// <param name="flip">Flip orientation</param>
        /// <param name="offset">Offset</param>
        /// <param name="idealize">Idealize surfaces to rectangles</param>
        /// <returns>List of rebar</returns>
        public static List <Curve> FollowingSurface(Surface face, int numberOfCurves, double distanceBetweenCurves = 0, bool flip = true, double offset = 0, bool idealize = true)
        {
            if (idealize)
            {
                return(face.Follow(50, offset, distanceBetweenCurves, numberOfCurves, flip));
            }
            else
            {
                // Create return value collection
                List <Curve> curves = new List <Curve>();

                // Get a reference curve from the surface
                UV p1 = UV.ByCoordinates(0, 0);
                UV p2 = UV.ByCoordinates(1, 0);

                double length = (!flip) ? face.DistanceBetweenPoints(p1, p2) : face.DistanceBetweenPoints(p1.Flip(), p2.Flip());

                // If there is a distance applied use it to determine the number of lines to create
                if (distanceBetweenCurves > 0)
                {
                    numberOfCurves = (int)(length / (distanceBetweenCurves));
                }

                numberOfCurves++;

                Surface surface = face;

                if (offset != 0)
                {
                    Vector normal = face.NormalAtParameter(0.5, 0.5);
                    surface = (Surface)face.Translate(normal, offset);
                }

                TrimmedSurface trimmedSurface = new TrimmedSurface(surface);

                // Walk thru the amount of lines to create
                for (int j = 1; j < numberOfCurves; j++)
                {
                    // Create a set of points for createing a curve
                    List <Point> points = new List <Point>();

                    // Get the height parameter
                    double height = (double)j / (double)numberOfCurves;

                    curves.Add(trimmedSurface.GetCurveAtParameter(height, flip));
                }

                return(curves);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create Rebar following a selected surface
        /// </summary>
        /// <param name="face">Surface</param>
        /// <param name="numberOfCurves">Define number of curves or distance between bars</param>
        /// <param name="desiredDistanceBetweenCurves">Define a desired distance between curves, the actual result will be a best fit</param>
        /// <param name="flip">Flip orientation</param>
        /// <param name="offset">Offset</param>
        /// <param name="idealize">Idealize surfaces to rectangles</param>
        /// <param name="includeFirstEdge">Include first Edge of the surface</param>
        /// <param name="includeLastEdge">Include last Edge of the surface</param>
        /// <returns>List of rebar</returns>
        public static List <Curve> FollowingSurface(Surface face, int numberOfCurves = 0, double desiredDistanceBetweenCurves = 0, bool flip = true, double offset = 0, bool idealize = true, bool includeFirstEdge = false, bool includeLastEdge = false)
        {
            if (idealize)
            {
                return(face.Follow(50, offset, desiredDistanceBetweenCurves, numberOfCurves, flip));
            }
            else
            {
                // Create return value collection
                List <Curve> curves = new List <Curve>();

                // Get the distance between two corner points
                double length = (!flip) ?
                                face.DistanceBetweenPoints(UV.ByCoordinates(0, 0), UV.ByCoordinates(0, 1))
                    :
                                face.DistanceBetweenPoints(UV.ByCoordinates(0, 0), UV.ByCoordinates(1, 0));

                // If there is a distance applied use it to determine the number of lines to create
                if (desiredDistanceBetweenCurves > 0)
                {
                    numberOfCurves = (int)(length / (desiredDistanceBetweenCurves));
                }
                else
                {
                    numberOfCurves++;
                }


                Surface surface = face;

                if (offset != 0)
                {
                    surface = (Surface)face.Offset(offset);
                }


                TrimmedSurface trimmedSurface = new TrimmedSurface(surface);

                if (includeFirstEdge)
                {
                    curves.Add(trimmedSurface.GetCurveAtParameter(0, flip));
                }

                // Walk thru the amount of lines to create
                for (int j = 1; j < numberOfCurves; j++)
                {
                    // Create a set of points for createing a curve
                    List <Point> points = new List <Point>();

                    // Get the height parameter
                    double height = (double)j / (double)numberOfCurves;

                    curves.Add(trimmedSurface.GetCurveAtParameter(height, flip));
                }

                if (includeLastEdge)
                {
                    curves.Add(trimmedSurface.GetCurveAtParameter(1, flip));
                }

                return(curves);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create Rebar following a selected surface
        /// </summary>
        /// <param name="face">Surface</param>
        /// <param name="numberOfCurves">Define number of curves or distance between bars</param>
        /// <param name="distanceBetweenCurves">Define distance between curves or number of bars</param>
        /// <param name="flip">Flip orientation</param>
        /// <param name="offset">Offset</param>
        /// <param name="idealize">Idealize surfaces to rectangles</param>
        /// <returns>List of rebar</returns>
        public static List<Curve> FollowingSurface(Surface face, int numberOfCurves, double distanceBetweenCurves = 0, bool flip = true, double offset = 0, bool idealize = true)
        {
            if (idealize)
            {
                return face.Follow(50, offset, distanceBetweenCurves, numberOfCurves, flip);
            }
            else
            {

                // Create return value collection
                List<Curve> curves = new List<Curve>();

                // Get a reference curve from the surface
                UV p1 = UV.ByCoordinates(0, 0);
                UV p2 = UV.ByCoordinates(1, 0);

                double length = (!flip) ? face.DistanceBetweenPoints(p1, p2) : face.DistanceBetweenPoints(p1.Flip(), p2.Flip());

                // If there is a distance applied use it to determine the number of lines to create
                if (distanceBetweenCurves > 0) numberOfCurves = (int)(length / (distanceBetweenCurves));

                numberOfCurves++;

                Surface surface = face;

                if (offset != 0) surface = (Surface)face.Offset(offset);
                

                TrimmedSurface trimmedSurface = new TrimmedSurface(surface);

                // Walk thru the amount of lines to create
                for (int j = 1; j < numberOfCurves; j++)
                {
                    // Create a set of points for createing a curve
                    List<Point> points = new List<Point>();

                    // Get the height parameter
                    double height = (double)j / (double)numberOfCurves;

                    curves.Add(trimmedSurface.GetCurveAtParameter(height, flip));
                }

                return curves;
            }
        }