Пример #1
0
 public override bool Write(GH_IWriter writer)
 {
     for (int i = 0; i < count; i++)
     {
         Point3d val = pts[i];
         writer.SetPoint3D("pt", i, new GH_Point3D(val.X, val.Y, val.Z));
     }
     return(true);
 }
Пример #2
0
        public static void WriteCrossSectionOrientation(GH_IWriter writer, CrossSectionOrientation ori)
        {
            writer.SetString("orientation", ori.ToString());

            switch (ori)
            {
            case RmfOrientation rmf:
                return;

            case PlanarOrientation plan:
                var plane = plan.Plane;
                writer.SetPlane("orientation_plane", new GH_IO.Types.GH_Plane(
                                    plane.Origin.X, plane.Origin.Y, plane.Origin.Z,
                                    plane.XAxis.X, plane.XAxis.Y, plane.XAxis.Z,
                                    plane.YAxis.X, plane.YAxis.Y, plane.YAxis.Z

                                    ));
                return;

            case VectorOrientation vec:
                var v = (Vector3d)vec.GetDriver();
                writer.SetPoint3D("orientation_vector", new GH_IO.Types.GH_Point3D(v.X, v.Y, v.Z));
                return;

            case SurfaceOrientation srf:
                writer.SetByteArray("orientation_surface", GH_Convert.CommonObjectToByteArray(srf.GetDriver() as Brep));
                return;

            case VectorListOrientation vlist:
                writer.SetInt32("orientation_num_vectors", vlist.Vectors.Count);
                writer.SetByteArray("orientation_guide", GH_Convert.CommonObjectToByteArray(vlist.GetCurve()));
                for (int i = 0; i < vlist.Parameters.Count; ++i)
                {
                    writer.SetDouble("orientation_parameter", i, vlist.Parameters[i]);
                    writer.SetPoint3D("orientation_vector", i, new GH_IO.Types.GH_Point3D(
                                          vlist.Vectors[i].X, vlist.Vectors[i].Y, vlist.Vectors[i].Z));
                }
                return;

            default:
                return;
            }
        }
Пример #3
0
 bool GH_ISerializable.Write(GH_IWriter writer)
 {
     writer.SetString("Text", Text);
     writer.SetString("Font", Font);
     writer.SetDrawingColor("Colour", Colour);
     writer.SetPoint3D("Location", new GH_Point3D(Location.X, Location.Y, Location.Z));
     writer.SetDouble("Horizontal", HorizontalAlignment);
     writer.SetDouble("Vertical", VerticalAlignment);
     writer.SetDouble("Rotation", Rotation);
     return(true);
 }
Пример #4
0
        bool GH_ISerializable.Write(GH_IWriter writer)
        {
            writer.SetInt32("PointCount", _points.Length);
            for (int i = 0; i < _points.Length; i++)
            {
                writer.SetPoint3D("Point", i, new GH_Point3D(_points[i].X, _points[i].Y, _points[i].Z));
            }

            writer.SetInt32("EdgeCount", _edges.Count);
            for (int i = 0; i < _edges.Count; i++)
            {
                writer.SetString("Edge", i, _edges[i]);
            }

            writer.SetInt32("FillCount", _fills.Count);
            for (int i = 0; i < _fills.Count; i++)
            {
                writer.SetString("Fill", i, _fills[i]);
            }

            writer.SetBoolean("FillsBeforeEdges", DrawFillsBeforeEdges);
            return(true);
        }
Пример #5
0
 public static void WriteVector3D(GH_IWriter writer, string itemName, Vector3d data)
 {
     writer.SetPoint3D(itemName, data.ToIO());
 }
Пример #6
0
 public static void WritePoint3D(GH_IWriter writer, string itemName, int itemIndex, Point3d data)
 {
     writer.SetPoint3D(itemName, itemIndex, data.ToIO());
 }