Пример #1
0
        public override bool Write(GH_IWriter writer)
        {
            writer.SetInt32("FPSIndex", FPSindex);

            writer.SetInt32("SizeWidth", PictWidth);
            writer.SetInt32("SizeHeight", PictHeight);
            writer.SetInt32("SizeIndex", Sizeindex);

            writer.SetInt32("TypeIndex", Typeindex);

            writer.SetBoolean("Duration", Duration);
            writer.SetBoolean("Remap", Remap);
            writer.SetDouble("TimeInFrame", TimeInFrame);

            writer.SetDouble("DelayLog", DelayLog);
            writer.SetBoolean("Save", Save);

            writer.SetDouble("SliderMul", SliderMultiple);
            writer.SetDouble("ViewportReduce", ViewportReduce);
            writer.SetBoolean("ShowLabel", ShowLabel);
            writer.SetDouble("LabelSize", LabelSize);
            writer.SetBoolean("ShowFrame", ShowFrame);
            writer.SetBoolean("ShowTime", ShowTime);
            writer.SetBoolean("ShowPercent", ShowPercent);
            writer.SetBoolean("ShowRemain", ShowRemain);
            writer.SetBoolean("ShowGraph", ShowGraph);
            writer.SetBoolean("ShowGraphEvent", ShowGraphOnEvent);
            return(base.Write(writer));
        }
Пример #2
0
        /*
         * public void DrawViewportMeshes(GH_PreviewMeshArgs args)
         * {
         *  if (DisplayMesh != null)
         *      args.Pipeline.DrawMeshShaded(DisplayMesh, args.Material);
         * }
         *
         * public void DrawViewportWires(GH_PreviewWireArgs args)
         * {
         *  if (DisplayMesh != null)
         *      args.Pipeline.DrawMeshWires(DisplayMesh, args.Color);
         * }
         */
        #region Serialization

        public override bool Write(GH_IWriter writer)
        {
            if (Value == null)
            {
                return(false);
            }
            byte[] centrelineBytes = GH_Convert.CommonObjectToByteArray(Value.Centreline);
            writer.SetByteArray("guide", centrelineBytes);

            //writer.SetInt32("num_frames", Value.Frames.Count);

            //for (int i = 0; i < Value.Frames.Count; ++i)
            //{
            //    Plane p = Value.Frames[i].Item2;
            //
            //    writer.SetPlane("frames", i, new GH_IO.Types.GH_Plane(
            //        p.OriginX, p.OriginY, p.OriginZ, p.XAxis.X, p.XAxis.Y, p.XAxis.Z, p.YAxis.X, p.YAxis.Y, p.YAxis.Z));
            //}

            writer.SetInt32("lcx", Value.Data.NumWidth);
            writer.SetInt32("lcy", Value.Data.NumHeight);
            writer.SetDouble("lsx", Value.Data.LamWidth);
            writer.SetDouble("lsy", Value.Data.LamHeight);
            writer.SetInt32("interpolation", (int)Value.Data.InterpolationType);
            writer.SetInt32("samples", Value.Data.Samples);


            return(true);
        }
Пример #3
0
 static public bool Write(GH_IWriter writer, ToolSettings t)
 {
     writer.SetDouble("ToolDiameter", t.ToolDiameter);
     writer.SetDouble("StepDown", t.StepDown);
     writer.SetDouble("StepOver", t.StepOver);
     return(true);
 }
Пример #4
0
 public override bool Write(GH_IWriter writer)
 {
     writer.SetDouble("e", e);
     writer.SetDouble("t0", t0);
     writer.SetDouble("t1", t1);
     return(true);
 }
Пример #5
0
 public override bool Write(GH_IWriter writer)
 {
     writer.SetDouble("RapidZ", settings.RapidZ);
     writer.SetDouble("SafeZ", settings.SafeZ);
     writer.SetDouble("FeedRate", settings.FeedRate);
     writer.SetDouble("RapidRate", settings.RapidRate);
     writer.SetBoolean("UseExternalAxis", settings.UseExternalAxis);
     return(base.Write(writer));
 }
Пример #6
0
 public static void WriteGlulamData(GH_IWriter writer, GlulamData data)
 {
     writer.SetInt32("data_NumWidth", data.NumWidth);
     writer.SetInt32("data_NumHeight", data.NumHeight);
     writer.SetDouble("data_LamWidth", data.LamWidth);
     writer.SetDouble("data_LamHeight", data.LamHeight);
     writer.SetInt32("data_Samples", data.Samples);
     writer.SetInt32("data_Interpolation", (int)data.InterpolationType);
     writer.SetInt32("data_SectionAlignment", (int)data.SectionAlignment);
 }
        public override bool Write(GH_IWriter writer)
        {
            GH_IWriter gH_IWriter = writer.CreateChunk("Slider", Index);

            gH_IWriter.SetDouble("MinValue", minValue);
            gH_IWriter.SetDouble("MaxValue", maxValue);
            gH_IWriter.SetDouble("CurrentValue", currentValue);
            gH_IWriter.SetInt32("NumDecimals", numDecimals);
            return(true);
        }
