Пример #1
0
        /// <summary>
        /// Processes IfcObject attributes.
        /// </summary>
        /// <param name="ifcObject">The IfcObject handle.</param>
        protected override void Process(IFCAnyHandle ifcObject)
        {
            base.Process(ifcObject);

            m_ObjectType = IFCAnyHandleUtil.GetStringAttribute(ifcObject, "ObjectType");

            HashSet <IFCAnyHandle> isDefinedByHandles = IFCAnyHandleUtil.GetAggregateInstanceAttribute
                                                        <HashSet <IFCAnyHandle> >(ifcObject, "IsDefinedBy");

            if (isDefinedByHandles != null)
            {
                IFCPropertySetDefinition.ResetCounters();
                foreach (IFCAnyHandle isDefinedByHandle in isDefinedByHandles)
                {
                    if (IFCAnyHandleUtil.IsSubTypeOf(isDefinedByHandle, IFCEntityType.IfcRelDefinesByProperties))
                    {
                        ProcessIFCRelDefinesByProperties(isDefinedByHandle);
                    }
                    else if (IFCAnyHandleUtil.IsSubTypeOf(isDefinedByHandle, IFCEntityType.IfcRelDefinesByType))
                    {
                        ProcessIFCRelDefinesByType(isDefinedByHandle);
                    }
                    else
                    {
                        IFCImportFile.TheLog.LogUnhandledSubTypeError(isDefinedByHandle, IFCEntityType.IfcRelDefines, false);
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Processes IfcObject attributes.
        /// </summary>
        /// <param name="ifcObject">The IfcObject handle.</param>
        protected override void Process(IFCAnyHandle ifcObject)
        {
            base.Process(ifcObject);

            ObjectType = IFCAnyHandleUtil.GetStringAttribute(ifcObject, "ObjectType");

            HashSet <IFCAnyHandle> isDefinedByHandles = IFCAnyHandleUtil.GetAggregateInstanceAttribute
                                                        <HashSet <IFCAnyHandle> >(ifcObject, "IsDefinedBy");

            // IFC4 adds "IsDeclaredBy" and "IsTypedBy" inverse attributes. We'll read in "IsTypedBy" and
            // group this wih "IsDefinedBy" together, although we may later decide to split them up for performance reasons.
            // Note that IcProject in IFC4 inherits from IfcContext, not IfcObject (as it did in IFC2x3).  Currently, the
            // only difference between the two is that IfcObject supports "IsDeclaredBy" and "IsTypedBy", and that IfcContext
            // contains the attributes of IfcProject from IFC2x3.  We'll keep the attributes at the IfcProject level for now
            // and protect against reading "IsTypedBy" here.
            if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC4 && !IFCAnyHandleUtil.IsSubTypeOf(ifcObject, IFCEntityType.IfcProject))
            {
                HashSet <IFCAnyHandle> isTypedBy = IFCAnyHandleUtil.GetAggregateInstanceAttribute
                                                   <HashSet <IFCAnyHandle> >(ifcObject, "IsTypedBy");
                if (isTypedBy != null)
                {
                    isDefinedByHandles.UnionWith(isTypedBy);
                }
            }

            if (isDefinedByHandles != null)
            {
                IFCPropertySetDefinition.ResetCounters();
                foreach (IFCAnyHandle isDefinedByHandle in isDefinedByHandles)
                {
                    if (IFCAnyHandleUtil.IsSubTypeOf(isDefinedByHandle, IFCEntityType.IfcRelDefinesByProperties))
                    {
                        ProcessIFCRelation.ProcessIFCRelDefinesByProperties(isDefinedByHandle, PropertySets);
                    }
                    else if (IFCAnyHandleUtil.IsSubTypeOf(isDefinedByHandle, IFCEntityType.IfcRelDefinesByType))
                    {
                        ProcessIFCRelDefinesByType(isDefinedByHandle);
                    }
                    else
                    {
                        Importer.TheLog.LogUnhandledSubTypeError(isDefinedByHandle, IFCEntityType.IfcRelDefines, false);
                    }
                }
            }
        }