Beispiel #1
0
 // Deserialize this instance from a Grasshopper reader object.
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     if (reader.ItemExists("CSDyn"))
     {
         this.dynamicCS.Checked = reader.GetBoolean("CSDyn");
     }
     if (reader.ItemExists("CSDec"))
     {
         this.outputDec.Checked = reader.GetBoolean("CSDec");
     }
     return(base.Read(reader));
 }
Beispiel #2
0
 // Deserialize this instance from a Grasshopper reader object.
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     if (reader.ItemExists("Manufacturer"))
     {
         this.Manufacturer = (Manufacturer)reader.GetInt32("Manufacturer");
     }
     if (reader.ItemExists("StartPose"))
     {
         this.PoseOut.Checked = reader.GetBoolean("Pose");
     }
     return(base.Read(reader));
 }
Beispiel #3
0
 // Deserialize this instance from a Grasshopper reader object.
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     if (reader.ItemExists("LogOption"))
     {
         this.logOption.Checked = reader.GetBoolean("LogOption");
     }
     if (reader.ItemExists("ModFileOption"))
     {
         this.modFile.Checked = reader.GetBoolean("ModFileOption");
     }
     return(base.Read(reader));
 }
        /// <summary>
        /// Read a file
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            var hisChunk = reader.FindChunk("historicData");
            var genChunk = reader.FindChunk("genoData");

            if (hisChunk != null)
            {
                var data = new GH_Structure <GH_Number>();
                data.Read(hisChunk);
                Value.historicData = new GH_Structure <GH_Number>(data, true);
            }

            if (genChunk != null)
            {
                var data = new GH_Structure <GH_Guid>();
                data.Read(genChunk);
                Value.genoGuids = new GH_Structure <GH_Guid>(data, true);
            }

            if (reader.ItemExists("popCount"))
            {
                Value.PopCount = reader.GetInt32("popCount");
            }

            return(true);
        }
Beispiel #5
0
        // Deserialize this instance from a Grasshopper reader object.
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            if (reader.ItemExists("UseTimeline"))
            {
                this.timelineOption.Checked = reader.GetBoolean("UseTimeline");
            }
            if (reader.ItemExists("ShowSpeed"))
            {
                this.speedCheck.Checked = reader.GetBoolean("ShowSpeed");
            }
            if (reader.ItemExists("ShowAngles"))
            {
                this.anglesCheck.Checked = reader.GetBoolean("ShowAngles");
            }
            if (reader.ItemExists("ShowMotion"))
            {
                this.motionCheck.Checked = reader.GetBoolean("ShowMotion");
            }
            if (reader.ItemExists("ShowExternal"))
            {
                this.externalCheck.Checked = reader.GetBoolean("ShowExternal");
            }
            if (reader.ItemExists("ShowFlange"))
            {
                this.flangeCheck.Checked = reader.GetBoolean("ShowFlange");
            }
            if (reader.ItemExists("FullProgramCheck"))
            {
                this.fullprogramCheck.Checked = reader.GetBoolean("FullProgramCheck");
            }

            return(base.Read(reader));
        }
 // Deserialize this instance from a Grasshopper reader object.
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     if (reader.ItemExists("OutputCode"))
     {
         this.outputCode.Checked = reader.GetBoolean("OutputCode");
     }
     if (reader.ItemExists("Manufacturer"))
     {
         this.Manufacturer = (Manufacturer)reader.GetInt32("Manufacturer");
     }
     if (reader.ItemExists("MotionType"))
     {
         this.c_motionType = (MotionType)reader.GetInt32("MotionType");
     }
     if (reader.ItemExists("RotAxis"))
     {
         this.extRotAxisCheck.Checked = reader.GetBoolean("RotAxis");
     }
     if (reader.ItemExists("LinAxis"))
     {
         this.extLinAxisCheck.Checked = reader.GetBoolean("LinAxis");
     }
     if (reader.ItemExists("ShowZone"))
     {
         this.showZoneCheck.Checked = reader.GetBoolean("ShowZone");
     }
     if (reader.ItemExists("Method"))
     {
         this.interpolation.Checked = reader.GetBoolean("Method");
     }
     return(base.Read(reader));
 }
Beispiel #7
0
 // Deserialize this instance from a Grasshopper reader object.
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     if (reader.ItemExists("StopPoint"))
     {
         this.stopPoint.Checked = reader.GetBoolean("StopPoint");
     }
     if (reader.ItemExists("UseReorientation"))
     {
         this.orientOpt.Checked = reader.GetBoolean("UseReorientation");
     }
     if (reader.ItemExists("UseExternal"))
     {
         this.extAxOpt.Checked = reader.GetBoolean("UseExternal");
     }
     if (reader.ItemExists("UseDegrees"))
     {
         this.toolOriOpt.Checked = reader.GetBoolean("UseDegrees");
     }
     if (reader.ItemExists("UseLinear"))
     {
         this.linExtOpt.Checked = reader.GetBoolean("UseLinear");
     }
     if (reader.ItemExists("UseRotary"))
     {
         this.rotExtOpt.Checked = reader.GetBoolean("UseRotary");
     }
     if (reader.ItemExists("OutputDec"))
     {
         this.declarationCheck.Checked = reader.GetBoolean("OutputDec");
     }
     return(base.Read(reader));
 }
        // To persist selection state variables we need to override Read to check for state in the definiton
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            if (reader.ItemExists(this.storageKeyForHideObscure)) // Load form UI state (e.g. hide obscure)
            {
                this.hideObscureFeatures = reader.GetBoolean(storageKeyForHideObscure);
            }

            // Load selected items stored as key=value lists
            if (reader.ItemExists(storageKeyForSelectionState))
            {
                var stateKeyValues = reader.GetString(storageKeyForSelectionState);
                if (!string.IsNullOrEmpty(stateKeyValues))
                {
                    this.storedSelectionState = reader.GetString(storageKeyForSelectionState);
                }
            }
            return(base.Read(reader));
        }
