Esempio n. 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Point3d P = new Point3d(0, 0, 0);
            double  R = 1.0;

            if (!DA.GetData(0, ref P))
            {
                return;
            }
            if (!DA.GetData(1, ref R))
            {
                return;
            }

            wPoint O   = new wPoint(P.X, P.Y, P.Z);
            wCurve Crv = new wCircle(O, R);

            wShape           Shape  = new wShape(Crv);
            wShapeCollection Shapes = new wShapeCollection(Shape);

            wPlane Pln = new wPlane().XYPlane();

            Pln.Origin = O;

            Shapes.Boundary = new wRectangle(Pln, R, R);
            Shapes.Type     = Crv.GetCurveType;

            Shapes.Graphics = new wGraphic().BlackFill();
            Shapes.Effects  = new wEffects();


            wObject WindObject = new wObject(Shapes, "Hoopoe", Shapes.Type);

            DA.SetData(0, WindObject);
        }
Esempio n. 2
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string T = "";
            Plane  P = Plane.WorldXY;

            if (!DA.GetData(0, ref T))
            {
                return;
            }
            if (!DA.GetData(1, ref P))
            {
                return;
            }

            wPlane Pln = new wPlane(new wPoint(P.Origin.X, P.Origin.Y, P.Origin.Z), new wVector(P.XAxis.X, P.XAxis.Y, P.XAxis.Z), new wVector(P.YAxis.X, P.YAxis.Y, P.YAxis.Z));

            wText       Txt    = new wText(T);
            wTextObject TxtObj = new wTextObject(Txt, Pln);

            TxtObj.Angle = (Vector3d.VectorAngle(Vector3d.YAxis, P.YAxis, Plane.WorldXY) / Math.PI * 180);

            wShape           Shape  = new wShape(TxtObj);
            wShapeCollection Shapes = new wShapeCollection(Shape);

            Shapes.Type = "Text";

            Shapes.Graphics = new wGraphic().BlackFill();
            Shapes.Effects  = new wEffects();

            wObject WindObject = new wObject(Shapes, "Hoopoe", Shapes.Type);

            DA.SetData(0, WindObject);
        }
Esempio n. 3
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo     Z = null;
            Rectangle3d R = new Rectangle3d(Plane.WorldXY, 150, 150);

            if (!DA.GetData(0, ref Z))
            {
                return;
            }
            if (!DA.GetData(0, ref R))
            {
                return;
            }

            Bitmap A = null;

            if (Z != null)
            {
                Z.CastTo(out A);
            }

            // Check if is pline
            Curve C = R.ToNurbsCurve();

            BoundingBox B = C.GetBoundingBox(true);
            wPoint      O = new wPoint(B.Center.X, B.Center.Y, B.Center.Z);

            wShape           Shape  = new wShape(new wRectangle());
            wShapeCollection Shapes = new wShapeCollection(Shape);

            wPlane Pln = new wPlane().XYPlane();

            Pln.Origin = O;

            Shapes.Boundary = new wRectangle(Pln, B.Diagonal.X, B.Diagonal.Y);
            //Shapes.Type = Crv.GetCurveType;

            if (C.IsClosed)
            {
                Shapes.Graphics = new wGraphic().BlackFill();
            }
            else
            {
                Shapes.Graphics = new wGraphic().BlackOutline();
            }
            Shapes.Effects = new wEffects();


            wObject WindObject = new wObject(Shapes, "Hoopoe", Shapes.Type);

            DA.SetData(0, WindObject);
        }
Esempio n. 4
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Curve  C = new Circle(new Point3d(0, 0, 0), 1).ToNurbsCurve();
            double D = 0;
            double K = 0;

            if (!DA.GetData(0, ref C))
            {
                return;
            }
            if (!DA.GetData(1, ref D))
            {
                return;
            }
            if (!DA.GetData(2, ref K))
            {
                return;
            }

            wCurve Crv = new wCircle(new wPoint(), 1);

            Curve[] Segments = C.DuplicateSegments();

            // Check if is pline
            if (Segments.Count() > 1)
            {
                Polyline P = new Polyline();
                if (C.TryGetPolyline(out P))
                {
                    List <wPoint> Pts = new List <wPoint>();
                    for (int i = 0; i < P.Count; i++)
                    {
                        Pts.Add(new wPoint(P[i].X, P[i].Y, P[i].Z));
                    }

                    Crv = new wPolyline(Pts, P.IsClosed);
                }
                else
                {
                    Crv = new RhCrvToWindCrv().ToPiecewiseBezier(C, D, K);
                }
            }
            else
            {
                Crv = new RhCrvToWindCrv(C).WindCurve;
            }

            BoundingBox B = C.GetBoundingBox(true);
            wPoint      O = new wPoint(B.Center.X, B.Center.Y, B.Center.Z);

            wShape           Shape  = new wShape(Crv);
            wShapeCollection Shapes = new wShapeCollection(Shape);

            wPlane Pln = new wPlane().XYPlane();

            Pln.Origin = O;

            Shapes.Boundary = new wRectangle(Pln, B.Diagonal.X, B.Diagonal.Y);
            Shapes.Type     = Crv.GetCurveType;

            if (C.IsClosed)
            {
                Shapes.Graphics = new wGraphic().BlackFill();
            }
            else
            {
                Shapes.Graphics = new wGraphic().BlackOutline();
            }
            Shapes.Effects = new wEffects();


            wObject WindObject = new wObject(Shapes, "Hoopoe", Shapes.Type);

            DA.SetData(0, WindObject);
        }