Esempio n. 1
0
        /// <summary>
        /// Processes IfcTypeObject attributes.
        /// </summary>
        /// <param name="ifcTypeObject">The IfcTypeObject handle.</param>
        protected override void Process(IFCAnyHandle ifcTypeObject)
        {
            base.Process(ifcTypeObject);

            HashSet <IFCAnyHandle> propertySets = IFCAnyHandleUtil.GetAggregateInstanceAttribute
                                                  <HashSet <IFCAnyHandle> >(ifcTypeObject, "HasPropertySets");

            if (propertySets != null)
            {
                m_IFCPropertySets = new Dictionary <string, IFCPropertySetDefinition>();

                foreach (IFCAnyHandle propertySet in propertySets)
                {
                    IFCPropertySetDefinition ifcPropertySetDefinition = IFCPropertySetDefinition.ProcessIFCPropertySetDefinition(propertySet);
                    if (ifcPropertySetDefinition != null)
                    {
                        string name = ifcPropertySetDefinition.Name;
                        if (string.IsNullOrWhiteSpace(name))
                        {
                            name = IFCAnyHandleUtil.GetEntityType(propertySet).ToString() + " " + propertySet.StepId;
                        }
                        m_IFCPropertySets[name] = ifcPropertySetDefinition;
                    }
                }
            }
        }
Esempio n. 2
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);
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Processes IfcRelDefinesByProperties.
        /// </summary>
        /// <param name="ifcRelDefinesByProperties">The IfcRelDefinesByProperties handle.</param>
        void ProcessIFCRelDefinesByProperties(IFCAnyHandle ifcRelDefinesByProperties)
        {
            IFCAnyHandle propertySetDefinition = IFCAnyHandleUtil.GetInstanceAttribute(ifcRelDefinesByProperties, "RelatingPropertyDefinition");

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(propertySetDefinition))
            {
                IFCImportFile.TheLog.LogNullError(IFCEntityType.IfcPropertySetDefinition);
                return;
            }

            IFCPropertySetDefinition ifcPropertySet = IFCPropertySetDefinition.ProcessIFCPropertySetDefinition(propertySetDefinition);

            if (ifcPropertySet != null)
            {
                int propertySetNumber = 1;
                while (true)
                {
                    string name = (propertySetNumber == 1) ? ifcPropertySet.Name : ifcPropertySet.Name + " " + propertySetNumber.ToString();
                    if (PropertySets.ContainsKey(name))
                    {
                        propertySetNumber++;
                    }
                    else
                    {
                        PropertySets[name] = ifcPropertySet;
                        break;
                    }
                }
            }
        }
Esempio n. 4
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);
                    }
                }
            }
        }