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

            HashSet <IFCData> styles = IFCAnyHandleUtil.GetAggregateAttribute <HashSet <IFCData> >(item, "Styles");

            if (styles != null)
            {
                foreach (IFCData styleData in styles)
                {
                    if (styleData.PrimitiveType == IFCDataPrimitiveType.Instance)
                    {
                        IFCAnyHandle style = styleData.AsInstance();
                        try
                        {
                            IFCPresentationStyle presentationStyle = IFCPresentationStyle.ProcessIFCPresentationStyle(style);
                            if (presentationStyle != null)
                            {
                                Styles.Add(presentationStyle);
                            }
                        }
                        catch (Exception ex)
                        {
                            Importer.TheLog.LogError(item.StepId, ex.Message, false);
                        }
                    }
                }
            }
        }
        override protected void Process(IFCAnyHandle item)
        {
            base.Process(item);

            IList <IFCAnyHandle> layerStyles = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(item, "LayerStyles");

            foreach (IFCAnyHandle layerStyle in layerStyles)
            {
                if (layerStyle == null)
                {
                    Importer.TheLog.LogNullError(IFCEntityType.IfcPresentationStyle);
                    continue;
                }

                IFCPresentationStyle presentationStyle = IFCPresentationStyle.ProcessIFCPresentationStyle(layerStyle);
                if (presentationStyle != null)
                {
                    LayerStyles.Add(presentationStyle);
                }
                else
                {
                    Importer.TheLog.LogUnhandledSubTypeError(layerStyle, "IfcPresentationStyle", false);
                }
            }
        }
示例#3
0
        override protected void Process(IFCAnyHandle styledItem)
        {
            base.Process(styledItem);

            IFCAnyHandle item = IFCImportHandleUtil.GetOptionalInstanceAttribute(styledItem, "Item");

            if (!IFCAnyHandleUtil.IsNullOrHasNoValue(item))
            {
                Item = IFCRepresentationItem.ProcessIFCRepresentationItem(item);
            }

            Name = IFCImportHandleUtil.GetOptionalStringAttribute(styledItem, "Name", null);

            List <IFCAnyHandle> styles = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(styledItem, "Styles");

            if (styles == null || styles.Count == 0)
            {
                Importer.TheLog.LogMissingRequiredAttributeError(styledItem, "Styles", true);
            }

            foreach (IFCAnyHandle style in styles)
            {
                if (IFCAnyHandleUtil.IsNullOrHasNoValue(style))
                {
                    continue;
                }

                if (IFCImportFile.TheFile.SchemaVersionAtLeast(IFCSchemaVersion.IFC4Obsolete) && IFCAnyHandleUtil.IsValidSubTypeOf(style, IFCEntityType.IfcPresentationStyle))
                {
                    Styles.Add(IFCPresentationStyle.ProcessIFCPresentationStyle(style));
                }
                else
                {
                    if (Styles.Count != 0)
                    {
                        Importer.TheLog.LogWarning(styledItem.StepId, "Multiple presentation styles found for IfcStyledItem - using first.", false);
                        continue;
                    }

                    IFCPresentationStyleAssignment presentationStyleAssignment =
                        IFCPresentationStyleAssignment.ProcessIFCPresentationStyleAssignment(style);
                    if (presentationStyleAssignment != null && presentationStyleAssignment.Styles != null)
                    {
                        Styles.AddRange(presentationStyleAssignment.Styles);
                    }
                }
            }
        }