Example #1
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            CurveLoop curveLoop = (CurveLoop)((Value.Container)args[0]).Item;

            CurveLoopIterator CLiter = curveLoop.GetCurveLoopIterator();

            List <Curve> listCurves = new List <Curve>();

            for (; CLiter.MoveNext();)
            {
                listCurves.Add(CLiter.Current.Clone());
            }

            var result = FSharpList <Value> .Empty;

            for (int indexCurve = listCurves.Count - 1; indexCurve > -1; indexCurve--)
            {
                result = FSharpList <Value> .Cons(Value.NewContainer(listCurves[indexCurve]), result);
            }

            return(Value.NewList(result));
        }
Example #2
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Curve curve = (Curve)((Value.Container)args[0]).Item;

            double thickness = ((Value.Number)args[1]).Item;
            XYZ    normal    = (XYZ)((Value.Container)args[2]).Item;

            CurveLoop thickenLoop = CurveLoop.CreateViaThicken(curve, thickness, normal);

            if (thickenLoop == null)
            {
                throw new Exception("Could not offset curve");
            }

            CurveLoopIterator CLiter = thickenLoop.GetCurveLoopIterator();

            Curve result = null;

            //relying heavily on the order of curves in the resulting curve loop, based on internal implemen
            for (int index = 0; CLiter.MoveNext(); index++)
            {
                if (index == 2)
                {
                    result = CLiter.Current.Clone();
                }
            }

            if (result == null)
            {
                throw new Exception("Could not offset curve");
            }

            crvs.Add(result);

            return(Value.NewContainer(result));
        }