Example #1
0
        override protected void Process(IFCAnyHandle item)
        {
            base.Process(item);

            string surfaceSideAsString = IFCAnyHandleUtil.GetEnumerationAttribute(item, "Side");

            if (surfaceSideAsString == null)
            {
                SurfaceSide = IFCSurfaceSide.Both;
                IFCImportFile.TheLog.LogWarning(item.StepId, "No surface side defined, defaulting to Both.", false);
            }
            else
            {
                SurfaceSide = (IFCSurfaceSide)Enum.Parse(typeof(IFCSurfaceSide), surfaceSideAsString, true);
            }

            HashSet <IFCAnyHandle> styles = IFCAnyHandleUtil.GetAggregateInstanceAttribute <HashSet <IFCAnyHandle> >(item, "Styles");

            if (styles == null || styles.Count == 0)
            {
                IFCImportFile.TheLog.LogError(item.StepId, "No style information found, ignoring.", true);
            }

            foreach (IFCAnyHandle style in styles)
            {
                try
                {
                    if (IFCAnyHandleUtil.IsSubTypeOf(style, IFCEntityType.IfcSurfaceStyleShading))
                    {
                        if (ShadingStyle == null)
                        {
                            ShadingStyle = IFCSurfaceStyleShading.ProcessIFCSurfaceStyleShading(style);
                        }
                        else
                        {
                            IFCImportFile.TheLog.LogWarning(item.StepId, "Duplicate IfcSurfaceStyleShading, ignoring.", false);
                        }
                    }
                    else
                    {
                        IFCImportFile.TheLog.LogUnhandledSubTypeError(style, "IfcSurfaceStyleElementSelect", false);
                    }
                }
                catch (Exception ex)
                {
                    IFCImportFile.TheLog.LogError(style.StepId, ex.Message, false);
                }
            }
        }
        override protected void Process(IFCAnyHandle item)
        {
            base.Process(item);

            SurfaceSide = IFCEnums.GetSafeEnumerationAttribute <IFCSurfaceSide>(item, "Side", IFCSurfaceSide.Both);

            HashSet <IFCAnyHandle> styles = IFCAnyHandleUtil.GetAggregateInstanceAttribute <HashSet <IFCAnyHandle> >(item, "Styles");

            if (styles == null || styles.Count == 0)
            {
                Importer.TheLog.LogError(item.StepId, "No style information found, ignoring.", true);
            }

            foreach (IFCAnyHandle style in styles)
            {
                try
                {
                    if (IFCAnyHandleUtil.IsSubTypeOf(style, IFCEntityType.IfcSurfaceStyleShading))
                    {
                        if (ShadingStyle == null)
                        {
                            ShadingStyle = IFCSurfaceStyleShading.ProcessIFCSurfaceStyleShading(style);
                        }
                        else
                        {
                            Importer.TheLog.LogWarning(item.StepId, "Duplicate IfcSurfaceStyleShading, ignoring.", false);
                        }
                    }
                    else
                    {
                        Importer.TheLog.LogUnhandledSubTypeError(style, "IfcSurfaceStyleElementSelect", false);
                    }
                }
                catch (Exception ex)
                {
                    Importer.TheLog.LogError(style.StepId, ex.Message, false);
                }
            }
        }