Ejemplo n.º 1
0
        public Requirement(IIfcPropertyTemplate property, IIfcPropertySetTemplate set) : base(property)
        {
            // set might be null, it the requirement is assigned directly, not through a set
            SetName       = set?.Name;
            SetIdentifier = set.GetName(lang) ?? SetName;

            if (property is IIfcSimplePropertyTemplate simple)
            {
                DataType  = simple.PrimaryMeasureType?.Value.ToString();
                ValueType = simple.TemplateType?.ToString();

                if (simple.PrimaryUnit != null)
                {
                    Units = Unit.GetSymbol(simple.PrimaryUnit);
                }
                else
                {
                    Units = string.Empty;
                }

                if (simple.Enumerators != null)
                {
                    Enumeration = simple.Enumerators.EnumerationValues.Select(v => v.Value.ToString()).ToList();
                }
            }
            else
            {
                throw new NotSupportedException("Only simple property templates are supported.");
            }
        }
Ejemplo n.º 2
0
 public RequirementSet(IIfcPropertySetTemplate template) : base(template)
 {
     if (template.HasPropertyTemplates.Count > 0)
     {
         Requirements = template.HasPropertyTemplates
                        .Select(p => new Requirement(p, template))
                        .ToList();
     }
 }