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
        public override Value Evaluate(FSharpList <Value> args)
        {
            String file_name = ((Value.String)args[0]).Item;

            DSObjectList objects = ASMImporter.import_file(file_name);

            _result.Clear();

            foreach (DSObject obj in objects)
            {
                DSObject restored = RestoreProperDSType(obj);

                _result.Add(restored);

                GraphicItem item = restored as GraphicItem;

                if (item == null)
                {
                    continue;
                }

                GraphicItem.persist(item);
                _graphicItems.Add(item);
            }

            List <Value> return_values = new List <Value>();

            foreach (DSObject obj in _result)
            {
                return_values.Add(Value.NewContainer(obj));
            }

            return(Value.NewList(Utils.SequenceToFSharpList(return_values)));
        }
Example #3
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            var input = ((Value.Container)args[0]).Item;

            GraphicItem item = input as GraphicItem;

            return(args[0]);
        }
Example #4
0
        public void ClearReferences()
        {
            foreach (GraphicItem g in _graphicItems)
            {
                GraphicItem.unpersist(g);
            }

            _graphicItems.Clear();
        }
Example #5
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 #6
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Curve pathCurve    = (Curve)((Value.Container)args[0]).Item;
            Curve crossSection = (Curve)((Value.Container)args[1]).Item;

            _solid = crossSection.sweep_as_solid(pathCurve);
            GraphicItem.persist(_solid);

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

            _solid = surf.thicken(dist);
            GraphicItem.persist(_solid);

            return(Value.NewContainer(_solid));
        }
Example #8
0
 public Item(Guid guid, String tag, Box model, Box graphic, Box text, bool visible, GraphicItem graphicItem)
 {
     this.guid        = guid;
     this.tag         = tag;
     this.model       = model;
     this.graphic     = graphic;
     this.text        = text;
     this.visible     = visible;
     this.graphicItem = graphicItem;
 }
Example #9
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 #10
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 #11
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Curve  curve = (Curve)((Value.Container)args[0]).Item;
            Vector dir   = (Vector)((Value.Container)args[1]).Item;
            double dist  = ((Value.Number)args[2]).Item;

            _surface = curve.extrude(dir, dist);
            GraphicItem.persist(_surface);

            return(Value.NewContainer(_surface));
        }
Example #12
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            var input = ((Value.Container)args[0]).Item;

            GraphicItem item = input as GraphicItem;

            if (item != null)
            {
                _graphicItems.Add(item);
            }

            return(args[0]);
        }
Example #13
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Geometry geom1 = (Geometry)((Value.Container)args[0]).Item;
            Geometry geom2 = (Geometry)((Value.Container)args[1]).Item;

            GeometryList result = geom1.intersect(geom2);

            foreach (Geometry g in _result)
            {
                GraphicItem.unpersist(g);
            }

            _result.Clear();

            foreach (Geometry g in result)
            {
                Geometry restored = RestoreProperType(g);

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

            if (_result.Count == 1)
            {
                return(Value.NewContainer(_result[0]));
            }
            else
            {
                List <Value> return_values = new List <Value>();

                foreach (Geometry g in _result)
                {
                    return_values.Add(Value.NewContainer(g));
                }

                return(Value.NewList(Utils.SequenceToFSharpList(return_values)));
            }
        }
Example #14
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            DSObject item = (DSObject)((Value.Container)args[0]).Item;
            Vector   v    = (Vector)((Value.Container)args[1]).Item;

            DSObject cloned = item.clone();

            _transformableItem = RestoreProperDSType(cloned) as TransformableItem;

            // TODO: throw exception if not transformable item

            _transformableItem.translate(v.x(), v.y(), v.z());

            GraphicItem graphicItem = _transformableItem as GraphicItem;

            if (graphicItem != null)
            {
                GraphicItem.persist(graphicItem);
            }

            return(Value.NewContainer(_transformableItem));
        }
Example #15
0
 public void Add(GraphicItem item)
 {
     blocks.Add(item);
 }