Esempio n. 1
0
        virtual public void Berecne()
        {
            if (null == PanelGroupAst)
            {
                return;
            }

            if (!(true == PanelGroupAst.VisibleIncludingInheritance))
            {
                return;
            }

            var ContainerMengeEntryName = this.ContainerMengeEntryName;

            ContainerMengeEntryAst =
                Optimat.EveOnline.AuswertGbs.Extension.FirstMatchingNodeFromSubtreeBreadthFirst(
                    PanelGroupAst, (Kandidaat) =>
                    Kandidaat.PyObjTypNameIsContainer() &&
                    string.Equals(ContainerMengeEntryName, Kandidaat.Name, StringComparison.InvariantCultureIgnoreCase),
                    2, 1);

            var Ergeebnis = new PanelGroup(PanelGroupAst.AlsContainer());

            this.Ergeebnis = Ergeebnis;
        }
        public void ExternalScript_DefaultValue()
        {
            // Arrange
            var panelGroup = new PanelGroup();

            // Act, Assert
            panelGroup.ExternalScript.ShouldBeEmpty();
        }
Esempio n. 3
0
        public static HostObject HostObject(this Aperture aperture, Document document)
        {
            HostObject result = null;

            PanelGroup panelGroup = Analytical.Query.PanelGroup(Analytical.Query.PanelType(aperture.Plane.Normal));

            switch (panelGroup)
            {
            case PanelGroup.Wall:
                IEnumerable <Wall> walls = Geometry.Revit.Query.Elements <Wall>(document, aperture.GetBoundingBox());
                if (walls != null && walls.Count() != 0)
                {
                    result = walls.First();
                }
                break;

            case PanelGroup.Floor:
                IEnumerable <Element> elements_Floor = Geometry.Revit.Query.Elements(document, aperture.GetBoundingBox(), Autodesk.Revit.DB.BuiltInCategory.OST_Floors);
                if (elements_Floor != null && elements_Floor.Count() != 0)
                {
                    result = elements_Floor.First() as HostObject;
                }
                break;

            case PanelGroup.Roof:
                IEnumerable <Element> elements_Roof = Geometry.Revit.Query.Elements(document, aperture.GetBoundingBox(), Autodesk.Revit.DB.BuiltInCategory.OST_Roofs);
                if (elements_Roof != null && elements_Roof.Count() != 0)
                {
                    result = elements_Roof.First() as HostObject;
                }
                break;
            }

            if (result == null)
            {
                switch (panelGroup)
                {
                case PanelGroup.Roof:
                    IEnumerable <Element> elements_Floor = Geometry.Revit.Query.Elements(document, aperture.GetBoundingBox(), Autodesk.Revit.DB.BuiltInCategory.OST_Floors);
                    if (elements_Floor != null && elements_Floor.Count() != 0)
                    {
                        result = elements_Floor.First() as HostObject;
                    }
                    break;

                case PanelGroup.Floor:
                    IEnumerable <Element> elements_Roof = Geometry.Revit.Query.Elements(document, aperture.GetBoundingBox(), Autodesk.Revit.DB.BuiltInCategory.OST_Roofs);
                    if (elements_Roof != null && elements_Roof.Count() != 0)
                    {
                        result = elements_Roof.First() as HostObject;
                    }
                    break;
                }
            }

            return(result);
        }
        public void ExternalScript_SetAndGetValue()
        {
            // Arrange
            var panelGroup = new PanelGroup();

            // Act
            panelGroup.ExternalScript = "Test1";

            // Assert
            panelGroup.ExternalScript.ShouldBe("Test1");
        }
        public static Construction DefaultAirConstruction(this PanelGroup panelGroup)
        {
            ConstructionLibrary constructionLibrary = DefaultAirConstructionLibrary();

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

            Construction result = constructionLibrary.GetConstructions(panelGroup)?.FirstOrDefault();

            if (result == null || panelGroup == PanelGroup.Roof)
            {
                result = constructionLibrary.GetConstructions(PanelGroup.Floor)?.FirstOrDefault();
            }

            return(result);
        }
        protected Transform GetParent(GameObject prefab)
        {
            PanelGroup uigroup = null;

            if (serializedObject.targetObject is PanelGroup)
            {
                uigroup = serializedObject.targetObject as PanelGroup;
            }
            else
            {
                uigroup = Object.FindObjectOfType <PanelGroup>();
            }

            if (uigroup != null)
            {
                return(uigroup.transform);
            }
#if AssetBundleTools
            RuntimePanelGroup runtimeGroup = Object.FindObjectOfType <RuntimePanelGroup>();
            if (runtimeGroup != null)
            {
                return(runtimeGroup.transform);
            }
#endif

            if (prefab.GetComponent <RectTransform>() != null)
            {
                var canvas = GameObject.FindObjectOfType <Canvas>();
                if (canvas != null)
                {
                    return(canvas.transform);
                }

                var ok = EditorApplication.ExecuteMenuItem("GameObject/UI/Canvas");
                if (ok)
                {
                    var selected = Selection.activeTransform;
                    return(selected);
                }
            }

            return(null);
        }
        public void ChangeScreen(PanelGroup panelGroup, string screenName)
        {
            Console.WriteLine($"ChangeScreen {panelGroup}, {screenName}");

            switch (panelGroup)
            {
            case PanelGroup.OperationMode:
                _panelMode = Common.PanelMode.Auto;
                break;

            case PanelGroup.ProgramMode:
                _panelMode = Common.PanelMode.ProgramOperation;
                break;

            case PanelGroup.ParameterMode:
                _panelMode = Common.PanelMode.ParameterSetup;
                break;

            case PanelGroup.ZeroSetMode:
                _panelMode = Common.PanelMode.ZeroSetup;
                break;

            case PanelGroup.ToolDataSettingMode:
                _panelMode = Common.PanelMode.ToolDataSetup;
                break;

            case PanelGroup.MacManMode:
                _panelMode = Common.PanelMode.MacMan;
                break;

            default:
                _panelMode = Common.PanelMode.Auto;
                break;
            }

            PanelModeChanged?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 8
0
        public static Panel ToSAM(this Face face, IEnumerable <Construction> constructions = null, IEnumerable <ApertureConstruction> apertureConstructions = null)
        {
            if (face == null)
            {
                return(null);
            }

            Geometry.Spatial.Face3D face3D = Geometry.LadybugTools.Convert.ToSAM(face.Geometry);
            if (face3D == null)
            {
                return(null);
            }

            PanelType panelType = PanelType.Undefined;

            PanelGroup panelGroup = face.FaceType.ToSAM();

            Construction construction = null;

            if (constructions != null && face.Properties?.Energy?.Construction != null)
            {
                foreach (Construction construction_Temp in constructions)
                {
                    if (construction_Temp.Name == face.Properties.Energy.Construction)
                    {
                        construction = construction_Temp;
                        break;
                    }
                }
            }

            AnyOf <Ground, Outdoors, Adiabatic, Surface> boundaryCondition = face.BoundaryCondition;

            if (boundaryCondition.Obj is Ground)
            {
                switch (panelGroup)
                {
                case PanelGroup.Floor:
                    panelType = PanelType.SlabOnGrade;
                    break;

                case PanelGroup.Other:
                    panelType = PanelType.Air;
                    break;

                case PanelGroup.Roof:
                    panelType = PanelType.UndergroundCeiling;
                    break;

                case PanelGroup.Wall:
                    panelType = PanelType.UndergroundWall;
                    break;
                }
            }
            else if (boundaryCondition.Obj is Adiabatic)
            {
                if (panelGroup == PanelGroup.Roof)
                {
                    panelType = PanelType.Roof;
                }
            }
            else if (boundaryCondition.Obj is Outdoors)
            {
                switch (panelGroup)
                {
                case PanelGroup.Floor:
                    panelType = PanelType.FloorExposed;
                    break;

                case PanelGroup.Other:
                    panelType = PanelType.Shade;
                    break;

                case PanelGroup.Roof:
                    panelType = PanelType.Roof;
                    break;

                case PanelGroup.Wall:
                    panelType = PanelType.WallExternal;
                    break;
                }
            }
            else if (boundaryCondition.Obj is Surface)
            {
                Surface surface = (Surface)boundaryCondition.Obj;

                switch (panelGroup)
                {
                case PanelGroup.Floor:
                    panelType = PanelType.FloorInternal;
                    break;

                case PanelGroup.Wall:
                    panelType = PanelType.WallInternal;
                    break;
                }
            }

            if (construction == null)
            {
                AnyOf <OpaqueConstructionAbridged, WindowConstructionAbridged, ShadeConstruction, AirBoundaryConstructionAbridged> construction_Honeybee = Query.DefaultConstruction(panelType);
                if (construction_Honeybee != null)
                {
                    construction = construction_Honeybee.ToSAM_Construction();
                }
            }

            if (construction == null)
            {
                construction = new Construction(face.Identifier);
            }

            Panel panel = Create.Panel(construction, panelType, face3D);

            if (face.Apertures != null)
            {
                foreach (HoneybeeSchema.Aperture aperture_HoneybeeSchema in face.Apertures)
                {
                    Aperture aperture = aperture_HoneybeeSchema?.ToSAM(panelType.Internal(), apertureConstructions);
                    if (aperture != null)
                    {
                        panel.AddAperture(aperture);
                    }
                }
            }

            if (face.Doors != null)
            {
                foreach (HoneybeeSchema.Door door in face.Doors)
                {
                    Aperture aperture = door?.ToSAM(panelType.Internal(), apertureConstructions);
                    if (aperture != null)
                    {
                        panel.AddAperture(aperture);
                    }
                }
            }

            return(panel);
        }
Esempio n. 9
0
        public static HostObject HostObject(this Aperture aperture, Document document)
        {
            HostObject result = null;

            PanelGroup panelGroup = Analytical.Query.PanelGroup(Analytical.Query.PanelType(aperture.Plane.Normal));

            switch (panelGroup)
            {
            case PanelGroup.Wall:
                IEnumerable <Autodesk.Revit.DB.Wall> walls = Geometry.Revit.Query.Elements <Autodesk.Revit.DB.Wall>(document, aperture.GetBoundingBox());

                if (walls != null && walls.Count() != 0)
                {
                    Geometry.Spatial.Point3D point3D = Geometry.Spatial.Query.InternalPoint3D(aperture.GetFace3D());
                    double distance             = double.MaxValue;
                    Autodesk.Revit.DB.Wall wall = null;
                    foreach (Autodesk.Revit.DB.Wall wall_Temp in walls)
                    {
                        List <Panel> panels = Convert.ToSAM(wall_Temp, new Core.Revit.ConvertSettings(true, false, false));
                        if (panels != null)
                        {
                            foreach (Panel panel in panels)
                            {
                                double distance_Temp = panel.GetFace3D().Distance(point3D);
                                if (distance_Temp < distance)
                                {
                                    distance = distance_Temp;
                                    wall     = wall_Temp;
                                }
                            }
                        }
                    }
                    result = wall;
                }

                break;

            case PanelGroup.Floor:
                IEnumerable <Element> elements_Floor = Geometry.Revit.Query.Elements(document, aperture.GetBoundingBox(), Autodesk.Revit.DB.BuiltInCategory.OST_Floors);
                if (elements_Floor != null && elements_Floor.Count() != 0)
                {
                    result = elements_Floor.First() as HostObject;
                }
                break;

            case PanelGroup.Roof:
                IEnumerable <Element> elements_Roof = Geometry.Revit.Query.Elements(document, aperture.GetBoundingBox(), Autodesk.Revit.DB.BuiltInCategory.OST_Roofs);
                if (elements_Roof != null && elements_Roof.Count() != 0)
                {
                    result = elements_Roof.First() as HostObject;
                }
                break;
            }

            if (result == null)
            {
                switch (panelGroup)
                {
                case PanelGroup.Roof:
                    IEnumerable <Element> elements_Floor = Geometry.Revit.Query.Elements(document, aperture.GetBoundingBox(), Autodesk.Revit.DB.BuiltInCategory.OST_Floors);
                    if (elements_Floor != null && elements_Floor.Count() != 0)
                    {
                        result = elements_Floor.First() as HostObject;
                    }
                    break;

                case PanelGroup.Floor:
                    IEnumerable <Element> elements_Roof = Geometry.Revit.Query.Elements(document, aperture.GetBoundingBox(), Autodesk.Revit.DB.BuiltInCategory.OST_Roofs);
                    if (elements_Roof != null && elements_Roof.Count() != 0)
                    {
                        result = elements_Roof.First() as HostObject;
                    }
                    break;
                }
            }

            return(result);
        }