Ejemplo n.º 1
0
        bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index)
        {
            if(side == GH_ParameterSide.Input && !HiddenCodeInput && index == 0)
              m_inner_codeInput = Code;

              return true;
        }
Ejemplo n.º 2
0
 public IGH_Param CreateParameter(GH_ParameterSide side, int index)
 {
     switch (side)
       {
     case GH_ParameterSide.Input:
       {
     return new Param_ScriptVariable
       {
         NickName = GH_ComponentParamServer.InventUniqueNickname("xyzuvwst", this.Params.Input),
         Name = NickName,
         Description = "Script variable " + NickName,
       };
       }
     case GH_ParameterSide.Output:
       {
     return new Param_GenericObject
       {
         NickName = GH_ComponentParamServer.InventUniqueNickname("abcdefghijklmn", this.Params.Output),
         Name = NickName,
         Description = "Script variable " + NickName,
       };
       }
     default:
       {
     return null;
       }
       }
 }
Ejemplo n.º 3
0
 public bool CanInsertParameter(GH_ParameterSide side, int index)
 {
     if (side == GH_ParameterSide.Output)
     {
         return false;
     }
     return true;
 }
Ejemplo n.º 4
0
        /**
         * CreateParameter: check if the name already exists on the left hand side. If it does, do not create it.
         * Create new parameters on the fly
         */
        public IGH_Param CreateParameter(GH_ParameterSide side, int index)
        {
            Param_String param = new Param_String();

            string name = "Label";
            string compareName = name;
            int iteration = 0;
            bool nameFound = false;

            while (nameFound == false)
            {
                bool NameExists = false;

                if (iteration > 0)
                {
                    compareName = name + "_" + iteration.ToString();
                }

                foreach (IGH_Param Input in this.Params.Input)
                {
                    if (Input.NickName == compareName)
                    {
                        NameExists = true;
                        break;
                    }
                }
                if (NameExists)
                {
                    iteration++;
                } else {
                    nameFound = true;
                }
            }

            param.NickName = compareName;

            return param;
        }
Ejemplo n.º 5
0
        // https://www.grasshopper3d.com/forum/topics/how-to-register-input-output-params-dynamically-c-vs

        // La simple implémentation de l'interface signifie que vos composants seront correctement (dés) sérialisés
        // Sans cette interface, le composant suppose que le constructeur configure toutes les entrées et sorties et que la lecture des fichiers ne fonctionnera plus correctement.

        // Il est également important de toujours appeler Params.OnParametersChanged lorsque vous avez terminé d’apporter des modifications.

        // Cependant, vous n'êtes jamais censé faire cela depuis RunScript ou SolveInstance.
        // Des modifications de la topologie des composants et des modifications des fils ne peuvent être effectuées que lorsqu'une solution n'est pas en cours d'exécution.

        // Les paramètres de script prennent certaines mesures pour protéger les données pouvant être partagées entre plusieurs composants d'un fichier GH.
        // Les paramètres de script offrent également des mécanismes de transtypage aux types standard (bool, int, double, chaîne, Brep, Curve, Point3d, etc.) et aux modificateurs d'accès (item, liste, arborescence).

        public bool CanInsertParameter(GH_ParameterSide side, int index)
        {
            return(false);
        }
Ejemplo n.º 6
0
 public IGH_Param CreateParameter(GH_ParameterSide side, int index)
 {
     return(null);
 }
 bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index)
 {
     //Nothing to do here by the moment
     return true;
 }
Ejemplo n.º 8
0
 bool IGH_VariableParameterComponent.CanInsertParameter(GH_ParameterSide side, int index)
 {
     if (side == GH_ParameterSide.Input && Params.Input.Count < 10 && index == Params.Input.Count) return true;
     return false;
 }
 public bool DestroyParameter(GH_ParameterSide side, int index)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 10
0
 bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index) => false;
Ejemplo n.º 11
0
 public IGH_Param CreateParameter(GH_ParameterSide side, int index)
 {
     index_of_new_param = index;
     total_params_added++;
     if (total_params_added >= alpha.Length) total_params_added = 0;
     return new GHParam_DHr();
 }
Ejemplo n.º 12
0
 bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index) => false;
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index)
 {
     // see above.
     return false;
 }
