/// <summary>
        /// Processes IfcProductRepresentation attributes.
        /// </summary>
        /// <param name="ifcProductRepresentation">The IfcProductRepresentation handle.</param>
        protected override void Process(IFCAnyHandle ifcProductRepresentation)
        {
            base.Process(ifcProductRepresentation);

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

            Description = IFCImportHandleUtil.GetOptionalStringAttribute(ifcProductRepresentation, "Description", null);

            List <IFCAnyHandle> representations =
                IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcProductRepresentation, "Representations");

            if (representations != null)
            {
                foreach (IFCAnyHandle representationHnd in representations)
                {
                    try
                    {
                        IFCRepresentation representation = IFCRepresentation.ProcessIFCRepresentation(representationHnd);
                        if (representation != null)
                        {
                            if (representation.RepresentationItems.Count > 0 || representation.BoundingBox != null)
                            {
                                Representations.Add(representation);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        string msg = ex.Message;
                        // Ignore some specific errors.
                        if (msg != null)
                        {
                            if (!msg.Contains("not imported"))
                            {
                                Importer.TheLog.LogError(Id, msg, false);
                            }
                        }
                    }
                }
            }

            if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC2x3)
            {
                if (IFCAnyHandleUtil.IsSubTypeOf(ifcProductRepresentation, IFCEntityType.IfcMaterialDefinitionRepresentation))
                {
                    IFCAnyHandle representedMaterial = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcProductRepresentation, "RepresentedMaterial", false);
                    if (!IFCAnyHandleUtil.IsNullOrHasNoValue(representedMaterial))
                    {
                        RepresentedMaterial = IFCMaterial.ProcessIFCMaterial(representedMaterial);
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Processes IfcRepresentationMap attributes.
        /// </summary>
        /// <param name="ifcRepresentationMap">The IfcRepresentationMap handle.</param>
        protected override void Process(IFCAnyHandle ifcRepresentationMap)
        {
            base.Process(ifcRepresentationMap);

            IFCAnyHandle mappingOrigin = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcRepresentationMap, "MappingOrigin", false);

            if (mappingOrigin != null)
            {
                MappingOrigin = IFCLocation.ProcessIFCAxis2Placement(mappingOrigin);
            }
            else
            {
                MappingOrigin = Transform.Identity;
            }

            IFCAnyHandle mappedRepresentation = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcRepresentationMap, "MappedRepresentation", false);

            if (mappedRepresentation != null)
            {
                MappedRepresentation = IFCRepresentation.ProcessIFCRepresentation(mappedRepresentation);
            }
        }