Example #1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        ///

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            //Create class instances
            List <Point3d> pts = new List <Point3d>();

            ObjectModel.SingleFamily sfh = new ObjectModel.SingleFamily();
            Curve crv = new PolylineCurve();

            //Get Data
            if (!DA.GetData(0, ref sfh))
            {
                return;
            }
            if (!DA.GetData(1, ref crv))
            {
                return;
            }


            //Calculate
            pts = PlotPlanning.Methods.Generate.PossiblePoints(crv, sfh);

            //Set data
            DA.SetDataList(0, pts);
        }
Example #2
0
        //====================================================================//

        public static List <Line> SegmentBounds(Polyline siteBound, ObjectModel.SingleFamily house)
        {
            double   minAmount = house.MinAmount;
            Polyline pline     = house.GardenBound;
            Point3d  pt        = house.AccessPoint;

            if (!Query.IsClockwise(siteBound, new Vector3d(0, 0, -1)))
            {
                siteBound.Reverse();
            }

            List <double> lengths  = new List <double>();
            List <Line>   segments = new List <Line>();

            double gardenLength = Query.ClosestSegmentToPoint(pt, pline).Length;

            foreach (var segm in siteBound.GetSegments())
            {
                if (segm.Length > gardenLength * minAmount)
                {
                    segments.Add(segm);
                }
            }
            List <Line> shuffledSegments = segments.OrderBy(x => x.Length).ToList();

            return(shuffledSegments);
        }
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            //Create class instances
            ObjectModel.SingleFamily house = new ObjectModel.SingleFamily();
            Surface site      = null;
            int     divisions = 0;


            //Get Data
            if (!DA.GetData(0, ref house))
            {
                return;
            }
            if (!DA.GetData(1, ref site))
            {
                return;
            }
            if (!DA.GetData(2, ref divisions))
            {
                return;
            }

            //Calculate
            Dictionary <string, double> values = PlotPlanning.Methods.Evaluate.MassBalance(house, site, divisions);

            //Set data
            DA.SetData(0, values["cut"]);
            DA.SetData(1, values["fill"]);
            DA.SetData(2, values["massBalance"]);
        }
Example #4
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            //Create class instances
            string      type        = "";
            bool        carport     = false;
            Rectangle3d gardenBound = new Rectangle3d();
            Brep        houseGeom   = null;
            Point3d     accessPoint = new Point3d();
            int         minAmount   = 1;
            int         maxAmount   = 999;
            int         offset      = 1;

            //Get Data
            if (!DA.GetData(0, ref type))
            {
                return;
            }
            if (!DA.GetData(1, ref carport))
            {
                return;
            }
            if (!DA.GetData(2, ref gardenBound))
            {
                return;
            }
            DA.GetData(3, ref houseGeom);
            // return;
            if (!DA.GetData(4, ref accessPoint))
            {
                return;
            }
            if (!DA.GetData(5, ref minAmount))
            {
                return;
            }
            if (!DA.GetData(6, ref maxAmount))
            {
                return;
            }
            if (!DA.GetData(7, ref offset))
            {
                return;
            }

            //Set properties
            PlotPlanning.ObjectModel.SingleFamily house = new ObjectModel.SingleFamily(type, carport, gardenBound.ToPolyline(), houseGeom, accessPoint, minAmount, maxAmount, offset);
            if (house.HouseGeom == null)
            {
                house.HouseGeom = ReadGeometry.ReadHouseGeometry(type);
            }


            //Set data
            DA.SetData(0, house);
        }
        //====================================================================//

        public static ObjectModel.SingleFamily Clone(this ObjectModel.SingleFamily house)
        {
            return(new ObjectModel.SingleFamily
            {
                Type = house.Type,
                HasCarPort = house.HasCarPort,
                GardenBound = house.GardenBound.Duplicate(),
                HouseGeom = house.HouseGeom.Clone(),
                Orientation = new Vector3d(house.Orientation),
                AccessPoint = house.AccessPoint.Clone(),
                MinAmount = house.MinAmount,
                MaxAmount = house.MaxAmount,
                Offset = house.Offset,
                RowPosition = house.RowPosition,
                MidPoint = house.MidPoint.Clone(),
            });
        }
        public static bool IsInside(ObjectModel.SingleFamily sfh, Curve bound)
        {
            Curve garden = Curve.CreateControlPointCurve(sfh.GardenBound.ToList(), 1);

            return(IsInside(garden, bound));
        }