Ejemplo n.º 14
0
 public bool CanRemoveParameter(GH_ParameterSide side, int index)
 {
     if (index < min_params) return false;
     if ((side == GH_ParameterSide.Input) && (this.Params.Input.Count > min_params)) return true;
     return false;
 }
 bool IGH_VariableParameterComponent.CanInsertParameter(GH_ParameterSide side, int index)
 {
     // we want this to be false, because we don't want those pesky users adding their own parameters
     // (but what if a cluster is a variable-input one?)
     // well, we'll deal with that later.
     return false;
 }
Ejemplo n.º 16
0
        IGH_Param IGH_VariableParameterComponent.CreateParameter(GH_ParameterSide side, int index)
        {
            String ltr = GH_ComponentParamServer.InventUniqueNickname("ABCDEFGHIJKLMNOPQRSTUVWXYZ", Params.Output);

            Param_Number param = new Param_Number {
                NickName = "t" + ltr,
                Name = "Variable" + ltr,
                Description = Name,
                Access = GH_ParamAccess.item
            };
            param.SetPersistentData(0.5);

            Param_Interval dparam = new Param_Interval {
                NickName = "d" + ltr,
                Name = "Domain" + ltr,
                Description = "Domain of Variable "+ltr,
                Access = GH_ParamAccess.item
            };
            dparam.SetPersistentData(new GH_Interval(new Interval(0.0,1.0)));
            Params.RegisterInputParam(dparam, Params.Input.Count);

            Param_Number oparam = new Param_Number {
                NickName = ltr,
                Name = "Variable" + ltr,
                Description = Name,
                Access = GH_ParamAccess.item
            };
            Params.RegisterOutputParam(oparam, Params.Input.Count);

            return param;
        }
Ejemplo n.º 17
0
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index)
 {
     if (side == GH_ParameterSide.Input && Params.Input.Count > 2 && index%2==0) return true;
     return false;
 }
 public bool CanRemoveParameter(GH_ParameterSide side, int index) => side == GH_ParameterSide.Input && index != 0;
Ejemplo n.º 19
0
 public IGH_Param CreateParameter(GH_ParameterSide side, int index) => null;
Ejemplo n.º 20
0
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index) => false;
Ejemplo n.º 21
0
 public bool DestroyParameter(GH_ParameterSide side, int index) => true;
 public bool CanRemoveParameter(GH_ParameterSide side, int index)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 23
0
 bool IGH_VariableParameterComponent.CanInsertParameter(GH_ParameterSide side, Int32 index)
 {
     return(false);
 }
Ejemplo n.º 24
0
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index) => false;
Ejemplo n.º 25
0
 bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, Int32 index)
 {
     return(false);
 }
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index)
 {
     //leave two inputs
     if (side == GH_ParameterSide.Input)
     {
         if (Params.Input.Count > 2)
             return true;
         else
             return false;
     }
     else
     {
         if (Params.Output.Count > 0)
             return true;
         else
             return false;
     }
 }
Ejemplo n.º 27
0
 bool IGH_VariableParameterComponent.CanInsertParameter(GH_ParameterSide side, int index)
 {
     return false;
 }
Ejemplo n.º 28
0
 public IGH_Param CreateParameter(GH_ParameterSide side, int index)
 {
     return new Grasshopper.Kernel.Parameters.Param_GenericObject();
 }
Ejemplo n.º 29
0
 bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index)
 {
     this.UpdateMetadata();
     return(true);
 }
Ejemplo n.º 30
0
 bool IGH_VariableParameterComponent.CanInsertParameter(GH_ParameterSide side, int index)
 {
     return(side != GH_ParameterSide.Output);
 }
Ejemplo n.º 31
0
 public bool CanRemoveParameter(GH_ParameterSide side, int index)
 {
     return(side == GH_ParameterSide.Input && Params.Input.Count > 1);
 }
Ejemplo n.º 32
0
 public bool CanRemoveParameter(GH_ParameterSide side, int index)
 {
     return(false);
 }
Ejemplo n.º 33
0
 public IGH_Param CreateParameter(GH_ParameterSide side, int index)
 {
     return(GetNewInputParameter());
 }
 public bool CanInsertParameter(GH_ParameterSide side, int index) => side == GH_ParameterSide.Input && index != 0;
