コード例 #1
0
        internal override void ParseXml(XmlElement xml)
        {
            base.ParseXml(xml);
            if (xml.HasAttribute("Name"))
            {
                Name = xml.Attributes["Name"].Value;
            }
            if (xml.HasAttribute("Description"))
            {
                Description = xml.Attributes["Description"].Value;
            }

            foreach (XmlNode child in xml.ChildNodes)
            {
                string name = child.Name;
                if (string.Compare(name, "Representations") == 0)
                {
                    foreach (XmlNode cn in child.ChildNodes)
                    {
                        IfcRepresentation r = mDatabase.ParseXml <IfcRepresentation>(cn as XmlElement);
                        if (r != null)
                        {
                            Representations.Add(r);
                        }
                    }
                }
            }
        }
コード例 #2
0
        /// <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);
                    }
                }
            }
        }
コード例 #3
0
 public void AddRepresentation(SCIMRepresentation representation)
 {
     Representations.Add(representation);
 }