예제 #1
0
        public static BHX.WindowType ToGBXMLWindow(this BHC.Construction construction, BHE.Opening opening)
        {
            BHX.WindowType window = new BHX.WindowType();

            BHP.PanelAnalyticalFragment extraProperties   = opening.FindFragment <BHP.PanelAnalyticalFragment>(typeof(BHP.PanelAnalyticalFragment));
            BHP.OriginContextFragment   contextProperties = opening.FindFragment <BHP.OriginContextFragment>(typeof(BHP.OriginContextFragment));

            window.ID                             = "window-" + (contextProperties == null ? construction.Name.CleanName() : contextProperties.TypeName.CleanName());
            window.Name                           = (contextProperties == null ? construction.Name : contextProperties.TypeName);
            window.UValue.Value                   = (extraProperties == null || extraProperties.UValue == 0 ? construction.UValue().ToString() : extraProperties.UValue.ToString());
            window.Transmittance.Value            = (extraProperties == null ? "0" : extraProperties.LTValue.ToString());
            window.SolarHeatGainCoefficient.Value = (extraProperties == null ? "0" : extraProperties.GValue.ToString());
            if (construction.Layers.Count > 0)
            {
                window.InternalGlaze = (construction.Layers[0]).ToGBXGlazed();
            }
            if (construction.Layers.Count > 1)
            {
                window.Gap = (construction.Layers[1]).ToGBXGap();
            }
            if (construction.Layers.Count > 2)
            {
                window.ExternalGlaze = (construction.Layers[2]).ToGBXGlazed();
            }

            return(window);
        }
예제 #2
0
        public static BHX.Construction ToGBXML(this BHC.Construction construction, BHE.Panel element = null)
        {
            BHX.Construction gbConstruction = new BHX.Construction();

            BHP.OriginContextFragment   contextProperties  = null;
            BHP.PanelAnalyticalFragment analysisProperties = null;
            if (element != null)
            {
                contextProperties  = element.FindFragment <BHP.OriginContextFragment>(typeof(BHP.OriginContextFragment));
                analysisProperties = element.FindFragment <BHP.PanelAnalyticalFragment>(typeof(BHP.PanelAnalyticalFragment));
            }

            gbConstruction.ID = (contextProperties == null ? construction.ConstructionID() : contextProperties.TypeName.CleanName().Replace(" ", "-"));
            gbConstruction.Absorptance.Value = construction.Absorptance().ToString();
            gbConstruction.Name         = (contextProperties == null ? construction.Name : contextProperties.TypeName);
            gbConstruction.Roughness    = construction.Roughness().ToGBXML();
            gbConstruction.UValue.Value = (analysisProperties == null || analysisProperties.UValue == 0 ? construction.UValue() : analysisProperties.UValue).ToString();

            return(gbConstruction);
        }