protected override void Process(IFCAnyHandle ifcMaterialConstituentSet)
        {
            base.Process(ifcMaterialConstituentSet);

            IList <IFCAnyHandle> ifcMaterialConsitutuents =
                IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcMaterialConstituentSet, "MaterialConstituents");

            if (ifcMaterialConsitutuents == null)
            {
                Importer.TheLog.LogError(ifcMaterialConstituentSet.Id, "Expected at least 1 MaterialConsituent, found none.", false);
                return;
            }

            foreach (IFCAnyHandle ifcMaterialConstituent in ifcMaterialConsitutuents)
            {
                IFCMaterialConstituent materialConstituent = IFCMaterialConstituent.ProcessIFCMaterialConstituent(ifcMaterialConstituent);
                if (materialConstituent != null)
                {
                    MaterialConstituents.Add(materialConstituent);
                }
            }

            Name        = IFCImportHandleUtil.GetOptionalStringAttribute(ifcMaterialConstituentSet, "Name", null);
            Description = IFCImportHandleUtil.GetOptionalStringAttribute(ifcMaterialConstituentSet, "Description", null);
        }
        /// <summary>
        /// Process an IFCMaterialConstituent entity
        /// </summary>
        /// <param name="ifcMaterialConstituent">the material constituent</param>
        /// <returns>returns IFCMaterialCOnstituent object</returns>
        public static IFCMaterialConstituent ProcessIFCMaterialConstituent(IFCAnyHandle ifcMaterialConstituent)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcMaterialConstituent))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcMaterialConstituent);
                return(null);
            }

            IFCEntity materialConstituent;

            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcMaterialConstituent.StepId, out materialConstituent))
            {
                materialConstituent = new IFCMaterialConstituent(ifcMaterialConstituent);
            }
            return(materialConstituent as IFCMaterialConstituent);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Processes IfcRelAssociatesMaterial.
        /// </summary>
        /// <param name="ifcRelAssociatesMaterial">The IfcRelAssociatesMaterial handle.</param>
        void ProcessIFCRelAssociatesMaterial(IFCAnyHandle ifcRelAssociatesMaterial)
        {
            IFCAnyHandle ifcMaterialSelect = IFCAnyHandleUtil.GetInstanceAttribute(ifcRelAssociatesMaterial, "RelatingMaterial");

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcMaterialSelect))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcRelAssociatesMaterial);
                return;
            }

            // Deal with various types of IFCMaterialSelect.
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcMaterialSelect, IFCEntityType.IfcMaterial))
            {
                MaterialSelect = IFCMaterial.ProcessIFCMaterial(ifcMaterialSelect);
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcMaterialSelect, IFCEntityType.IfcMaterialLayer))
            {
                MaterialSelect = IFCMaterialLayer.ProcessIFCMaterialLayer(ifcMaterialSelect);
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcMaterialSelect, IFCEntityType.IfcMaterialLayerSet))
            {
                MaterialSelect = IFCMaterialLayerSet.ProcessIFCMaterialLayerSet(ifcMaterialSelect);
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcMaterialSelect, IFCEntityType.IfcMaterialLayerSetUsage))
            {
                MaterialSelect = IFCMaterialLayerSetUsage.ProcessIFCMaterialLayerSetUsage(ifcMaterialSelect);
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcMaterialSelect, IFCEntityType.IfcMaterialList))
            {
                MaterialSelect = IFCMaterialList.ProcessIFCMaterialList(ifcMaterialSelect);
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcMaterialSelect, IFCEntityType.IfcMaterialProfile))
            {
                MaterialSelect = IFCMaterialProfile.ProcessIFCMaterialProfile(ifcMaterialSelect);
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcMaterialSelect, IFCEntityType.IfcMaterialProfileSet))
            {
                MaterialSelect = IFCMaterialProfileSet.ProcessIFCMaterialProfileSet(ifcMaterialSelect);
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcMaterialSelect, IFCEntityType.IfcMaterialProfileSetUsage))
            {
                if (IFCAnyHandleUtil.IsTypeOf(ifcMaterialSelect, IFCEntityType.IfcMaterialProfileSetUsageTapering))
                {
                    MaterialSelect = IFCMaterialProfileSetUsageTapering.ProcessIFCMaterialProfileSetUsageTapering(ifcMaterialSelect);
                }
                else
                {
                    MaterialSelect = IFCMaterialProfileSetUsage.ProcessIFCMaterialProfileSetUsage(ifcMaterialSelect);
                }
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcMaterialSelect, IFCEntityType.IfcMaterialConstituent))
            {
                MaterialSelect = IFCMaterialConstituent.ProcessIFCMaterialConstituent(ifcMaterialSelect);
            }
            else if (IFCAnyHandleUtil.IsSubTypeOf(ifcMaterialSelect, IFCEntityType.IfcMaterialConstituentSet))
            {
                MaterialSelect = IFCMaterialConstituentSet.ProcessIFCMaterialConstituentSet(ifcMaterialSelect);
            }
            else
            {
                Importer.TheLog.LogUnhandledSubTypeError(ifcMaterialSelect, "IfcMaterialSelect", false);
            }
        }