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

            IFCAnyHandle ifcMaterial = IFCImportHandleUtil.GetOptionalInstanceAttribute(ifcMaterialProfile, "Material");

            if (!IFCAnyHandleUtil.IsNullOrHasNoValue(ifcMaterial))
            {
                Material = IFCMaterial.ProcessIFCMaterial(ifcMaterial);
            }

            IFCAnyHandle profileHnd = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcMaterialProfile, "Profile", true);

            if (profileHnd != null)
            {
                Profile = IFCProfileDef.ProcessIFCProfileDef(profileHnd);
            }

            Name        = IFCImportHandleUtil.GetOptionalStringAttribute(ifcMaterialProfile, "Name", null);
            Description = IFCImportHandleUtil.GetOptionalStringAttribute(ifcMaterialProfile, "Description", null);
            double prio = IFCImportHandleUtil.GetOptionalRealAttribute(ifcMaterialProfile, "Priority", -1);

            if (prio >= 0)
            {
                Priority = prio;
            }
            Category = IFCImportHandleUtil.GetOptionalStringAttribute(ifcMaterialProfile, "Category", null);

            return;
        }
        private void GetTransformedCurveLoopsFromProfile(IFCProfileDef profile, Transform unscaledLcs, Transform scaledLcs, ISet <IList <CurveLoop> > loops)
        {
            if (profile is IFCSimpleProfile)
            {
                IFCSimpleProfile simpleSweptArea = profile as IFCSimpleProfile;

                IList <CurveLoop> currLoops = GetTransformedCurveLoopsFromSimpleProfile(simpleSweptArea, unscaledLcs, scaledLcs);
                if (currLoops != null && currLoops.Count > 0)
                {
                    loops.Add(currLoops);
                }
            }
            else if (profile is IFCCompositeProfile)
            {
                IFCCompositeProfile compositeSweptArea = profile as IFCCompositeProfile;

                foreach (IFCProfileDef subProfile in compositeSweptArea.Profiles)
                {
                    GetTransformedCurveLoopsFromProfile(subProfile, unscaledLcs, scaledLcs, loops);
                }
            }
            else if (profile is IFCDerivedProfileDef)
            {
                IFCDerivedProfileDef derivedProfileDef = profile as IFCDerivedProfileDef;

                Transform fullUnscaledLCS = unscaledLcs;
                Transform localLCS        = derivedProfileDef.Operator.Transform;
                if (fullUnscaledLCS == null)
                {
                    fullUnscaledLCS = localLCS;
                }
                else if (localLCS != null)
                {
                    fullUnscaledLCS = fullUnscaledLCS.Multiply(localLCS);
                }

                Transform fullScaledLCS = scaledLcs;
                if (fullScaledLCS == null)
                {
                    fullScaledLCS = localLCS;
                }
                else if (localLCS != null)
                {
                    fullScaledLCS = fullScaledLCS.Multiply(localLCS);
                }

                GetTransformedCurveLoopsFromProfile(derivedProfileDef.ParentProfile, fullUnscaledLCS, fullScaledLCS, loops);
            }
            else
            {
                // TODO: Support.
                Importer.TheLog.LogError(Id, "SweptArea Profile #" + profile.Id + " not yet supported.", false);
            }
        }
        override protected void Process(IFCAnyHandle ifcDerivedProfileDef)
        {
            base.Process(ifcDerivedProfileDef);

            IFCAnyHandle ifcParentProfile = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcDerivedProfileDef, "ParentProfile", true);

            ParentProfile = IFCProfileDef.ProcessIFCProfileDef(ifcParentProfile);

            IFCAnyHandle ifcOperator = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcDerivedProfileDef, "Operator", true);

            Operator = IFCCartesianTransformOperator.ProcessIFCCartesianTransformOperator(ifcOperator);

            Label = IFCAnyHandleUtil.GetStringAttribute(ifcDerivedProfileDef, "Label");
        }
        override protected void Process(IFCAnyHandle ifcSurface)
        {
            base.Process(ifcSurface);

            IFCAnyHandle sweptCurve = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcSurface, "SweptCurve", true);

            SweptCurve = IFCProfileDef.ProcessIFCProfileDef(sweptCurve);

            IFCAnyHandle position = IFCImportHandleUtil.GetOptionalInstanceAttribute(ifcSurface, "Position");

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(position))
            {
                Position = Transform.Identity;
            }
            else
            {
                Position = IFCLocation.ProcessIFCAxis2Placement(position);
            }
        }
        override protected void Process(IFCAnyHandle solid)
        {
            base.Process(solid);

            IFCAnyHandle sweptArea = IFCImportHandleUtil.GetRequiredInstanceAttribute(solid, "SweptArea", true);

            SweptArea = IFCProfileDef.ProcessIFCProfileDef(sweptArea);

            IFCAnyHandle location = IFCImportHandleUtil.GetRequiredInstanceAttribute(solid, "Position", false);

            if (location != null)
            {
                Position = IFCLocation.ProcessIFCAxis2Placement(location);
            }
            else
            {
                Position = Transform.Identity;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Return the materials' names and thicknesses if the object is created with IFCMaterialLayerSetUsage information.
        /// The thickness is returned as a string followed by its unit
        /// If the object is not created with IFCMaterialLayerSetUsage information, then only the materials' names are returned
        /// </summary>
        /// <returns>A list in which each entry is the material's names followed by their thicknesses if the thicknesses are available</returns>
        public IList <string> GetMaterialsNamesAndThicknesses()
        {
            IList <string> result = new List <string>();

            string thickness = null;
            string name      = null;

            // If this object is created with IFCMaterialLayerSetUsage information
            // then the material layer thickness will be added after the name of each layer.
            if (MaterialSelect is IFCMaterialLayerSetUsage)
            {
                IFCMaterialLayerSet      materialLayerSet = (MaterialSelect as IFCMaterialLayerSetUsage).MaterialLayerSet;
                IList <IFCMaterialLayer> materialLayers;
                IFCMaterial material;

                if (materialLayerSet != null)
                {
                    materialLayers = materialLayerSet.MaterialLayers;
                }
                else
                {
                    materialLayers = new List <IFCMaterialLayer>();
                }

                foreach (IFCMaterialLayer materialLayer in materialLayers)
                {
                    if (materialLayer == null)
                    {
                        continue;
                    }
                    material = materialLayer.Material;
                    if (material == null || string.IsNullOrWhiteSpace(material.Name))
                    {
                        continue;
                    }
                    name      = material.Name;
                    thickness = IFCUnitUtil.FormatLengthAsString(materialLayer.LayerThickness);
                    result.Add(name + ": " + thickness);
                }
            }
            else if (MaterialSelect is IFCMaterialProfileSetUsage)
            {
                IFCMaterialProfileSet      materialProfileSet = (MaterialSelect as IFCMaterialProfileSetUsage).ForProfileSet;
                IList <IFCMaterialProfile> materialProfiles;
                IFCMaterial material;

                if (materialProfileSet != null)
                {
                    materialProfiles = materialProfileSet.MaterialProfileSet;
                }
                else
                {
                    materialProfiles = new List <IFCMaterialProfile>();
                }

                foreach (IFCMaterialProfile materialProfile in materialProfiles)
                {
                    if (materialProfile == null)
                    {
                        continue; // Skip if it is null
                    }
                    material = materialProfile.Material;
                    IFCProfileDef profile = materialProfile.Profile;
                    if (material == null)
                    {
                        continue;
                    }
                    name = material.Name;
                    string profileName;
                    if (profile != null)
                    {
                        profileName = profile.ProfileName;
                    }
                    else
                    {
                        profileName = profile.ProfileType.ToString();
                    }
                    result.Add(name + " (" + profileName + ")");
                }
            }
            else
            {
                IList <IFCMaterial> materials = GetMaterials();
                foreach (IFCMaterial material in materials)
                {
                    name = material.Name;
                    if (string.IsNullOrWhiteSpace(name))
                    {
                        continue;
                    }

                    result.Add(name);
                }
            }

            return(result);
        }