コード例 #1
0
        private void state_Click(object sender, EventArgs e)
        {
            RecordUndoEvent("Set Function");
            ToolStripMenuItem currentItem = (ToolStripMenuItem)sender;

            Canvas.Menu.UncheckOtherMenuItems(currentItem);
            this.currentState = (Opperation)currentItem.Owner.Items.IndexOf(currentItem);

            UpdateIO();
        }
コード例 #2
0
            public Instruction(long instruction)
            {
                var digits = Util.GetDigits(instruction);

                switch (digits.Length)
                {
                case 0:
                    DE = Opperation.DATA;
                    C  = ParameterMode.OMIT;
                    B  = ParameterMode.OMIT;
                    A  = ParameterMode.OMIT;
                    break;

                case 1:
                    DE = (Opperation)digits[0];
                    C  = ParameterMode.OMIT;
                    B  = ParameterMode.OMIT;
                    A  = ParameterMode.OMIT;
                    break;

                case 2:
                    DE = (Opperation)((digits[1] * 10) + digits[0]);
                    C  = ParameterMode.OMIT;
                    B  = ParameterMode.OMIT;
                    A  = ParameterMode.OMIT;
                    break;

                case 3:
                    DE = (Opperation)((digits[1] * 10) + digits[0]);
                    C  = (ParameterMode)digits[2];
                    B  = ParameterMode.OMIT;
                    A  = ParameterMode.OMIT;
                    break;

                case 4:
                    DE = (Opperation)((digits[1] * 10) + digits[0]);
                    C  = (ParameterMode)digits[2];
                    B  = (ParameterMode)digits[3];
                    A  = ParameterMode.OMIT;
                    break;

                case 5:
                    DE = (Opperation)((digits[1] * 10) + digits[0]);
                    C  = (ParameterMode)digits[2];
                    B  = (ParameterMode)digits[3];
                    A  = (ParameterMode)digits[4];
                    break;
                }
            }
コード例 #3
0
 public override bool Read(GH_IReader reader)
 {
     this.currentState   = (Opperation)reader.GetInt32("ComponentState");
     this.previouseState = (Opperation)reader.GetInt32("PreviouseComponentState");
     return(base.Read(reader));
 }
コード例 #4
0
        private bool UpdateIO()
        {
            bool update = (previouseState != currentState);

            if (!update)
            {
                return(false);
            }

            // Set the input and Out put parameters for the different states
            switch (currentState)
            {
            case Opperation.Acceleration:
                Params.RemoveAllInputs();
                Params.RemoveAllOutputs();
                this.AddInputs(new[] { 0, 1 }, inputParams);
                this.AddOutput(0, outputParams);
                Params.Input[0].Optional = true;
                Params.Input[1].Optional = true;
                break;

            case Opperation.CallProcedure:
                Params.RemoveAllInputs();
                Params.RemoveAllOutputs();
                this.AddInputs(new[] { 2, 3 }, inputParams);
                this.AddOutput(0, outputParams);
                Params.Input[1].Optional = true;
                break;

            case Opperation.Comment:
                Params.RemoveAllInputs();
                Params.RemoveAllOutputs();
                this.AddInput(4, inputParams);
                this.AddOutput(0, outputParams);
                break;

            case Opperation.DefineProcedure:
                Params.RemoveAllInputs();
                Params.RemoveAllOutputs();
                this.AddInputs(new[] { 5, 6, 7 }, inputParams);
                this.AddOutput(1, outputParams);
                Params.Input[1].Optional = true;
                break;

            case Opperation.SetDO:
                Params.RemoveAllInputs();
                Params.RemoveAllOutputs();
                this.AddInputs(new[] { 8, 9, 10 }, inputParams);
                this.AddOutput(0, outputParams);
                Params.Input[0].Optional = true;
                Params.Input[1].Optional = true;
                Params.Input[2].Optional = true;
                break;

            case Opperation.SetVelocity:
                Params.RemoveAllInputs();
                Params.RemoveAllOutputs();
                this.AddInputs(new[] { 11, 12 }, inputParams);
                this.AddOutput(0, outputParams);
                Params.Input[0].Optional = true;
                Params.Input[1].Optional = true;
                break;
                //case Opperation.SoftMove:
                //    Params.RemoveAllInputs();
                //    this.AddInputs(new[] { 13,14 }, inputParams);
                //    Params.Input[0].Optional = true;
                //    Params.Input[1].Optional = true;
                //    break;
            }

            previouseState = currentState;
            DestroyIconCache();
            ExpireSolution(true);

            return(true);
        }
コード例 #5
0
ファイル: GH_PlaneOptions.cs プロジェクト: AxisArch/Axis
        private bool UpdateIO()
        {
            bool update = (previouseState != currentState);

            if (!update)
            {
                return(false);
            }

            // Set the input and Out put parameters for the different states
            switch (currentState)
            {
            case Opperation.PlaneToQuatertion:
                int pInput = Params.Input.Count;
                Params.RemoveAllInputs();
                Params.RemoveAllOutputs();
                this.AddInput(0, inputParams);
                this.AddOutput(1, outputParams);
                break;

            case Opperation.QuaternionToPlane:
                Params.RemoveAllInputs();
                Params.RemoveAllOutputs();
                this.AddInputs(new[] { 1, 2 }, inputParams);
                this.AddOutput(0, outputParams);
                break;

            case Opperation.PlaneToEuler:
                Params.RemoveAllInputs();
                Params.RemoveAllOutputs();
                this.AddInput(0, inputParams);
                this.AddOutput(1, outputParams);
                break;

            case Opperation.EulerToPlane:
                Params.RemoveAllInputs();
                Params.RemoveAllOutputs();
                this.AddInputs(new[] { 1, 2 }, inputParams);
                this.AddOutput(0, outputParams);
                break;

            case Opperation.SurfaceFrame:
                Params.RemoveAllInputs();
                Params.RemoveAllOutputs();
                this.AddInput(3, inputParams);
                this.AddOutput(0, outputParams);
                break;

            case Opperation.FlipPlane:
                Params.RemoveAllInputs();
                Params.RemoveAllOutputs();
                this.AddInput(0, inputParams);
                this.AddOutput(0, outputParams);
                break;
            }

            previouseState = currentState;
            DestroyIconCache();
            ExpireSolution(true);

            return(true);
        }