Пример #1
0
        protected override void SolveInstance(IGH_DataAccess da)
        {
            var points      = da.GetDataList <Point3d>(0);
            var identifiers = da.GetDataList <int>(1);
            var xdirs       = da.GetDataList <Vector3d>(2);
            var zdirs       = da.GetDataList <Vector3d>(3);
            var fixations   = da.GetDataList <string>(4);
            var userText    = da.GetDataList <string>(5);

            var gh_structural_points = new List <GS_StructuralPoint>();

            for (int i = 0; i < points.Count; ++i)
            {
                var p3d = points[i];

                var gp = new GS_StructuralPoint()
                {
                    Value           = new Point(p3d),
                    Id              = identifiers.GetItemOrCountUp(i),
                    DirectionLocalX = xdirs.GetItemOrLast(i),
                    DirectionLocalZ = zdirs.GetItemOrLast(i),
                    FixLiteral      = fixations.GetItemOrLast(i),
                    UserText        = userText.GetItemOrLast(i)
                };
                gh_structural_points.Add(gp);
            }

            da.SetDataList(0, gh_structural_points);
        }
Пример #2
0
        public Enum SetInput(IGH_GeometricGoo gg, bool a)
        {
            Enum res               = State.OK;
            bool isPoint           = false;
            GS_StructuralPoint spt = null;
            GS_StructuralLine  sln = null;

            if (gg is GH_Point)
            {
                spt       = new GS_StructuralPoint();
                spt.Value = new Point((gg as GH_Point).Value);
                isPoint   = true;
            }
            else if (gg is GS_StructuralPoint)
            {
                spt     = gg as GS_StructuralPoint;
                isPoint = true;
            }
            else if (gg is GH_Curve)
            {
                sln       = new GS_StructuralLine();
                sln.Value = (gg as GH_Curve).Value;
            }
            else if (gg is GH_Line)
            {
                sln       = new GS_StructuralLine();
                sln.Value = new LineCurve((gg as GH_Line).Value);
            }
            else if (gg is GH_Arc)
            {
                sln       = new GS_StructuralLine();
                sln.Value = new ArcCurve((gg as GH_Arc).Value);
            }
            else if (gg is GS_StructuralLine)
            {
                sln = gg as GS_StructuralLine;
            }
            //else
            //throw new InvalidCastException("Input param: only (structural)points/lines allowed");

            if ((spt is null) && (sln is null))
            {
                if (a)
                {
                    res = State.InvalidA;
                }
                else
                {
                    res = State.InvalidB;
                }
            }