Exemplo n.º 1
0
        /// <summary>
        /// Returns the first quantity that matches the quantity name
        /// </summary>
        /// <typeparam name="TQType"></typeparam>
        /// <param name="qName"></param>
        /// <returns></returns>
        public TQType GetQuantity <TQType>(string qName) where TQType : Ifc4.Interfaces.IIfcPhysicalQuantity
        {
            var rel = IsDefinedByProperties.FirstOrDefault(r => r.RelatingPropertyDefinition is Ifc4.Interfaces.IIfcElementQuantity);

            if (rel == null)
            {
                return(default(TQType));
            }
            var eQ = rel.RelatingPropertyDefinition as Ifc4.Interfaces.IIfcElementQuantity;

            return(eQ != null?eQ.Quantities.OfType <TQType>().FirstOrDefault(q => q.Name == qName) : default(TQType));
        }
Exemplo n.º 2
0
        public Ifc4.Interfaces.IIfcElementQuantity GetElementQuantity(string pSetName, bool caseSensitive = true)
        {
            IfcRelDefinesByProperties rel = caseSensitive ?
                                            IsDefinedByProperties.FirstOrDefault(r => r.RelatingPropertyDefinition.Name == pSetName && r.RelatingPropertyDefinition is Ifc4.Interfaces.IIfcElementQuantity)
                : IsDefinedByProperties.FirstOrDefault(r => r.RelatingPropertyDefinition.Name.ToString().ToLower() == pSetName.ToLower() && r.RelatingPropertyDefinition is Ifc4.Interfaces.IIfcElementQuantity);

            if (rel != null)
            {
                return(rel.RelatingPropertyDefinition as Ifc4.Interfaces.IIfcElementQuantity);
            }
            return(null);
        }