예제 #1
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;
            }
        }
예제 #2
0
 public override bool Write(GH_IWriter writer)
 {
     writer.SetInt32("Count", Value.Count);
     for (int i = 0; i < Value.Count; ++i)
     {
         writer.SetPlane("v", i,
                         new GH_IO.Types.GH_Plane(
                             Value[i].OriginX,
                             Value[i].OriginY,
                             Value[i].OriginZ,
                             Value[i].XAxis.X,
                             Value[i].XAxis.Y,
                             Value[i].XAxis.Z,
                             Value[i].YAxis.X,
                             Value[i].YAxis.Y,
                             Value[i].YAxis.Z
                             )
                         );
     }
     return(base.Write(writer));
 }
예제 #3
0
 public static void WritePlane(GH_IWriter writer, string itemName, Plane data)
 {
     writer.SetPlane(itemName, data.ToIO());
 }