Beispiel #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            if (reader.ItemExists("allSavedText"))
            {
                writtenText = reader.GetString("allSavedText");
                PythonIDE.PythonCanvas.Text = writtenText;
            }

            return(base.Read(reader));
        }
Beispiel #10
0
 // Deserialize this instance from a Grasshopper reader object.
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     if (reader.ItemExists("Manufacturer"))
     {
         this.Manufacturer = (Manufacturer)reader.GetInt32("Manufacturer");
     }
     if (reader.ItemExists("Weight"))
     {
         this.weightOption.Checked = reader.GetBoolean("Weight");
     }
     if (reader.ItemExists("Declaration"))
     {
         this.declOption.Checked = reader.GetBoolean("Declaration");
     }
     if (reader.ItemExists("Relative Tool Offset"))
     {
         this.reltoolOption.Checked = reader.GetBoolean("Relative Tool Offset");
     }
     return(base.Read(reader));
 }
Beispiel #11
0
 // Deserialize this instance from a Grasshopper reader object.
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     if (reader.ItemExists("UseRotation"))
     {
         this.rotOption.Checked = reader.GetBoolean("UseRotation");
     }
     if (reader.ItemExists("UseExtLin"))
     {
         this.extLinOpt.Checked = reader.GetBoolean("UseExtLin");
     }
     if (reader.ItemExists("UseExtRot"))
     {
         this.extRotOpt.Checked = reader.GetBoolean("UseExtRot");
     }
     if (reader.ItemExists("UseTime"))
     {
         this.timeOption.Checked = reader.GetBoolean("UseTime");
     }
     if (reader.ItemExists("UseName"))
     {
         this.nameOption.Checked = reader.GetBoolean("UseName");
     }
     if (reader.ItemExists("OutputDec"))
     {
         this.declarationCheck.Checked = reader.GetBoolean("OutputDec");
     }
     return(base.Read(reader));
 }
Beispiel #12
0
 // Deserialize this instance from a Grasshopper reader object.
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     if (reader.ItemExists("ModName"))
     {
         this.moduleName.Checked = reader.GetBoolean("ModName");
     }
     if (reader.ItemExists("Declarations"))
     {
         this.declarationsCheck.Checked = reader.GetBoolean("Declarations");
     }
     if (reader.ItemExists("Overrides"))
     {
         this.overrideCheck.Checked = reader.GetBoolean("Overrides");
     }
     if (reader.ItemExists("Manufacturer"))
     {
         this.Manufacturer = (Manufacturer)reader.GetInt32("Manufacturer");
     }
     if (reader.ItemExists("IgnoreLen"))
     {
         this.ignore.Checked = reader.GetBoolean("IgnoreLen");
     }
     return(base.Read(reader));
 }
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            // 2013 Oct 8 - Giulio
            // Removing all hacks and making this work properly from Gh 0.9.61 onwards
            // The logic is this: this component ALWAYS gets constructed without "code" & with "out".
            // Then, when they are not necessary, these are added or removed.
            // RegisterInput/Output must always insert the original amount of items.


            if (reader.ItemExists(ID_EditorLocation))
            {
                DefaultEditorLocation = reader.GetDrawingPoint(ID_EditorLocation);
            }
            if (reader.ItemExists(ID_EditorSize))
            {
                DefaultEditorSize = reader.GetDrawingSize(ID_EditorSize);
            }

            bool hideInput = true;

            if (reader.TryGetBoolean(ID_HideInput, ref hideInput))
            {
                HiddenCodeInput = hideInput;
            }

            bool hideOutput = false;

            if (reader.TryGetBoolean(ID_HideOutput, ref hideOutput))
            {
                HiddenOutOutput = hideOutput;
            }

            if (hideInput)
            {
                if (!reader.TryGetString(ID_CodeInput, ref m_inner_codeInput))
                {
                    m_inner_codeInput = string.Empty;
                }
            }

            bool rc = base.Read(reader);


            // Dynamic input fix for existing scripts
            // Always assign DynamicHint or Grasshopper
            // will set Line and not LineCurve, etc...
            if (Params != null && Params.Input != null)
            {
                for (int i = HiddenCodeInput ? 1 : 0; i < Params.Input.Count; i++)
                {
                    var p = Params.Input[i] as Param_ScriptVariable;
                    if (p != null)
                    {
                        FixGhInput(p, false);
                        if (p.TypeHint == null)
                        {
                            p.TypeHint = p.Hints[0];
                        }
                    }
                }
            }
            return(rc);
        }