Ejemplo n.º 35
0
 public bool DestroyParameter(GH_ParameterSide side, int index)
 {
     Params.UnregisterOutputParameter(Params.Output[index]);
     return(true);
 }
 public bool DestroyParameter(GH_ParameterSide side, int index)
 {
     return(true);
 }
Ejemplo n.º 37
0
 public bool DestroyParameter(GH_ParameterSide side, int index)
 {
     return(side == GH_ParameterSide.Input);
 }
Ejemplo n.º 38
0
 IGH_Param IGH_VariableParameterComponent.CreateParameter(GH_ParameterSide side, int index) => null;
Ejemplo n.º 39
0
 public IGH_Param CreateParameter(GH_ParameterSide side, int index)
 {
     return(new Param_GenericObject());
 }
Ejemplo n.º 40
0
 bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index)
 {
     //Nothing to do here by the moment
     return(true);
 }
 public virtual bool CanInsertParameter(GH_ParameterSide side, int index)
 {
     return(side == GH_ParameterSide.Input);
 }
 public IGH_Param CreateParameter(GH_ParameterSide side, int index)
 {
     throw new NotImplementedException();
 }
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index)
 {
     return((this as IGH_VariableParameterComponent).CanInsertParameter(side, index));
 }
Ejemplo n.º 44
0
 bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index)
 {
     return(true);
 }
 /// <summary>
 /// This function will get called before an attempt is made to insert a parameter.
 /// Since this method is potentially called on Canvas redraws, it must be fast.
 /// </summary>
 /// <param name="side"> Parameter side (input or output). </param>
 /// <param name="index"> Insertion index of parameter. Index=0 means the parameter will be in the topmost spot. </param>
 /// <returns> Return True if your component supports a variable parameter at the given location. </returns>
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index)
 {
     return(false);
 }
Ejemplo n.º 46
0
 IGH_Param IGH_VariableParameterComponent.CreateParameter(GH_ParameterSide side, int index) => null;
 /// <summary>
 /// This function will be called when a new parameter is about to be inserted.
 /// You must provide a valid parameter or insertion will be skipped.
 /// You do not, repeat not, need to insert the parameter yourself.
 /// </summary>
 /// <param name="side"> Parameter side (input or output). </param>
 /// <param name="index"> Insertion index of parameter. Index=0 means the parameter will be in the topmost spot. </param>
 /// <returns> A valid IGH_Param instance to be inserted. In our case a null value. </returns>
 IGH_Param IGH_VariableParameterComponent.CreateParameter(GH_ParameterSide side, int index)
 {
     return(null);
 }
 bool IGH_VariableParameterComponent.CanInsertParameter(GH_ParameterSide side, int index)
 {
     return true;
 }
Ejemplo n.º 49
0
 public bool CanRemoveParameter(GH_ParameterSide side, int index)
 {
     return side == GH_ParameterSide.Output;
 }
        IGH_Param IGH_VariableParameterComponent.CreateParameter(GH_ParameterSide side, int index)
        {
            Param_Number param = new Param_Number();
            param.Name = GH_ComponentParamServer.InventUniqueNickname("ABCDEFGHIJKLMNOPQRSTUVWXYZ", Params.Input);
            param.NickName = param.Name;
            param.Description = "Param" + (Params.Output.Count + 1);
            param.SetPersistentData(0.0);

            return param;
        }
Ejemplo n.º 51
0
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index)
 {
     return (this as IGH_VariableParameterComponent).CanInsertParameter(side, index);
 }
Ejemplo n.º 52
0
 // allways allow the parameter to be destroyed.
 public bool DestroyParameter(GH_ParameterSide side, int index)
 {
     return true;
 }
Ejemplo n.º 53
0
 public bool DestroyParameter(GH_ParameterSide side, int index)
 {
     return side == GH_ParameterSide.Output;
 }
Ejemplo n.º 54
0
 public bool CanInsertParameter(GH_ParameterSide side, int index)
 {
     return side == GH_ParameterSide.Output;
 }
Ejemplo n.º 55
0
 bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index)
 {
     Params.UnregisterInputParameter(Params.Input[index + 1]);
     Params.UnregisterOutputParameter(Params.Output[index/2]);
     return true;
 }