Пример #8
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);
 }
Пример #9
0
        public override bool Write(GH_IWriter writer)
        {
            if (Value == null)
            {
                return(false);
            }

            writer.SetInt32("lcx", Value.NumWidth);
            writer.SetInt32("lcy", Value.NumHeight);
            writer.SetDouble("lsx", Value.LamWidth);
            writer.SetDouble("lsy", Value.LamHeight);
            writer.SetInt32("interpolation", (int)Value.InterpolationType);
            writer.SetInt32("samples", Value.Samples);

            return(true);
        }
Пример #10
0
        private void writeCustomControls(GH_IWriter writer, IEnumerable <GHControl> customControls, string path)
        {
            foreach (GHControl control in customControls)
            {
                string name = (path.Length > 0) ? (path + "." + control.Name): control.Name;
                if (control is GHParameter)
                {
                    GHParameter param = (GHParameter)control;
                    switch (param.DataType)
                    {
                    case GH_Types.gh_bool:
                        writer.SetBoolean(name, (bool)param.CurrentValue);
                        break;

                    case GH_Types.gh_double:
                        writer.SetDouble(name, (double)param.CurrentValue);
                        break;

                    case GH_Types.gh_int32:
                        writer.SetInt32(name, (int)param.CurrentValue);
                        break;

                    case GH_Types.gh_decimal:
                        writer.SetDecimal(name, Convert.ToDecimal(param.CurrentValue));
                        break;
                    }
                }
                if (control is IGHPanel)
                {
                    writeCustomControls(writer, ((IGHPanel)control).Items, name);
                }
            }
        }
 //Write
 public override bool Write(GH_IWriter writer)
 {
     writer.SetDouble("scale", this.Scale);
     writer.SetBoolean("DisableClickable", this.DisableClickable);
     writer.SetBoolean("SaveImgWithCoords", this.ifSaveThis);
     return(base.Write(writer));
 }
Пример #12
0
        public override bool Write(GH_IWriter writer)
        {
            //byte[] centrelineBytes = GH_Convert.CommonObjectToByteArray(Value.Centreline);
            //writer.SetByteArray("centreline", 0, centrelineBytes);

            writer.SetString("name", Value.Name);
            writer.SetInt32("shape", (int)Value.Shape);
            writer.SetInt32("maxfeed", Value.FeedRate);
            writer.SetInt32("maxspeed", Value.SpindleSpeed);
            writer.SetInt32("plunge", Value.PlungeRate);
            writer.SetDouble("diameter", Value.Diameter);
            writer.SetDouble("length", Value.Length);
            writer.SetInt32("number", Value.Number);
            writer.SetInt32("offset", Value.OffsetNumber);

            return(base.Write(writer));
        }
Пример #13
0
        public override bool Write(GH_IWriter writer)
        {
            writer.SetInt32("Size", SpacingMode);
            writer.SetInt32("Pattern", PatternModeStatus);
            writer.SetDouble("Width", PatternWeight);

            return(base.Write(writer));
        }
Пример #14
0
        public override bool Write(GH_IWriter writer)
        {
            writer.SetInt32("Space", FillSpace);
            writer.SetBoolean("Embed", IsEmbedded);
            writer.SetDouble("Scale", ScaleFactor);

            this.UpdateMessage();
            return(base.Write(writer));
        }
Пример #15
0
        public override bool Write(GH_IWriter writer)
        {
            int n = 0;

            foreach (var kps in keyPoints)
            {
                writer.SetInt32(n.ToString() + "K", kps.Key);
                writer.SetDouble(n.ToString() + "V", kps.Value);
                n++;
            }
            writer.SetInt32("Count", n);
            writer.SetBoolean("ShowGraphSlider", ShowGraphOnSlider);

            return(base.Write(writer));
        }
Пример #16
0
        public override bool Write(GH_IWriter writer)
        {
            writer.SetInt32("Vertical", hJustify);
            writer.SetInt32("Horizontal", vJustify);

            writer.SetBoolean("Bold", IsBold);
            writer.SetBoolean("Italic", IsItalic);
            writer.SetBoolean("Under", IsUnder);

            writer.SetDrawingColor("Color", DrawColor);

            writer.SetString("FontName", fName);
            writer.SetDouble("FontSize", fSize);

            return(base.Write(writer));
        }
Пример #17
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;
            }
        }
Пример #18
0
 public static void WriteDouble(GH_IWriter writer, string itemName, double data)
 {
     writer.SetDouble(itemName, data);
 }