Example #1
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Geometry base_geometry = (Geometry)((Value.Container)args[0]).Item;
            Geometry tool_geometry = (Geometry)((Value.Container)args[1]).Item;
            Point    pick_point    = (Point)((Value.Container)args[2]).Item;

            Surface base_surface = base_geometry as Surface;
            Solid   base_solid   = base_geometry as Solid;

            Geometry result = null;

            if (base_surface != null)
            {
                result = base_surface.trim(tool_geometry, pick_point);
            }

            if (base_solid != null)
            {
                result = base_solid.trim(tool_geometry, pick_point);
            }

            // TODO: implement curve. Trim has odd interface
            _result = RestoreProperType(result);

            GraphicItem.persist(_result);
            _graphicItems.Add(_result);

            return(Value.NewContainer(_result));
        }
Example #2
0
        internal Geometry RestoreProperType(Geometry g)
        {
            Point p = Point.cast(g);

            if (p != null)
            {
                return(p);
            }

            Surface surf = Surface.cast(g);

            if (surf != null)
            {
                return(surf);
            }

            Curve c = Curve.cast(g);

            if (c != null)
            {
                return(c);
            }

            Solid solid = Solid.cast(g);

            if (solid != null)
            {
                return(solid);
            }

            return(g);
        }
Example #3
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Point p = (Point)((Value.Container)args[0]).Item;

            double z = p.z();

            return(Value.NewNumber(z));
        }
Example #4
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Point  origin = (Point)((Value.Container)args[0]).Item;
            Vector normal = (Vector)((Value.Container)args[1]).Item;

            _plane = Plane.by_origin_normal(origin, normal);

            return(Value.NewContainer(_plane));
        }
Example #5
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Point  cp     = (Point)((Value.Container)args[0]).Item;
            double r      = ((Value.Number)args[1]).Item;
            Vector normal = (Vector)((Value.Container)args[2]).Item;

            _circle = Circle.by_center_point_radius_normal(cp, r, normal);

            return(Value.NewContainer(_circle));
        }
Example #6
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Point  origin = (Point)((Value.Container)args[0]).Item;
            Vector x_axis = (Vector)((Value.Container)args[1]).Item;
            Vector y_axis = (Vector)((Value.Container)args[2]).Item;

            _cs = CoordinateSystem.by_origin_vectors(origin, x_axis, y_axis);

            return(Value.NewContainer(_cs));
        }
Example #7
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Curve  curve = (Curve)((Value.Container)args[0]).Item;
            double dist  = ((Value.Number)args[1]).Item;

            _point = curve.point_at_distance(dist);
            GraphicItem.persist(_point);

            return(Value.NewContainer(_point));
        }
Example #8
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Point sp = (Point)((Value.Container)args[0]).Item;
            Point ep = (Point)((Value.Container)args[1]).Item;

            _line = Line.by_start_point_end_point(sp, ep);
            _graphicItems.Add(_line);

            return(Value.NewContainer(_line));
        }
Example #9
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Surface surf = (Surface)((Value.Container)args[0]).Item;
            double  u    = ((Value.Number)args[1]).Item;
            double  v    = ((Value.Number)args[2]).Item;

            _point = surf.point_at_parameter(u, v);
            GraphicItem.persist(_point);

            return(Value.NewContainer(_point));
        }
Example #10
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Curve  curve = (Curve)((Value.Container)args[0]).Item;
            double param = ((Value.Number)args[1]).Item;

            _point = curve.point_at_parameter(param);
            GraphicItem.persist(_point);
            _graphicItems.Add(_point);

            return(Value.NewContainer(_point));
        }
Example #11
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            double x, y, z;

            x = ((Value.Number)args[0]).Item;
            y = ((Value.Number)args[1]).Item;
            z = ((Value.Number)args[2]).Item;

            _point = Point.by_coordinates(x, y, z);

            return(Value.NewContainer(_point));
        }
Example #12
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            PointList points = new PointList();
            var       input  = (args[0] as Value.List).Item;

            foreach (Value v in input)
            {
                Point p = ((Value.Container)v).Item as Point;
                points.Add(p);
            }

            _polygon = Polygon.by_vertices(points);

            return(Value.NewContainer(_polygon));
        }
Example #13
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            PointList points = new PointList();
            var       input  = (args[0] as Value.List).Item;

            foreach (Value v in input)
            {
                Point p = ((Value.Container)v).Item as Point;
                points.Add(p);
            }

            _bsplinecurve = BSplineCurve.by_points(points, true);

            return(Value.NewContainer(_bsplinecurve));
        }
Example #14
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            double x, y;

            x = ((Value.Number)args[0]).Item;
            y = ((Value.Number)args[1]).Item;

            if (_point == null)
            {
                _point = Point.by_coordinates(x, y);
            }
            else
            {
                _point.set_x(x);
                _point.set_y(y);
            }

            return(Value.NewContainer(_point));
        }
Example #15
0
 public static XYZ PointToXyz(Point pt)
 {
     return(new XYZ(pt.x(), pt.y(), pt.z()));
 }
Example #16
0
        public override Value Evaluate(FSharpList<Value> args)
        {
            Curve curve = (Curve)((Value.Container)args[0]).Item;
            double dist = ((Value.Number)args[1]).Item;

            _point = curve.point_at_distance(dist);
            GraphicItem.persist(_point);
            _graphicItems.Add(_point);

            return Value.NewContainer(_point);
        }
 public static XYZ PointToXyz(Point pt)
 {
     return new XYZ(pt.x(), pt.y(), pt.z());
 }
Example #18
0
        public override Value Evaluate(FSharpList<Value> args)
        {
            Curve curve = (Curve)((Value.Container)args[0]).Item;
            double param = ((Value.Number)args[1]).Item;

            _point = curve.point_at_parameter(param);
            GraphicItem.persist(_point);

            return Value.NewContainer(_point);
        }
Example #19
0
        public override Value Evaluate(FSharpList<Value> args)
        {
            Surface surf = (Surface)((Value.Container)args[0]).Item;
            double u = ((Value.Number)args[1]).Item;
            double v = ((Value.Number)args[2]).Item;

            _point = surf.point_at_parameter(u, v);
            GraphicItem.persist(_point);

            return Value.NewContainer(_point);
        }
Example #20
0
        public override Value Evaluate(FSharpList<Value> args)
        {
            double x, y;
            x = ((Value.Number)args[0]).Item;
            y = ((Value.Number)args[1]).Item;

            if (_point == null)
            {
                _point = Point.by_coordinates(x, y);
            }
            else
            {
                _point.set_x(x);
                _point.set_y(y);
            }

            return Value.NewContainer(_point);
        }
Example #21
0
        public override Value Evaluate(FSharpList<Value> args)
        {
            double x, y, z;
            x = ((Value.Number)args[0]).Item;
            y = ((Value.Number)args[1]).Item;
            z = ((Value.Number)args[2]).Item;

            _point = Point.by_coordinates(x, y, z);

            return Value.NewContainer(_point);
        }
Example #22
0
 public static Point XyzToPoint(XYZ xyz)
 {
     return(Point.by_coordinates(xyz.X, xyz.Y, xyz.Z));
 }