コード例 #1
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)
            {
                throw new Exception("GlulamParameter.Value is null.");
            }

            writer.SetByteArray("guide", GH_Convert.CommonObjectToByteArray(Value.Centreline));

            GH_Glulam.WriteCrossSectionOrientation(writer, Value.Orientation);
            GH_GlulamData.WriteGlulamData(writer, Value.Data);

            return(base.Write(writer));
        }
コード例 #2
0
        public override bool Read(GH_IReader reader)
        {
            if (!reader.ItemExists("guide"))
            {
                Value = null;
                throw new Exception("Couldn't retrieve 'guide'.");
            }

            Curve guide = GH_Convert.ByteArrayToCommonObject <Curve>(reader.GetByteArray("guide"));

            if (guide == null)
            {
                throw new Exception("Failed to convert 'guide'.");
            }

            CrossSectionOrientation ori = GH_Glulam.ReadCrossSectionOrientation(reader);
            GlulamData data             = GH_GlulamData.ReadGlulamData(reader);

            Value = Glulam.CreateGlulam(guide, ori, data);

            return(base.Read(reader));
        }
コード例 #3
0
 public GH_Glulam(GH_Glulam goo)
 {
     this.Value = goo.Value?.Duplicate();
 }