private int runCount;                                   //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        List <double> Density = null;

        if (inputs[0] != null)
        {
            Density = GH_DirtyCaster.CastToList <double>(inputs[0]);
        }
        double RemapIndex = default(double);

        if (inputs[1] != null)
        {
            RemapIndex = (double)(inputs[1]);
        }



        //3. Declare output parameters
        object FAR = null;


        //4. Invoke RunScript
        RunScript(Density, RemapIndex, ref FAR);

        try
        {
            //5. Assign output parameters to component...
            if (FAR != null)
            {
                if (GH_Format.TreatAsCollection(FAR))
                {
                    IEnumerable __enum_FAR = (IEnumerable)(FAR);
                    DA.SetDataList(1, __enum_FAR);
                }
                else
                {
                    if (FAR is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(FAR));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(1, FAR);
                    }
                }
            }
            else
            {
                DA.SetData(1, null);
            }
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }
Beispiel #2
0
    private int runCount;                              //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        bool store = default(bool);

        if (inputs[0] != null)
        {
            store = (bool)(inputs[0]);
        }

        string path = default(string);

        if (inputs[1] != null)
        {
            path = (string)(inputs[1]);
        }

        List <int> NumSliders = null;

        if (inputs[2] != null)
        {
            NumSliders = GH_DirtyCaster.CastToList <int>(inputs[2]);
        }
        List <int> SliderVals = null;

        if (inputs[3] != null)
        {
            SliderVals = GH_DirtyCaster.CastToList <int>(inputs[3]);
        }
        int NumPoints = default(int);

        if (inputs[4] != null)
        {
            NumPoints = (int)(inputs[4]);
        }

        List <Point3d> Points = null;

        if (inputs[5] != null)
        {
            Points = GH_DirtyCaster.CastToList <Point3d>(inputs[5]);
        }


        //3. Declare output parameters


        //4. Invoke RunScript
        RunScript(store, path, NumSliders, SliderVals, NumPoints, Points);

        try
        {
            //5. Assign output parameters to component...
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }
    private int runCount;                              //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        int n = default(int);

        if (inputs[0] != null)
        {
            n = (int)(inputs[0]);
        }

        List <string> S = null;

        if (inputs[1] != null)
        {
            S = GH_DirtyCaster.CastToList <string>(inputs[1]);
        }


        //3. Declare output parameters
        object A = null;
        object B = null;
        object C = null;
        object D = null;
        object E = null;
        object F = null;


        //4. Invoke RunScript
        RunScript(n, S, ref A, ref B, ref C, ref D, ref E, ref F);

        try
        {
            //5. Assign output parameters to component...
            if (A != null)
            {
                if (GH_Format.TreatAsCollection(A))
                {
                    IEnumerable __enum_A = (IEnumerable)(A);
                    DA.SetDataList(1, __enum_A);
                }
                else
                {
                    if (A is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(A));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(1, A);
                    }
                }
            }
            else
            {
                DA.SetData(1, null);
            }
            if (B != null)
            {
                if (GH_Format.TreatAsCollection(B))
                {
                    IEnumerable __enum_B = (IEnumerable)(B);
                    DA.SetDataList(2, __enum_B);
                }
                else
                {
                    if (B is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(2, (Grasshopper.Kernel.Data.IGH_DataTree)(B));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(2, B);
                    }
                }
            }
            else
            {
                DA.SetData(2, null);
            }
            if (C != null)
            {
                if (GH_Format.TreatAsCollection(C))
                {
                    IEnumerable __enum_C = (IEnumerable)(C);
                    DA.SetDataList(3, __enum_C);
                }
                else
                {
                    if (C is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(3, (Grasshopper.Kernel.Data.IGH_DataTree)(C));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(3, C);
                    }
                }
            }
            else
            {
                DA.SetData(3, null);
            }
            if (D != null)
            {
                if (GH_Format.TreatAsCollection(D))
                {
                    IEnumerable __enum_D = (IEnumerable)(D);
                    DA.SetDataList(4, __enum_D);
                }
                else
                {
                    if (D is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(4, (Grasshopper.Kernel.Data.IGH_DataTree)(D));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(4, D);
                    }
                }
            }
            else
            {
                DA.SetData(4, null);
            }
            if (E != null)
            {
                if (GH_Format.TreatAsCollection(E))
                {
                    IEnumerable __enum_E = (IEnumerable)(E);
                    DA.SetDataList(5, __enum_E);
                }
                else
                {
                    if (E is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(5, (Grasshopper.Kernel.Data.IGH_DataTree)(E));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(5, E);
                    }
                }
            }
            else
            {
                DA.SetData(5, null);
            }
            if (F != null)
            {
                if (GH_Format.TreatAsCollection(F))
                {
                    IEnumerable __enum_F = (IEnumerable)(F);
                    DA.SetDataList(6, __enum_F);
                }
                else
                {
                    if (F is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(6, (Grasshopper.Kernel.Data.IGH_DataTree)(F));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(6, F);
                    }
                }
            }
            else
            {
                DA.SetData(6, null);
            }
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }
Beispiel #4
0
    private int runCount;                              //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        List <Point3d> P = null;

        if (inputs[0] != null)
        {
            P = GH_DirtyCaster.CastToList <Point3d>(inputs[0]);
        }
        List <Vector3d> V = null;

        if (inputs[1] != null)
        {
            V = GH_DirtyCaster.CastToList <Vector3d>(inputs[1]);
        }
        List <Vector3d> vF = null;

        if (inputs[2] != null)
        {
            vF = GH_DirtyCaster.CastToList <Vector3d>(inputs[2]);
        }
        double pR = default(double);

        if (inputs[3] != null)
        {
            pR = (double)(inputs[3]);
        }

        double cI = default(double);

        if (inputs[4] != null)
        {
            cI = (double)(inputs[4]);
        }

        double aI = default(double);

        if (inputs[5] != null)
        {
            aI = (double)(inputs[5]);
        }

        double sI = default(double);

        if (inputs[6] != null)
        {
            sI = (double)(inputs[6]);
        }

        object fI = default(object);

        if (inputs[7] != null)
        {
            fI = (object)(inputs[7]);
        }

        double mF = default(double);

        if (inputs[8] != null)
        {
            mF = (double)(inputs[8]);
        }



        //3. Declare output parameters
        object Planes = null;


        //4. Invoke RunScript
        RunScript(P, V, vF, pR, cI, aI, sI, fI, mF, ref Planes);

        try
        {
            //5. Assign output parameters to component...
            if (Planes != null)
            {
                if (GH_Format.TreatAsCollection(Planes))
                {
                    IEnumerable __enum_Planes = (IEnumerable)(Planes);
                    DA.SetDataList(1, __enum_Planes);
                }
                else
                {
                    if (Planes is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(Planes));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(1, Planes);
                    }
                }
            }
            else
            {
                DA.SetData(1, null);
            }
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }
Beispiel #5
0
    private int runCount;                              //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        bool reset = default(bool);

        if (inputs[0] != null)
        {
            reset = (bool)(inputs[0]);
        }

        bool go = default(bool);

        if (inputs[1] != null)
        {
            go = (bool)(inputs[1]);
        }

        List <Point3d> P = null;

        if (inputs[2] != null)
        {
            P = GH_DirtyCaster.CastToList <Point3d>(inputs[2]);
        }
        List <Vector3d> V = null;

        if (inputs[3] != null)
        {
            V = GH_DirtyCaster.CastToList <Vector3d>(inputs[3]);
        }
        double nR = default(double);

        if (inputs[4] != null)
        {
            nR = (double)(inputs[4]);
        }

        double coS = default(double);

        if (inputs[5] != null)
        {
            coS = (double)(inputs[5]);
        }

        double alS = default(double);

        if (inputs[6] != null)
        {
            alS = (double)(inputs[6]);
        }

        double seS = default(double);

        if (inputs[7] != null)
        {
            seS = (double)(inputs[7]);
        }

        double seR = default(double);

        if (inputs[8] != null)
        {
            seR = (double)(inputs[8]);
        }



        //3. Declare output parameters
        object Ap = null;
        object Av = null;


        //4. Invoke RunScript
        RunScript(reset, go, P, V, nR, coS, alS, seS, seR, ref Ap, ref Av);

        try
        {
            //5. Assign output parameters to component...
            if (Ap != null)
            {
                if (GH_Format.TreatAsCollection(Ap))
                {
                    IEnumerable __enum_Ap = (IEnumerable)(Ap);
                    DA.SetDataList(1, __enum_Ap);
                }
                else
                {
                    if (Ap is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(Ap));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(1, Ap);
                    }
                }
            }
            else
            {
                DA.SetData(1, null);
            }
            if (Av != null)
            {
                if (GH_Format.TreatAsCollection(Av))
                {
                    IEnumerable __enum_Av = (IEnumerable)(Av);
                    DA.SetDataList(2, __enum_Av);
                }
                else
                {
                    if (Av is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(2, (Grasshopper.Kernel.Data.IGH_DataTree)(Av));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(2, Av);
                    }
                }
            }
            else
            {
                DA.SetData(2, null);
            }
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }
    private int runCount;                              //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        List <Point3d> P = null;

        if (inputs[0] != null)
        {
            P = GH_DirtyCaster.CastToList <Point3d>(inputs[0]);
        }
        Mesh M = default(Mesh);

        if (inputs[1] != null)
        {
            M = (Mesh)(inputs[1]);
        }

        double step = default(double);

        if (inputs[2] != null)
        {
            step = (double)(inputs[2]);
        }

        bool reset = default(bool);

        if (inputs[3] != null)
        {
            reset = (bool)(inputs[3]);
        }

        bool go = default(bool);

        if (inputs[4] != null)
        {
            go = (bool)(inputs[4]);
        }



        //3. Declare output parameters
        object Pos    = null;
        object status = null;
        object Trails = null;


        //4. Invoke RunScript
        RunScript(P, M, step, reset, go, ref Pos, ref status, ref Trails);

        try
        {
            //5. Assign output parameters to component...
            if (Pos != null)
            {
                if (GH_Format.TreatAsCollection(Pos))
                {
                    IEnumerable __enum_Pos = (IEnumerable)(Pos);
                    DA.SetDataList(1, __enum_Pos);
                }
                else
                {
                    if (Pos is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(Pos));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(1, Pos);
                    }
                }
            }
            else
            {
                DA.SetData(1, null);
            }
            if (status != null)
            {
                if (GH_Format.TreatAsCollection(status))
                {
                    IEnumerable __enum_status = (IEnumerable)(status);
                    DA.SetDataList(2, __enum_status);
                }
                else
                {
                    if (status is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(2, (Grasshopper.Kernel.Data.IGH_DataTree)(status));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(2, status);
                    }
                }
            }
            else
            {
                DA.SetData(2, null);
            }
            if (Trails != null)
            {
                if (GH_Format.TreatAsCollection(Trails))
                {
                    IEnumerable __enum_Trails = (IEnumerable)(Trails);
                    DA.SetDataList(3, __enum_Trails);
                }
                else
                {
                    if (Trails is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(3, (Grasshopper.Kernel.Data.IGH_DataTree)(Trails));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(3, Trails);
                    }
                }
            }
            else
            {
                DA.SetData(3, null);
            }
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }
    private int runCount;                                   //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        Brep Bnd = default(Brep);

        if (inputs[0] != null)
        {
            Bnd = (Brep)(inputs[0]);
        }

        List <Curve> RdA = null;

        if (inputs[1] != null)
        {
            RdA = GH_DirtyCaster.CastToList <Curve>(inputs[1]);
        }
        int Crt1 = default(int);

        if (inputs[2] != null)
        {
            Crt1 = (int)(inputs[2]);
        }

        double AmpC1 = default(double);

        if (inputs[3] != null)
        {
            AmpC1 = (double)(inputs[3]);
        }

        int Dist1 = default(int);

        if (inputs[4] != null)
        {
            Dist1 = (int)(inputs[4]);
        }

        int Crt2 = default(int);

        if (inputs[5] != null)
        {
            Crt2 = (int)(inputs[5]);
        }

        double AmpC2 = default(double);

        if (inputs[6] != null)
        {
            AmpC2 = (double)(inputs[6]);
        }

        int Dist2 = default(int);

        if (inputs[7] != null)
        {
            Dist2 = (int)(inputs[7]);
        }

        double RndPara = default(double);

        if (inputs[8] != null)
        {
            RndPara = (double)(inputs[8]);
        }

        int CtnRng1 = default(int);

        if (inputs[9] != null)
        {
            CtnRng1 = (int)(inputs[9]);
        }

        int CtnRng2 = default(int);

        if (inputs[10] != null)
        {
            CtnRng2 = (int)(inputs[10]);
        }

        int LenRat = default(int);

        if (inputs[11] != null)
        {
            LenRat = (int)(inputs[11]);
        }

        int Sd = default(int);

        if (inputs[12] != null)
        {
            Sd = (int)(inputs[12]);
        }



        //3. Declare output parameters
        object BLOCKS = null;
        object RDA    = null;
        object RDB    = null;
        object RDC    = null;


        //4. Invoke RunScript
        RunScript(Bnd, RdA, Crt1, AmpC1, Dist1, Crt2, AmpC2, Dist2, RndPara, CtnRng1, CtnRng2, LenRat, Sd, ref BLOCKS, ref RDA, ref RDB, ref RDC);

        try
        {
            //5. Assign output parameters to component...
            if (BLOCKS != null)
            {
                if (GH_Format.TreatAsCollection(BLOCKS))
                {
                    IEnumerable __enum_BLOCKS = (IEnumerable)(BLOCKS);
                    DA.SetDataList(1, __enum_BLOCKS);
                }
                else
                {
                    if (BLOCKS is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(BLOCKS));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(1, BLOCKS);
                    }
                }
            }
            else
            {
                DA.SetData(1, null);
            }
            if (RDA != null)
            {
                if (GH_Format.TreatAsCollection(RDA))
                {
                    IEnumerable __enum_RDA = (IEnumerable)(RDA);
                    DA.SetDataList(2, __enum_RDA);
                }
                else
                {
                    if (RDA is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(2, (Grasshopper.Kernel.Data.IGH_DataTree)(RDA));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(2, RDA);
                    }
                }
            }
            else
            {
                DA.SetData(2, null);
            }
            if (RDB != null)
            {
                if (GH_Format.TreatAsCollection(RDB))
                {
                    IEnumerable __enum_RDB = (IEnumerable)(RDB);
                    DA.SetDataList(3, __enum_RDB);
                }
                else
                {
                    if (RDB is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(3, (Grasshopper.Kernel.Data.IGH_DataTree)(RDB));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(3, RDB);
                    }
                }
            }
            else
            {
                DA.SetData(3, null);
            }
            if (RDC != null)
            {
                if (GH_Format.TreatAsCollection(RDC))
                {
                    IEnumerable __enum_RDC = (IEnumerable)(RDC);
                    DA.SetDataList(4, __enum_RDC);
                }
                else
                {
                    if (RDC is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(4, (Grasshopper.Kernel.Data.IGH_DataTree)(RDC));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(4, RDC);
                    }
                }
            }
            else
            {
                DA.SetData(4, null);
            }
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }
Beispiel #8
0
    private int runCount;                              //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        List <Line> lines_in = null;

        if (inputs[0] != null)
        {
            lines_in = GH_DirtyCaster.CastToList <Line>(inputs[0]);
        }
        double tolerance = default(double);

        if (inputs[1] != null)
        {
            tolerance = (double)(inputs[1]);
        }

        double width = default(double);

        if (inputs[2] != null)
        {
            width = (double)(inputs[2]);
        }

        double deviation = default(double);

        if (inputs[3] != null)
        {
            deviation = (double)(inputs[3]);
        }

        double angle = default(double);

        if (inputs[4] != null)
        {
            angle = (double)(inputs[4]);
        }

        int n_u = default(int);

        if (inputs[5] != null)
        {
            n_u = (int)(inputs[5]);
        }

        int n_v = default(int);

        if (inputs[6] != null)
        {
            n_v = (int)(inputs[6]);
        }

        bool zbool = default(bool);

        if (inputs[7] != null)
        {
            zbool = (bool)(inputs[7]);
        }



        //3. Declare output parameters
        object P       = null;
        object LP      = null;
        object PP      = null;
        object PL      = null;
        object lines   = null;
        object ends    = null;
        object connect = null;
        object brep    = null;
        object M       = null;
        object F       = null;
        object U       = null;
        object V       = null;


        //4. Invoke RunScript
        RunScript(lines_in, tolerance, width, deviation, angle, n_u, n_v, zbool, ref P, ref LP, ref PP, ref PL, ref lines, ref ends, ref connect, ref brep, ref M, ref F, ref U, ref V);

        try
        {
            //5. Assign output parameters to component...
            if (P != null)
            {
                if (GH_Format.TreatAsCollection(P))
                {
                    IEnumerable __enum_P = (IEnumerable)(P);
                    DA.SetDataList(1, __enum_P);
                }
                else
                {
                    if (P is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(P));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(1, P);
                    }
                }
            }
            else
            {
                DA.SetData(1, null);
            }
            if (LP != null)
            {
                if (GH_Format.TreatAsCollection(LP))
                {
                    IEnumerable __enum_LP = (IEnumerable)(LP);
                    DA.SetDataList(2, __enum_LP);
                }
                else
                {
                    if (LP is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(2, (Grasshopper.Kernel.Data.IGH_DataTree)(LP));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(2, LP);
                    }
                }
            }
            else
            {
                DA.SetData(2, null);
            }
            if (PP != null)
            {
                if (GH_Format.TreatAsCollection(PP))
                {
                    IEnumerable __enum_PP = (IEnumerable)(PP);
                    DA.SetDataList(3, __enum_PP);
                }
                else
                {
                    if (PP is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(3, (Grasshopper.Kernel.Data.IGH_DataTree)(PP));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(3, PP);
                    }
                }
            }
            else
            {
                DA.SetData(3, null);
            }
            if (PL != null)
            {
                if (GH_Format.TreatAsCollection(PL))
                {
                    IEnumerable __enum_PL = (IEnumerable)(PL);
                    DA.SetDataList(4, __enum_PL);
                }
                else
                {
                    if (PL is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(4, (Grasshopper.Kernel.Data.IGH_DataTree)(PL));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(4, PL);
                    }
                }
            }
            else
            {
                DA.SetData(4, null);
            }
            if (lines != null)
            {
                if (GH_Format.TreatAsCollection(lines))
                {
                    IEnumerable __enum_lines = (IEnumerable)(lines);
                    DA.SetDataList(5, __enum_lines);
                }
                else
                {
                    if (lines is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(5, (Grasshopper.Kernel.Data.IGH_DataTree)(lines));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(5, lines);
                    }
                }
            }
            else
            {
                DA.SetData(5, null);
            }
            if (ends != null)
            {
                if (GH_Format.TreatAsCollection(ends))
                {
                    IEnumerable __enum_ends = (IEnumerable)(ends);
                    DA.SetDataList(6, __enum_ends);
                }
                else
                {
                    if (ends is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(6, (Grasshopper.Kernel.Data.IGH_DataTree)(ends));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(6, ends);
                    }
                }
            }
            else
            {
                DA.SetData(6, null);
            }
            if (connect != null)
            {
                if (GH_Format.TreatAsCollection(connect))
                {
                    IEnumerable __enum_connect = (IEnumerable)(connect);
                    DA.SetDataList(7, __enum_connect);
                }
                else
                {
                    if (connect is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(7, (Grasshopper.Kernel.Data.IGH_DataTree)(connect));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(7, connect);
                    }
                }
            }
            else
            {
                DA.SetData(7, null);
            }
            if (brep != null)
            {
                if (GH_Format.TreatAsCollection(brep))
                {
                    IEnumerable __enum_brep = (IEnumerable)(brep);
                    DA.SetDataList(8, __enum_brep);
                }
                else
                {
                    if (brep is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(8, (Grasshopper.Kernel.Data.IGH_DataTree)(brep));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(8, brep);
                    }
                }
            }
            else
            {
                DA.SetData(8, null);
            }
            if (M != null)
            {
                if (GH_Format.TreatAsCollection(M))
                {
                    IEnumerable __enum_M = (IEnumerable)(M);
                    DA.SetDataList(9, __enum_M);
                }
                else
                {
                    if (M is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(9, (Grasshopper.Kernel.Data.IGH_DataTree)(M));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(9, M);
                    }
                }
            }
            else
            {
                DA.SetData(9, null);
            }
            if (F != null)
            {
                if (GH_Format.TreatAsCollection(F))
                {
                    IEnumerable __enum_F = (IEnumerable)(F);
                    DA.SetDataList(10, __enum_F);
                }
                else
                {
                    if (F is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(10, (Grasshopper.Kernel.Data.IGH_DataTree)(F));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(10, F);
                    }
                }
            }
            else
            {
                DA.SetData(10, null);
            }
            if (U != null)
            {
                if (GH_Format.TreatAsCollection(U))
                {
                    IEnumerable __enum_U = (IEnumerable)(U);
                    DA.SetDataList(11, __enum_U);
                }
                else
                {
                    if (U is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(11, (Grasshopper.Kernel.Data.IGH_DataTree)(U));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(11, U);
                    }
                }
            }
            else
            {
                DA.SetData(11, null);
            }
            if (V != null)
            {
                if (GH_Format.TreatAsCollection(V))
                {
                    IEnumerable __enum_V = (IEnumerable)(V);
                    DA.SetDataList(12, __enum_V);
                }
                else
                {
                    if (V is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(12, (Grasshopper.Kernel.Data.IGH_DataTree)(V));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(12, V);
                    }
                }
            }
            else
            {
                DA.SetData(12, null);
            }
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }
  private int runCount;                            //Legacy field.
  
  public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List<object> inputs, IGH_DataAccess DA)
  {
    //Prepare for a new run...
    //1. Reset lists
    this.__out.Clear();
    this.__err.Clear();

    this.Component = owner;
    this.Iteration = iteration;
    this.GrasshopperDocument = owner.OnPingDocument();
    this.RhinoDocument = rhinoDocument as Rhino.RhinoDoc;

    this.owner = this.Component;
    this.runCount = this.Iteration;
    this. doc = this.RhinoDocument;

    //2. Assign input parameters
        List<Point3d> P = null;
    if (inputs[0] != null)
    {
      P = GH_DirtyCaster.CastToList<Point3d>(inputs[0]);
    }
    int deg = default(int);
    if (inputs[1] != null)
    {
      deg = (int)(inputs[1]);
    }

    bool periodic = default(bool);
    if (inputs[2] != null)
    {
      periodic = (bool)(inputs[2]);
    }



    //3. Declare output parameters
      object Pl = null;
  object C = null;


    //4. Invoke RunScript
    RunScript(P, deg, periodic, ref Pl, ref C);
      
    try
    {
      //5. Assign output parameters to component...
            if (Pl != null)
      {
        if (GH_Format.TreatAsCollection(Pl))
        {
          IEnumerable __enum_Pl = (IEnumerable)(Pl);
          DA.SetDataList(1, __enum_Pl);
        }
        else
        {
          if (Pl is Grasshopper.Kernel.Data.IGH_DataTree)
          {
            //merge tree
            DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(Pl));
          }
          else
          {
            //assign direct
            DA.SetData(1, Pl);
          }
        }
      }
      else
      {
        DA.SetData(1, null);
      }
      if (C != null)
      {
        if (GH_Format.TreatAsCollection(C))
        {
          IEnumerable __enum_C = (IEnumerable)(C);
          DA.SetDataList(2, __enum_C);
        }
        else
        {
          if (C is Grasshopper.Kernel.Data.IGH_DataTree)
          {
            //merge tree
            DA.SetDataTree(2, (Grasshopper.Kernel.Data.IGH_DataTree)(C));
          }
          else
          {
            //assign direct
            DA.SetData(2, C);
          }
        }
      }
      else
      {
        DA.SetData(2, null);
      }

    }
    catch (Exception ex)
    {
      this.__err.Add(string.Format("Script exception: {0}", ex.Message));
    }
    finally
    {
      //Add errors and messages... 
      if (owner.Params.Output.Count > 0)
      {
        if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
        {
          List<string> __errors_plus_messages = new List<string>();
          if (this.__err != null) { __errors_plus_messages.AddRange(this.__err); }
          if (this.__out != null) { __errors_plus_messages.AddRange(this.__out); }
          if (__errors_plus_messages.Count > 0) 
            DA.SetDataList(0, __errors_plus_messages);
        }
      }
    }
  }
    private int runCount;                              //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        List <object> Goals = null;

        if (inputs[0] != null)
        {
            Goals = GH_DirtyCaster.CastToList <object>(inputs[0]);
        }
        bool Reset = default(bool);

        if (inputs[1] != null)
        {
            Reset = (bool)(inputs[1]);
        }

        bool Step = default(bool);

        if (inputs[2] != null)
        {
            Step = (bool)(inputs[2]);
        }



        //3. Declare output parameters
        object A = null;
        object B = null;


        //4. Invoke RunScript
        RunScript(Goals, Reset, Step, ref A, ref B);

        try
        {
            //5. Assign output parameters to component...
            if (A != null)
            {
                if (GH_Format.TreatAsCollection(A))
                {
                    IEnumerable __enum_A = (IEnumerable)(A);
                    DA.SetDataList(1, __enum_A);
                }
                else
                {
                    if (A is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(A));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(1, A);
                    }
                }
            }
            else
            {
                DA.SetData(1, null);
            }
            if (B != null)
            {
                if (GH_Format.TreatAsCollection(B))
                {
                    IEnumerable __enum_B = (IEnumerable)(B);
                    DA.SetDataList(2, __enum_B);
                }
                else
                {
                    if (B is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(2, (Grasshopper.Kernel.Data.IGH_DataTree)(B));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(2, B);
                    }
                }
            }
            else
            {
                DA.SetData(2, null);
            }
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }
Beispiel #11
0
    private int runCount;                                   //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        List <Brep> subS = null;

        if (inputs[0] != null)
        {
            subS = GH_DirtyCaster.CastToList <Brep>(inputs[0]);
        }
        List <Line> RdA = null;

        if (inputs[1] != null)
        {
            RdA = GH_DirtyCaster.CastToList <Line>(inputs[1]);
        }
        List <Line> RdB = null;

        if (inputs[2] != null)
        {
            RdB = GH_DirtyCaster.CastToList <Line>(inputs[2]);
        }
        List <Line> RdC = null;

        if (inputs[3] != null)
        {
            RdC = GH_DirtyCaster.CastToList <Line>(inputs[3]);
        }
        List <int> ClsA = null;

        if (inputs[4] != null)
        {
            ClsA = GH_DirtyCaster.CastToList <int>(inputs[4]);
        }
        List <int> ClsB = null;

        if (inputs[5] != null)
        {
            ClsB = GH_DirtyCaster.CastToList <int>(inputs[5]);
        }
        List <int> ClsC = null;

        if (inputs[6] != null)
        {
            ClsC = GH_DirtyCaster.CastToList <int>(inputs[6]);
        }
        List <double> Wgt = null;

        if (inputs[7] != null)
        {
            Wgt = GH_DirtyCaster.CastToList <double>(inputs[7]);
        }
        List <double> HtA = null;

        if (inputs[8] != null)
        {
            HtA = GH_DirtyCaster.CastToList <double>(inputs[8]);
        }
        List <double> HtB = null;

        if (inputs[9] != null)
        {
            HtB = GH_DirtyCaster.CastToList <double>(inputs[9]);
        }
        List <double> HtC = null;

        if (inputs[10] != null)
        {
            HtC = GH_DirtyCaster.CastToList <double>(inputs[10]);
        }
        bool TrgA = default(bool);

        if (inputs[11] != null)
        {
            TrgA = (bool)(inputs[11]);
        }

        bool TrgB = default(bool);

        if (inputs[12] != null)
        {
            TrgB = (bool)(inputs[12]);
        }

        bool TrgC = default(bool);

        if (inputs[13] != null)
        {
            TrgC = (bool)(inputs[13]);
        }



        //3. Declare output parameters
        object Block   = null;
        object Density = null;


        //4. Invoke RunScript
        RunScript(subS, RdA, RdB, RdC, ClsA, ClsB, ClsC, Wgt, HtA, HtB, HtC, TrgA, TrgB, TrgC, ref Block, ref Density);

        try
        {
            //5. Assign output parameters to component...
            if (Block != null)
            {
                if (GH_Format.TreatAsCollection(Block))
                {
                    IEnumerable __enum_Block = (IEnumerable)(Block);
                    DA.SetDataList(1, __enum_Block);
                }
                else
                {
                    if (Block is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(Block));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(1, Block);
                    }
                }
            }
            else
            {
                DA.SetData(1, null);
            }
            if (Density != null)
            {
                if (GH_Format.TreatAsCollection(Density))
                {
                    IEnumerable __enum_Density = (IEnumerable)(Density);
                    DA.SetDataList(2, __enum_Density);
                }
                else
                {
                    if (Density is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(2, (Grasshopper.Kernel.Data.IGH_DataTree)(Density));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(2, Density);
                    }
                }
            }
            else
            {
                DA.SetData(2, null);
            }
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }
    private int runCount;                                   //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        List <Surface> Blocks = null;

        if (inputs[0] != null)
        {
            Blocks = GH_DirtyCaster.CastToList <Surface>(inputs[0]);
        }
        List <double> FAR = null;

        if (inputs[1] != null)
        {
            FAR = GH_DirtyCaster.CastToList <double>(inputs[1]);
        }
        double BSR1 = default(double);

        if (inputs[2] != null)
        {
            BSR1 = (double)(inputs[2]);
        }

        double BSR2 = default(double);

        if (inputs[3] != null)
        {
            BSR2 = (double)(inputs[3]);
        }

        double BSR3 = default(double);

        if (inputs[4] != null)
        {
            BSR3 = (double)(inputs[4]);
        }

        List <Curve> RdA = null;

        if (inputs[5] != null)
        {
            RdA = GH_DirtyCaster.CastToList <Curve>(inputs[5]);
        }
        List <Curve> RdB = null;

        if (inputs[6] != null)
        {
            RdB = GH_DirtyCaster.CastToList <Curve>(inputs[6]);
        }
        double TRatio = default(double);

        if (inputs[7] != null)
        {
            TRatio = (double)(inputs[7]);
        }



        //3. Declare output parameters
        object TowerP    = null;
        object TowerS    = null;
        object Outline   = null;
        object Buildings = null;
        object Yard      = null;


        //4. Invoke RunScript
        RunScript(Blocks, FAR, BSR1, BSR2, BSR3, RdA, RdB, TRatio, ref TowerP, ref TowerS, ref Outline, ref Buildings, ref Yard);

        try
        {
            //5. Assign output parameters to component...
            if (TowerP != null)
            {
                if (GH_Format.TreatAsCollection(TowerP))
                {
                    IEnumerable __enum_TowerP = (IEnumerable)(TowerP);
                    DA.SetDataList(1, __enum_TowerP);
                }
                else
                {
                    if (TowerP is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(TowerP));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(1, TowerP);
                    }
                }
            }
            else
            {
                DA.SetData(1, null);
            }
            if (TowerS != null)
            {
                if (GH_Format.TreatAsCollection(TowerS))
                {
                    IEnumerable __enum_TowerS = (IEnumerable)(TowerS);
                    DA.SetDataList(2, __enum_TowerS);
                }
                else
                {
                    if (TowerS is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(2, (Grasshopper.Kernel.Data.IGH_DataTree)(TowerS));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(2, TowerS);
                    }
                }
            }
            else
            {
                DA.SetData(2, null);
            }
            if (Outline != null)
            {
                if (GH_Format.TreatAsCollection(Outline))
                {
                    IEnumerable __enum_Outline = (IEnumerable)(Outline);
                    DA.SetDataList(3, __enum_Outline);
                }
                else
                {
                    if (Outline is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(3, (Grasshopper.Kernel.Data.IGH_DataTree)(Outline));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(3, Outline);
                    }
                }
            }
            else
            {
                DA.SetData(3, null);
            }
            if (Buildings != null)
            {
                if (GH_Format.TreatAsCollection(Buildings))
                {
                    IEnumerable __enum_Buildings = (IEnumerable)(Buildings);
                    DA.SetDataList(4, __enum_Buildings);
                }
                else
                {
                    if (Buildings is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(4, (Grasshopper.Kernel.Data.IGH_DataTree)(Buildings));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(4, Buildings);
                    }
                }
            }
            else
            {
                DA.SetData(4, null);
            }
            if (Yard != null)
            {
                if (GH_Format.TreatAsCollection(Yard))
                {
                    IEnumerable __enum_Yard = (IEnumerable)(Yard);
                    DA.SetDataList(5, __enum_Yard);
                }
                else
                {
                    if (Yard is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(5, (Grasshopper.Kernel.Data.IGH_DataTree)(Yard));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(5, Yard);
                    }
                }
            }
            else
            {
                DA.SetData(5, null);
            }
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }
    private int runCount;                                   //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        List <Brep> Blocks = null;

        if (inputs[0] != null)
        {
            Blocks = GH_DirtyCaster.CastToList <Brep>(inputs[0]);
        }
        Curve Boundary = default(Curve);

        if (inputs[1] != null)
        {
            Boundary = (Curve)(inputs[1]);
        }

        List <Line> RdA = null;

        if (inputs[2] != null)
        {
            RdA = GH_DirtyCaster.CastToList <Line>(inputs[2]);
        }
        double HalfWA = default(double);

        if (inputs[3] != null)
        {
            HalfWA = (double)(inputs[3]);
        }

        List <Line> RdB = null;

        if (inputs[4] != null)
        {
            RdB = GH_DirtyCaster.CastToList <Line>(inputs[4]);
        }
        double HalfWB = default(double);

        if (inputs[5] != null)
        {
            HalfWB = (double)(inputs[5]);
        }

        List <Line> RdC = null;

        if (inputs[6] != null)
        {
            RdC = GH_DirtyCaster.CastToList <Line>(inputs[6]);
        }
        double HalfWC = default(double);

        if (inputs[7] != null)
        {
            HalfWC = (double)(inputs[7]);
        }

        double PedOff = default(double);

        if (inputs[8] != null)
        {
            PedOff = (double)(inputs[8]);
        }



        //3. Declare output parameters
        object BuildingSetback   = null;
        object PedestrianOutline = null;


        //4. Invoke RunScript
        RunScript(Blocks, Boundary, RdA, HalfWA, RdB, HalfWB, RdC, HalfWC, PedOff, ref BuildingSetback, ref PedestrianOutline);

        try
        {
            //5. Assign output parameters to component...
            if (BuildingSetback != null)
            {
                if (GH_Format.TreatAsCollection(BuildingSetback))
                {
                    IEnumerable __enum_BuildingSetback = (IEnumerable)(BuildingSetback);
                    DA.SetDataList(1, __enum_BuildingSetback);
                }
                else
                {
                    if (BuildingSetback is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(BuildingSetback));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(1, BuildingSetback);
                    }
                }
            }
            else
            {
                DA.SetData(1, null);
            }
            if (PedestrianOutline != null)
            {
                if (GH_Format.TreatAsCollection(PedestrianOutline))
                {
                    IEnumerable __enum_PedestrianOutline = (IEnumerable)(PedestrianOutline);
                    DA.SetDataList(2, __enum_PedestrianOutline);
                }
                else
                {
                    if (PedestrianOutline is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(2, (Grasshopper.Kernel.Data.IGH_DataTree)(PedestrianOutline));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(2, PedestrianOutline);
                    }
                }
            }
            else
            {
                DA.SetData(2, null);
            }
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }
Beispiel #14
0
    private int runCount;                              //Legacy field.

    public override void InvokeRunScript(IGH_Component owner, object rhinoDocument, int iteration, List <object> inputs, IGH_DataAccess DA)
    {
        //Prepare for a new run...
        //1. Reset lists
        this.__out.Clear();
        this.__err.Clear();

        this.Component           = owner;
        this.Iteration           = iteration;
        this.GrasshopperDocument = owner.OnPingDocument();
        this.RhinoDocument       = rhinoDocument as Rhino.RhinoDoc;

        this.owner    = this.Component;
        this.runCount = this.Iteration;
        this.doc      = this.RhinoDocument;

        //2. Assign input parameters
        DataTree <Curve> cTree = null;

        if (inputs[0] != null)
        {
            cTree = GH_DirtyCaster.CastToTree <Curve>(inputs[0]);
        }

        DataTree <double> oTree = null;

        if (inputs[1] != null)
        {
            oTree = GH_DirtyCaster.CastToTree <double>(inputs[1]);
        }

        double angleThreshold = default(double);

        if (inputs[2] != null)
        {
            angleThreshold = (double)(inputs[2]);
        }



        //3. Declare output parameters
        object crvs  = null;
        object crvs2 = null;
        object pts   = null;
        object perps = null;


        //4. Invoke RunScript
        RunScript(cTree, oTree, angleThreshold, ref crvs, ref crvs2, ref pts, ref perps);

        try
        {
            //5. Assign output parameters to component...
            if (crvs != null)
            {
                if (GH_Format.TreatAsCollection(crvs))
                {
                    IEnumerable __enum_crvs = (IEnumerable)(crvs);
                    DA.SetDataList(1, __enum_crvs);
                }
                else
                {
                    if (crvs is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(1, (Grasshopper.Kernel.Data.IGH_DataTree)(crvs));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(1, crvs);
                    }
                }
            }
            else
            {
                DA.SetData(1, null);
            }
            if (crvs2 != null)
            {
                if (GH_Format.TreatAsCollection(crvs2))
                {
                    IEnumerable __enum_crvs2 = (IEnumerable)(crvs2);
                    DA.SetDataList(2, __enum_crvs2);
                }
                else
                {
                    if (crvs2 is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(2, (Grasshopper.Kernel.Data.IGH_DataTree)(crvs2));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(2, crvs2);
                    }
                }
            }
            else
            {
                DA.SetData(2, null);
            }
            if (pts != null)
            {
                if (GH_Format.TreatAsCollection(pts))
                {
                    IEnumerable __enum_pts = (IEnumerable)(pts);
                    DA.SetDataList(3, __enum_pts);
                }
                else
                {
                    if (pts is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(3, (Grasshopper.Kernel.Data.IGH_DataTree)(pts));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(3, pts);
                    }
                }
            }
            else
            {
                DA.SetData(3, null);
            }
            if (perps != null)
            {
                if (GH_Format.TreatAsCollection(perps))
                {
                    IEnumerable __enum_perps = (IEnumerable)(perps);
                    DA.SetDataList(4, __enum_perps);
                }
                else
                {
                    if (perps is Grasshopper.Kernel.Data.IGH_DataTree)
                    {
                        //merge tree
                        DA.SetDataTree(4, (Grasshopper.Kernel.Data.IGH_DataTree)(perps));
                    }
                    else
                    {
                        //assign direct
                        DA.SetData(4, perps);
                    }
                }
            }
            else
            {
                DA.SetData(4, null);
            }
        }
        catch (Exception ex)
        {
            this.__err.Add(string.Format("Script exception: {0}", ex.Message));
        }
        finally
        {
            //Add errors and messages...
            if (owner.Params.Output.Count > 0)
            {
                if (owner.Params.Output[0] is Grasshopper.Kernel.Parameters.Param_String)
                {
                    List <string> __errors_plus_messages = new List <string>();
                    if (this.__err != null)
                    {
                        __errors_plus_messages.AddRange(this.__err);
                    }
                    if (this.__out != null)
                    {
                        __errors_plus_messages.AddRange(this.__out);
                    }
                    if (__errors_plus_messages.Count > 0)
                    {
                        DA.SetDataList(0, __errors_plus_messages);
                    }
                }
            }
        }
    }