Exemplo n.º 1
0
 public static IBuildingObject AddExtendedProperty(this IBuildingObject obj, IBHoMExtendedProperties properties)
 {
     if (obj == null)
     {
         return(null);
     }
     obj.ExtendedProperties.Add(properties);
     return(obj);
 }
Exemplo n.º 2
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static double Orientation(IBuildingObject buildingPanel)
        {
            Panel panel = buildingPanel as Panel;

            BHG.Polyline pLine = new BHG.Polyline {
                ControlPoints = panel.PanelCurve.IControlPoints()
            };

            List <BHG.Point> pts = pLine.DiscontinuityPoints();

            BHG.Plane plane = BH.Engine.Geometry.Create.Plane(pts[0], pts[1], pts[2]); //Some protection on this needed maybe?

            BHG.Vector xyNormal = BH.Engine.Geometry.Create.Vector(0, 1, 0);

            return(BH.Engine.Geometry.Query.Angle(plane.Normal, xyNormal) * (180 / Math.PI));
        }
Exemplo n.º 3
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static ICurve Bottom(this IBuildingObject buildingElementGeometry)
        {
            if (buildingElementGeometry == null)
            {
                return(null);
            }

            PolyCurve workingCurves = null;

            if (buildingElementGeometry is Panel)
            {
                workingCurves = (buildingElementGeometry as Panel).PanelCurve as PolyCurve;
            }
            else if (buildingElementGeometry is BuildingElement)
            {
                workingCurves = (buildingElementGeometry as BuildingElement).PanelCurve as PolyCurve;
            }
            else if (buildingElementGeometry is Opening)
            {
                workingCurves = (buildingElementGeometry as Opening).OpeningCurve as PolyCurve;
            }

            if (workingCurves == null)
            {
                return(null);
            }

            double aZ      = double.MaxValue;
            ICurve aResult = null;

            foreach (ICurve aCurve in workingCurves.Curves)
            {
                Point aPoint_Start = aCurve.IStartPoint();
                Point aPoint_End   = aCurve.IEndPoint();

                if (aPoint_End.Z <= aZ && aPoint_Start.Z <= aZ)
                {
                    aZ      = Math.Max(aPoint_End.Z, aPoint_Start.Z);
                    aResult = aCurve;
                }
            }
            return(aResult);
        }
Exemplo n.º 4
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static double Width(this IBuildingObject buildingObject)
        {
            return(Width(buildingObject as dynamic));
        }
Exemplo n.º 5
0
        /***************************************************/

        public static IBuildingObject Copy(this IBuildingObject buildingObject)
        {
            IBuildingObject aBuildingObject = Copy(buildingObject as dynamic);

            return(aBuildingObject);
        }
Exemplo n.º 6
0
 public static IBHoMExtendedProperties EnvironmentContextProperties(this IBuildingObject obj)
 {
     return(EnvironmentContextProperties(obj as dynamic));
 }
Exemplo n.º 7
0
 public static IBHoMExtendedProperties ElementProperties(this IBuildingObject obj)
 {
     return(ElementProperties(obj as dynamic));
 }
Exemplo n.º 8
0
 public static IBHoMExtendedProperties AnalyticalProperties(this IBuildingObject obj)
 {
     return(AnalyticalProperties(obj as dynamic));
 }
Exemplo n.º 9
0
 public static IBHoMExtendedProperties PropertiesByType(this IBuildingObject obj, Type propertyType)
 {
     return(obj.ExtendedProperties.Where(x => x.GetType() == propertyType).FirstOrDefault());
 }
Exemplo n.º 10
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static double Height(this IBuildingObject buildingObject)
        {
            return(Height(buildingObject as dynamic));
        }
Exemplo n.º 11
0
 public static ICurve ICurve(this IBuildingObject buildingObject)
 {
     return(Curve(buildingObject as dynamic));
 }
Exemplo n.º 12
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static IBuildingObject ISetGeometry(this IBuildingObject buildingObject, ICurve curve)
        {
            return(SetGeometry(buildingObject as dynamic, curve as dynamic));
        }