Esempio n. 1
0
 protected override void RegisterInputParams(GH_InputParamManager pManager)
 {
     pManager.AddParameter(new Parameter_TwistedBox(), "Box", "B", "The box to evaluate", GH_ParamAccess.item);
     pManager.AddIntervalParameter("U Domain", "U", "The U Domain", GH_ParamAccess.item, new Interval(0, 1));
     pManager.AddIntervalParameter("V Domain", "V", "The V Domain", GH_ParamAccess.item, new Interval(0, 1));
     pManager.AddIntervalParameter("W Domain", "W", "The W Domain", GH_ParamAccess.item, new Interval(0, 1));
 }
Esempio n. 2
0
 protected override void RegisterInputParams(GH_InputParamManager pManager)
 {
     pManager.AddIntegerParameter("Layers", "L", "Neurons per layer, first number = Inputs", GH_ParamAccess.list);
     pManager.AddIntegerParameter("Activation", "F(x)", "Activation function per layer. 0:Linear 1:Relu 2:Sigmoid 3:Tanh", GH_ParamAccess.list);
     pManager.AddIntervalParameter("Range", "R", "Initializer range", GH_ParamAccess.item, new Interval(0, 1));
     pManager.AddIntegerParameter("Seed", "S", "Random seed", GH_ParamAccess.item, 123);
 }
Esempio n. 3
0
 protected override void RegisterInputParams(GH_InputParamManager pManager)
 {
     pManager.AddMeshParameter("Mesh", "M", "Mesh.", GH_ParamAccess.item);
     pManager.AddNumberParameter("Nozzle diameter", "D", "Nozzle diameter", GH_ParamAccess.item);
     pManager.AddNumberParameter("Layer height", "H", "Layer height", GH_ParamAccess.item);
     pManager.AddIntervalParameter("Region", "R", "Region", GH_ParamAccess.item);
 }
Esempio n. 4
0
        protected override void RegisterInputParams(GH_InputParamManager manager)
        {
            base.RegisterInputParams(manager);

            manager[manager.AddIntervalParameter("Elevation", "E", "Level elevation interval", GH_ParamAccess.item)].Optional = true;
            manager[manager.AddTextParameter("Name", "N", "Level name", GH_ParamAccess.item)].Optional = true;
            manager[manager.AddParameter(new Parameters.ElementFilter(), "Filter", "F", "Filter", GH_ParamAccess.item)].Optional = true;
        }
Esempio n. 5
0
        protected override void RegisterInputParams(GH_InputParamManager manager)
        {
            base.RegisterInputParams(manager);

            manager[manager.AddParameter(new Parameters.Param_Enum <Types.WallSystemFamily>(), "Family", "F", string.Empty, GH_ParamAccess.item)].Optional = true;
            manager[manager.AddTextParameter("Name", "N", "Wall Type name", GH_ParamAccess.item)].Optional = true;
            manager[manager.AddParameter(new Parameters.Param_Enum <Types.WallFunction>(), "Function", "F", string.Empty, GH_ParamAccess.item)].Optional = true;
            manager[manager.AddIntervalParameter("Width", "W", string.Empty, GH_ParamAccess.item)].Optional = true;
            manager[manager.AddParameter(new Parameters.ElementFilter(), "Filter", "F", "Filter", GH_ParamAccess.item)].Optional = true;
        }
Esempio n. 6
0
 protected override void RegisterInputParams(GH_InputParamManager pManager)
 {
     pManager.AddMeshParameter("Mesh", "Mesh", "Mesh", GH_ParamAccess.item);
     pManager.AddIntegerParameter("CurvatureType", "CurvatureType", "0 = Min, 1 = Max, 2 = Gaussian, 3 = Mean, 4 = Absolute, 5 = Difference, 6 = Rms  ", GH_ParamAccess.item, 3);
     //pManager.AddBooleanParameter("Ring / Sphere", "Ring / Sphere", "Ring = true, Sphere = false", GH_ParamAccess.item, true);
     pManager.AddNumberParameter(" Radius", " Radius", " Radius", GH_ParamAccess.item, 2);
     pManager.AddIntegerParameter("Method", "Method", "0 = Quadratic fitting 3 coefficients, 1 = Quadratic fitting 4 coefficients, 2 = Quadratic fitting 6 coefficients, 3 = Cubic fitting 7 coefficients ", GH_ParamAccess.item, 1);
     //pManager.AddBooleanParameter("Static", "Static", "Static", GH_ParamAccess.item, false);
     pManager.AddIntervalParameter("Interval", "Interval", "Interval", GH_ParamAccess.item, new Interval(0, 0));
     pManager.AddColourParameter("3Colors", "3Colors", "3 colors", GH_ParamAccess.list);
     pManager.AddBooleanParameter("On", "On", "On", GH_ParamAccess.item, true);
     pManager[0].Optional = true;
     pManager[4].Optional = true;
     pManager[5].Optional = true;
     pManager[6].Optional = true;
 }
