Exemplo n.º 1
0
        public static void WriteModel(string path, List <GH_Surface> surfaces = null, List <GH_Curve> curves = null, bool append = false)
        {
            SketchUpNET.SketchUp skp = new SketchUpNET.SketchUp();
            skp.Surfaces = new List <Surface>();
            skp.Edges    = new List <Edge>();
            skp.Curves   = new List <Curve>();

            if (curves != null)
            {
                foreach (var c in curves)
                {
                    var curve = c.Value;
                    if (curve.IsLinear())
                    {
                        var line = new SketchUpNET.Edge(curve.PointAt(0).ToSkpGeo(), curve.PointAt(1.0).ToSkpGeo(), DefaultLayer);
                        skp.Edges.Add(line);
                    }
                    else
                    {
                        skp.Curves.Add(curve.ToSkpGeo());
                    }
                }
            }

            if (surfaces != null)
            {
                foreach (var surface in surfaces)
                {
                    skp.Surfaces.Add(surface.Value.ToSkpGeo());
                }
            }

            if (System.IO.File.Exists(path) && append)
            {
                skp.AppendToModel(path);
            }
            else
            {
                skp.WriteNewModel(path);
            }
        }
Exemplo n.º 2
0
 public static Autodesk.DesignScript.Geometry.Line ToDSGeo(this SketchUpNET.Edge v, Transform t = null)
 {
     return(Autodesk.DesignScript.Geometry.Line.ByStartPointEndPoint(v.Start.ToDSGeo(t), v.End.ToDSGeo(t)));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Converts a SketchUp Edge to a Rhino Line
 /// </summary>
 public static Rhino.Geometry.Line ToRhinoGeo(this SketchUpNET.Edge v, Transform t = null)
 {
     return(new Rhino.Geometry.Line(v.Start.ToRhinoGeo(t), v.End.ToRhinoGeo(t)));
 }