Esempio n. 7
0
 protected override void RegisterInputParams(GH_InputParamManager pManager)
 {
     pManager.AddNumberParameter("Values", "V", "Input values", (GH_ParamAccess)1);
     pManager.AddIntervalParameter("Source", "S", "Source domain", (GH_ParamAccess)0, new Interval(0.0, 1.0));
     pManager.AddIntervalParameter("Target", "T", "Target domain", (GH_ParamAccess)0, new Interval(0.0, 1.0));
 }
        // :(
        //// This object MUST be static??
        //static Dictionary<Type, Func<GH_InputParamManager, MACHINA_InputParameProps, int>> AddParameterFunctionMap =
        //    new Dictionary<Type, Func<GH_InputParamManager, MACHINA_InputParameProps, int>>()
        //{
        //    //{ typeof (),                        (pm, p) => pm.AddAngleParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Arc),               (pm, p) => pm.AddArcParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Boolean),           (pm, p) => pm.AddBooleanParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Box),               (pm, p) => pm.AddBoxParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Brep),              (pm, p) => pm.AddBrepParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Circle),            (pm, p) => pm.AddCircleParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Colour),            (pm, p) => pm.AddColourParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Complex),           (pm, p) => pm.AddComplexNumberParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Culture),           (pm, p) => pm.AddCultureParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Curve),             (pm, p) => pm.AddCurveParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Field),             (pm, p) => pm.AddFieldParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_GenericObject),     (pm, p) => pm.AddGenericParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Geometry),          (pm, p) => pm.AddGeometryParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Group),             (pm, p) => pm.AddGroupParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Integer),           (pm, p) => pm.AddIntegerParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Interval2D),        (pm, p) => pm.AddInterval2DParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Interval),          (pm, p) => pm.AddIntervalParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Line),              (pm, p) => pm.AddLineParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Matrix),            (pm, p) => pm.AddMatrixParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_MeshFace),          (pm, p) => pm.AddMeshFaceParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Mesh),              (pm, p) => pm.AddMeshParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Number),            (pm, p) => pm.AddNumberParameter(p.name, p.nickname, p.description, p.access) },
        //    //{ typeof (),                        (pm, p) => pm.AddParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_FilePath),          (pm, p) => pm.AddPathParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Plane),             (pm, p) => pm.AddPlaneParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Point),             (pm, p) => pm.AddPointParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Rectangle),         (pm, p) => pm.AddRectangleParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_ScriptVariable),    (pm, p) => pm.AddScriptVariableParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Surface),           (pm, p) => pm.AddSurfaceParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_String),            (pm, p) => pm.AddTextParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Time),              (pm, p) => pm.AddTimeParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Transform),         (pm, p) => pm.AddTransformParameter(p.name, p.nickname, p.description, p.access) },
        //    { typeof (Param_Vector),            (pm, p) => pm.AddVectorParameter(p.name, p.nickname, p.description, p.access) }
        //};

        //// Wanted to do this programmatically with a dictionary of delegates, but couldn't really make it work... :(
        //AddParameterFunctionMap[input.dataType](pManager, input);
        protected void RegisterTypedParam(GH_InputParamManager pManager, GH_InputParamProps p, int index)
        {
            // I am so embarrased about having to do this... urgh X(
            if (p.defaultValue == null)
            {
                try
                {
                    // Sorted by popularity order, estimated by my guts
                    if (p.dataType == typeof(Param_Number))
                    {
                        pManager.AddNumberParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Plane))
                    {
                        pManager.AddPlaneParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Point))
                    {
                        pManager.AddPointParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Vector))
                    {
                        pManager.AddVectorParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_String))
                    {
                        pManager.AddTextParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Boolean))
                    {
                        pManager.AddBooleanParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_GenericObject))
                    {
                        pManager.AddGenericParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Integer))
                    {
                        pManager.AddIntegerParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_FilePath))
                    {
                        pManager.AddPathParameter(p.name, p.nickname, p.description, p.access);
                    }

                    // I don't think Machina uses any of these so far...
                    else if (p.dataType == typeof(Param_Arc))
                    {
                        pManager.AddArcParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Box))
                    {
                        pManager.AddBoxParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Brep))
                    {
                        pManager.AddBrepParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Circle))
                    {
                        pManager.AddCircleParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Colour))
                    {
                        pManager.AddColourParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Complex))
                    {
                        pManager.AddComplexNumberParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Culture))
                    {
                        pManager.AddCultureParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Curve))
                    {
                        pManager.AddCurveParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Field))
                    {
                        pManager.AddFieldParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Geometry))
                    {
                        pManager.AddGeometryParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Group))
                    {
                        pManager.AddGroupParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Interval2D))
                    {
                        pManager.AddInterval2DParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Interval))
                    {
                        pManager.AddIntervalParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Line))
                    {
                        pManager.AddLineParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Matrix))
                    {
                        pManager.AddMatrixParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_MeshFace))
                    {
                        pManager.AddMeshFaceParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Mesh))
                    {
                        pManager.AddMeshParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Rectangle))
                    {
                        pManager.AddRectangleParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_ScriptVariable))
                    {
                        pManager.AddScriptVariableParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Surface))
                    {
                        pManager.AddSurfaceParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Time))
                    {
                        pManager.AddTimeParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Transform))
                    {
                        pManager.AddTransformParameter(p.name, p.nickname, p.description, p.access);
                    }

                    else
                    {
                        this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Cannot register parameter of type " + p.dataType);
                    }
                }
                catch
                {
                    this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Something went wrong registering input parameter {p.dataType}");
                }
            }
            else
            {
                try
                {
                    // Sorted by popularity order, estimated by my guts
                    if (p.dataType == typeof(Param_Number))
                    {
                        pManager.AddNumberParameter(p.name, p.nickname, p.description, p.access, (double)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Plane))
                    {
                        pManager.AddPlaneParameter(p.name, p.nickname, p.description, p.access, (Plane)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Point))
                    {
                        pManager.AddPointParameter(p.name, p.nickname, p.description, p.access, (Point3d)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Vector))
                    {
                        pManager.AddVectorParameter(p.name, p.nickname, p.description, p.access, (Vector3d)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_String))
                    {
                        pManager.AddTextParameter(p.name, p.nickname, p.description, p.access, (string)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Boolean))
                    {
                        pManager.AddBooleanParameter(p.name, p.nickname, p.description, p.access, (bool)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_GenericObject))
                    {
                        pManager.AddGenericParameter(p.name, p.nickname, p.description, p.access);                                                  // generic objects don't accept default values...
                    }
                    else if (p.dataType == typeof(Param_Integer))
                    {
                        pManager.AddIntegerParameter(p.name, p.nickname, p.description, p.access, (int)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_FilePath))
                    {
                        pManager.AddPathParameter(p.name, p.nickname, p.description, p.access);                                             // no def value accepted
                    }
                    // I don't think Machina uses any of these so far...
                    else if (p.dataType == typeof(Param_Arc))
                    {
                        pManager.AddArcParameter(p.name, p.nickname, p.description, p.access, (Arc)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Box))
                    {
                        pManager.AddBoxParameter(p.name, p.nickname, p.description, p.access, (Box)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Brep))
                    {
                        pManager.AddBrepParameter(p.name, p.nickname, p.description, p.access);                                         // no def value accepted
                    }
                    else if (p.dataType == typeof(Param_Circle))
                    {
                        pManager.AddCircleParameter(p.name, p.nickname, p.description, p.access, (Circle)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Colour))
                    {
                        pManager.AddColourParameter(p.name, p.nickname, p.description, p.access, (Color)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Complex))
                    {
                        pManager.AddComplexNumberParameter(p.name, p.nickname, p.description, p.access, (GH_ComplexNumber)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Culture))
                    {
                        pManager.AddCultureParameter(p.name, p.nickname, p.description, p.access, (CultureInfo)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Curve))
                    {
                        pManager.AddCurveParameter(p.name, p.nickname, p.description, p.access);                                          // no def value
                    }
                    else if (p.dataType == typeof(Param_Field))
                    {
                        pManager.AddFieldParameter(p.name, p.nickname, p.description, p.access);                                          // no def val
                    }
                    else if (p.dataType == typeof(Param_Geometry))
                    {
                        pManager.AddGeometryParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Group))
                    {
                        pManager.AddGroupParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Interval2D))
                    {
                        pManager.AddInterval2DParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Interval))
                    {
                        pManager.AddIntervalParameter(p.name, p.nickname, p.description, p.access, (Interval)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Line))
                    {
                        pManager.AddLineParameter(p.name, p.nickname, p.description, p.access, (Line)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Matrix))
                    {
                        pManager.AddMatrixParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_MeshFace))
                    {
                        pManager.AddMeshFaceParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Mesh))
                    {
                        pManager.AddMeshParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Rectangle))
                    {
                        pManager.AddRectangleParameter(p.name, p.nickname, p.description, p.access, (Rectangle3d)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_ScriptVariable))
                    {
                        pManager.AddScriptVariableParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Surface))
                    {
                        pManager.AddSurfaceParameter(p.name, p.nickname, p.description, p.access);
                    }
                    else if (p.dataType == typeof(Param_Time))
                    {
                        pManager.AddTimeParameter(p.name, p.nickname, p.description, p.access, (DateTime)p.defaultValue);
                    }
                    else if (p.dataType == typeof(Param_Transform))
                    {
                        pManager.AddTransformParameter(p.name, p.nickname, p.description, p.access);
                    }

                    else
                    {
                        this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Cannot register parameter of type " + p.dataType);
                    }
                }
                catch
                {
                    this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Something went wrong registering input parameter {p.dataType} with value {p.defaultValue}");
                }
            }

            // If this last input is optional, flag it
            if (p.optional)
            {
                pManager[index].Optional = true;
            }
        }