static private AttributeValue GetAttributeValue(IfcPropertyBoundedValue ifcPropertyBoundedValue)
        {
            var ifcValue = ifcPropertyBoundedValue.LowerBoundValue;

            //only upper and lowwer bounds are supported by COBie on integer and decimal values
            if (ifcValue.UnderlyingSystemType == typeof(int) || ifcValue.UnderlyingSystemType == typeof(long) || ifcValue.UnderlyingSystemType == typeof(short) || ifcValue.UnderlyingSystemType == typeof(byte) ||
                ifcValue.UnderlyingSystemType == typeof(int?) || ifcValue.UnderlyingSystemType == typeof(long?) || ifcValue.UnderlyingSystemType == typeof(short?) || ifcValue.UnderlyingSystemType == typeof(byte?))
            {
                var integerValue = new IntegerAttributeValue();
                if (ifcPropertyBoundedValue.UpperBoundValue != null)
                {
                    integerValue.MaximalValue = Convert.ToInt32(ifcPropertyBoundedValue.UpperBoundValue.Value);
                }
                if (ifcPropertyBoundedValue.LowerBoundValue != null)
                {
                    integerValue.MinimalValue = Convert.ToInt32(ifcPropertyBoundedValue.LowerBoundValue.Value);
                }
                return(integerValue);
            }
            if (ifcValue.UnderlyingSystemType == typeof(double) || ifcValue.UnderlyingSystemType == typeof(float) ||
                ifcValue.UnderlyingSystemType == typeof(double?) || ifcValue.UnderlyingSystemType == typeof(float?))
            {
                var decimalValue = new DecimalAttributeValue();
                if (ifcPropertyBoundedValue.UpperBoundValue != null)
                {
                    decimalValue.MaximalValue = (double)ifcPropertyBoundedValue.UpperBoundValue.Value;
                }
                if (ifcPropertyBoundedValue.LowerBoundValue != null)
                {
                    decimalValue.MinimalValue = (double)ifcPropertyBoundedValue.LowerBoundValue.Value;
                }
                return(decimalValue);
            }
            return(null);
        }
        static private AttributeValueType GetAttributeValue(IfcPropertyBoundedValue ifcPropertyBoundedValue)
        {
            var      attributeValueType = new AttributeValueType();
            IfcValue ifcValue           = ifcPropertyBoundedValue.LowerBoundValue;

            //only upper and lowwer bounds are supported by COBie on integer and decimal values
            if (ifcValue.UnderlyingSystemType == typeof(int) || ifcValue.UnderlyingSystemType == typeof(long) || ifcValue.UnderlyingSystemType == typeof(short) || ifcValue.UnderlyingSystemType == typeof(byte) ||
                ifcValue.UnderlyingSystemType == typeof(int?) || ifcValue.UnderlyingSystemType == typeof(long?) || ifcValue.UnderlyingSystemType == typeof(short?) || ifcValue.UnderlyingSystemType == typeof(byte?))
            {
                var integerValue = new AttributeIntegerValueType();
                if (ifcPropertyBoundedValue.UpperBoundValue != null)
                {
                    integerValue.MaxValueInteger = Convert.ToInt32(ifcPropertyBoundedValue.UpperBoundValue.Value);
                }
                if (ifcPropertyBoundedValue.LowerBoundValue != null)
                {
                    integerValue.MinValueInteger = Convert.ToInt32(ifcPropertyBoundedValue.LowerBoundValue.Value);
                }
                attributeValueType.Item            = integerValue;
                attributeValueType.ItemElementName = ItemChoiceType.AttributeIntegerValue;
            }
            else if (ifcValue.UnderlyingSystemType == typeof(double) || ifcValue.UnderlyingSystemType == typeof(float) ||
                     ifcValue.UnderlyingSystemType == typeof(double?) || ifcValue.UnderlyingSystemType == typeof(float?))
            {
                var decimalValue = new AttributeDecimalValueType();
                if (ifcPropertyBoundedValue.UpperBoundValue != null)
                {
                    decimalValue.MaxValueDecimal          = (double)ifcPropertyBoundedValue.UpperBoundValue.Value;
                    decimalValue.MaxValueDecimalSpecified = true;
                }
                if (ifcPropertyBoundedValue.LowerBoundValue != null)
                {
                    decimalValue.MinValueDecimal          = (double)ifcPropertyBoundedValue.LowerBoundValue.Value;
                    decimalValue.MinValueDecimalSpecified = true;
                }
                attributeValueType.Item            = decimalValue;
                attributeValueType.ItemElementName = ItemChoiceType.AttributeDecimalValue;
            }
            else
            {
                attributeValueType = null;
            }

            return(attributeValueType);
        }
Example #3
0
        private static void CreateSimpleProperty(XbimModel model, IfcWallStandardCase wall, IfcOwnerHistory ifcOwnerHistory)
        {
            IfcPropertySingleValue ifcPropertySingleValue = model.Instances.New <IfcPropertySingleValue>(psv =>
            {
                psv.Name         = "IfcPropertySingleValue:Time";
                psv.Description  = "";
                psv.NominalValue = new IfcTimeMeasure(150.0);
                psv.Unit         = model.Instances.New <IfcSIUnit>(siu =>
                {
                    siu.UnitType   = IfcUnitEnum.TIMEUNIT;
                    siu.Name       = IfcSIUnitName.SECOND;
                    siu.Dimensions = model.Instances.New <IfcDimensionalExponents>(de =>
                    {
                        de.LengthExponent                   = 0;
                        de.MassExponent                     = 0;
                        de.TimeExponent                     = 1;
                        de.ElectricCurrentExponent          = 0;
                        de.ThermodynamicTemperatureExponent = 0;
                        de.AmountOfSubstanceExponent        = 0;
                        de.LuminousIntensityExponent        = 0;
                    });
                });
            });
            IfcPropertyEnumeratedValue ifcPropertyEnumeratedValue = model.Instances.New <IfcPropertyEnumeratedValue>(pev =>
            {
                pev.Name = "IfcPropertyEnumeratedValue:Music";
                pev.EnumerationReference = model.Instances.New <IfcPropertyEnumeration>(pe =>
                {
                    pe.Name = "Notes";
                    pe.EnumerationValues.Add(new IfcLabel("Do"));
                    pe.EnumerationValues.Add(new IfcLabel("Re"));
                    pe.EnumerationValues.Add(new IfcLabel("Mi"));
                    pe.EnumerationValues.Add(new IfcLabel("Fa"));
                    pe.EnumerationValues.Add(new IfcLabel("So"));
                    pe.EnumerationValues.Add(new IfcLabel("La"));
                    pe.EnumerationValues.Add(new IfcLabel("Ti"));
                });
                pev.EnumerationValues.Add(new IfcLabel("Do"));
                pev.EnumerationValues.Add(new IfcLabel("Re"));
                pev.EnumerationValues.Add(new IfcLabel("Mi"));
            });
            IfcPropertyBoundedValue ifcPropertyBoundedValue = model.Instances.New <IfcPropertyBoundedValue>(pbv =>
            {
                pbv.Name            = "IfcPropertyBoundedValue:Mass";
                pbv.Description     = "";
                pbv.UpperBoundValue = new IfcMassMeasure(5000.0);
                pbv.LowerBoundValue = new IfcMassMeasure(1000.0);
                pbv.Unit            = model.Instances.New <IfcSIUnit>(siu =>
                {
                    siu.UnitType   = IfcUnitEnum.MASSUNIT;
                    siu.Name       = IfcSIUnitName.GRAM;
                    siu.Prefix     = IfcSIPrefix.KILO;
                    siu.Dimensions = model.Instances.New <IfcDimensionalExponents>(de =>
                    {
                        de.LengthExponent                   = 0;
                        de.MassExponent                     = 1;
                        de.TimeExponent                     = 0;
                        de.ElectricCurrentExponent          = 0;
                        de.ThermodynamicTemperatureExponent = 0;
                        de.AmountOfSubstanceExponent        = 0;
                        de.LuminousIntensityExponent        = 0;
                    });
                });
            });

            List <IfcReal> definingValues = new List <IfcReal>()
            {
                new IfcReal(100.0), new IfcReal(200.0), new IfcReal(400.0), new IfcReal(800.0), new IfcReal(1600.0), new IfcReal(3200.0),
            };
            List <IfcReal> definedValues = new List <IfcReal>()
            {
                new IfcReal(20.0), new IfcReal(42.0), new IfcReal(46.0), new IfcReal(56.0), new IfcReal(60.0), new IfcReal(65.0),
            };
            IfcPropertyTableValue ifcPropertyTableValue = model.Instances.New <IfcPropertyTableValue>(ptv =>
            {
                ptv.Name = "IfcPropertyTableValue:Sound";
                foreach (var item in definingValues)
                {
                    ptv.DefiningValues.Add(item);
                }
                foreach (var item in definedValues)
                {
                    ptv.DefinedValues.Add(item);
                }
                ptv.DefinedUnit = model.Instances.New <IfcContextDependentUnit>(cd =>
                {
                    cd.Dimensions = model.Instances.New <IfcDimensionalExponents>(de =>
                    {
                        de.LengthExponent                   = 0;
                        de.MassExponent                     = 0;
                        de.TimeExponent                     = 0;
                        de.ElectricCurrentExponent          = 0;
                        de.ThermodynamicTemperatureExponent = 0;
                        de.AmountOfSubstanceExponent        = 0;
                        de.LuminousIntensityExponent        = 0;
                    });
                    cd.UnitType = IfcUnitEnum.FREQUENCYUNIT;
                    cd.Name     = "dB";
                });
            });

            List <IfcLabel> listValues = new List <IfcLabel>()
            {
                new IfcLabel("Red"), new IfcLabel("Green"), new IfcLabel("Blue"), new IfcLabel("Pink"), new IfcLabel("White"), new IfcLabel("Black"),
            };
            IfcPropertyListValue ifcPropertyListValue = model.Instances.New <IfcPropertyListValue>(plv =>
            {
                plv.Name = "IfcPropertyListValue:Colours";
                foreach (var item in listValues)
                {
                    plv.ListValues.Add(item);
                }
            });

            IfcMaterial IfcMaterial = model.Instances.New <IfcMaterial>(m =>
            {
                m.Name = "Brick";
            });
            IfcPropertyReferenceValue ifcPRValueMaterial = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:Material";
                prv.PropertyReference = IfcMaterial;
            });

            IfcPropertyReferenceValue ifcPRValuePerson = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:Person";
                prv.PropertyReference = ifcOwnerHistory.OwningUser.ThePerson;
            });

            IfcDateAndTime ifcDateAndTime = model.Instances.New <IfcDateAndTime>(dt =>
            {
                dt.DateComponent = model.Instances.New <IfcCalendarDate>(cd =>
                {
                    cd.DayComponent   = 25;
                    cd.MonthComponent = 3;
                    cd.YearComponent  = 2013;
                });
                dt.TimeComponent = model.Instances.New <IfcLocalTime>(lt =>
                {
                    lt.HourComponent   = 10;
                    lt.MinuteComponent = 30;
                    lt.SecondComponent = 0;
                });
            });
            IfcPropertyReferenceValue ifcPRValueDateTime = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:DateAndTime";
                prv.PropertyReference = ifcDateAndTime;
            });

            IfcMaterialList ifcMaterialList = model.Instances.New <IfcMaterialList>(ml =>
            {
                ml.Materials.Add(IfcMaterial);
                ml.Materials.Add(model.Instances.New <IfcMaterial>(m => { m.Name = "Cavity"; }));
                ml.Materials.Add(model.Instances.New <IfcMaterial>(m => { m.Name = "Block"; }));
            });
            IfcPropertyReferenceValue ifcPRValueMatList = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:MaterialList";
                prv.PropertyReference = ifcMaterialList;
            });

            IfcPropertyReferenceValue ifcPRValueOrg = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:Organization";
                prv.PropertyReference = ifcOwnerHistory.OwningUser.TheOrganization;
            });

            IfcPropertyReferenceValue ifcPRValueDate = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:Date";
                prv.PropertyReference = ifcDateAndTime.DateComponent;
            });

            IfcPropertyReferenceValue ifcPRValueTime = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:Time";
                prv.PropertyReference = ifcDateAndTime.TimeComponent;
            });

            IfcPropertyReferenceValue ifcPRValuePersonOrg = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:PersonOrganization";
                prv.PropertyReference = ifcOwnerHistory.OwningUser;
            });

            IfcMaterialLayer ifcMaterialLayer = model.Instances.New <IfcMaterialLayer>(ml =>
            {
                ml.Material       = IfcMaterial;
                ml.LayerThickness = 100.0;
            });
            IfcPropertyReferenceValue ifcPRValueMatLayer = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:MaterialLayer";
                prv.PropertyReference = ifcMaterialLayer;
            });

            IfcDocumentReference ifcDocumentReference = model.Instances.New <IfcDocumentReference>(dr =>
            {
                dr.Name     = "Document";
                dr.Location = "c://Documents//TheDoc.Txt";
            });
            IfcPropertyReferenceValue ifcPRValueRef = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:Document";
                prv.PropertyReference = ifcDocumentReference;
            });

            IfcRegularTimeSeries ifcTimeSeries = model.Instances.New <IfcRegularTimeSeries>(ts =>
            {
                ts.Name        = "Regular Time Series";
                ts.Description = "Time series of events";
                ts.StartTime   = model.Instances.New <IfcCalendarDate>(cd =>
                {
                    cd.DayComponent   = 01;
                    cd.MonthComponent = 1;
                    cd.YearComponent  = 2013;
                });
                ts.EndTime = model.Instances.New <IfcCalendarDate>(cd =>
                {
                    cd.DayComponent   = 01;
                    cd.MonthComponent = 3;
                    cd.YearComponent  = 2013;
                });
                ts.TimeSeriesDataType = IfcTimeSeriesDataTypeEnum.CONTINUOUS;
                ts.DataOrigin         = IfcDataOriginEnum.MEASURED;
                ts.TimeStep           = 604800; //7 days in secs
            });

            IfcPropertyReferenceValue ifcPRValueTimeSeries = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:TimeSeries";
                prv.PropertyReference = ifcTimeSeries;
            });

            IfcPostalAddress ifcAddress = model.Instances.New <IfcPostalAddress>(a =>
            {
                a.InternalLocation = "Room 101";
                a.SetAddressLines(new string[] { "12 New road", "DoxField" });
                a.Town       = "Sunderland";
                a.PostalCode = "DL01 6SX";
            });
            IfcPropertyReferenceValue ifcPRValueAddress = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:Address";
                prv.PropertyReference = ifcAddress;
            });
            IfcTelecomAddress IfcTelecomAddress = model.Instances.New <IfcTelecomAddress>(a =>
            {
                a.SetTelephoneNumbers(new string[] { "01325 6589965" });
                a.SetElectronicMailAddress(new string[] { "*****@*****.**" });
            });
            IfcPropertyReferenceValue ifcPRValueTelecom = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:Telecom";
                prv.PropertyReference = IfcTelecomAddress;
            });

            IfcCostValue ifcCostValue = model.Instances.New <IfcCostValue>(cv =>
            {
                cv.Name           = "Cost Value";
                cv.Description    = "";
                cv.Value          = new IfcMonetaryMeasure(155.0);
                cv.ApplicableDate = model.Instances.New <IfcCalendarDate>(cd =>
                {
                    cd.DayComponent   = 02;
                    cd.MonthComponent = 02;
                    cd.YearComponent  = 2013;
                });
                cv.FixedUntilDate = model.Instances.New <IfcCalendarDate>(cd =>
                {
                    cd.DayComponent   = 31;
                    cd.MonthComponent = 12;
                    cd.YearComponent  = 2013;
                });
                cv.CostType  = "Annual rate of return";
                cv.Condition = "";
            });
            IfcPropertyReferenceValue ifcPRValueCostValue = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:CostValue";
                prv.PropertyReference = ifcCostValue;
            });


            IfcEnvironmentalImpactValue IfcEnvironmentalImpactValue = model.Instances.New <IfcEnvironmentalImpactValue>(cv =>
            {
                cv.Name        = "Environmental Impact";
                cv.Description = "";
                cv.Value       = model.Instances.New <IfcMeasureWithUnit>(mwu =>
                {
                    mwu.ValueComponent = new IfcReal(111.0);
                    mwu.UnitComponent  = model.Instances.New <IfcSIUnit>(siu =>
                    {
                        siu.UnitType   = IfcUnitEnum.LENGTHUNIT;
                        siu.Name       = IfcSIUnitName.METRE;
                        siu.Dimensions = model.Instances.New <IfcDimensionalExponents>(de =>
                        {
                            de.LengthExponent                   = 1;
                            de.MassExponent                     = 0;
                            de.TimeExponent                     = 0;
                            de.ElectricCurrentExponent          = 0;
                            de.ThermodynamicTemperatureExponent = 0;
                            de.AmountOfSubstanceExponent        = 0;
                            de.LuminousIntensityExponent        = 0;
                        });
                    });
                });
                cv.ApplicableDate = model.Instances.New <IfcCalendarDate>(cd =>
                {
                    cd.DayComponent   = 02;
                    cd.MonthComponent = 02;
                    cd.YearComponent  = 2013;
                });
                cv.FixedUntilDate = model.Instances.New <IfcCalendarDate>(cd =>
                {
                    cd.DayComponent   = 31;
                    cd.MonthComponent = 12;
                    cd.YearComponent  = 2013;
                });
                cv.ImpactType = "Embodied energy";
                cv.Category   = IfcEnvironmentalImpactCategoryEnum.MANUFACTURE;
            });
            IfcPropertyReferenceValue ifcPRValueEnvironmentalImpact = model.Instances.New <IfcPropertyReferenceValue>(prv =>
            {
                prv.Name = "IfcPropertyReferenceValue:EnvironmentalImpact";
                prv.PropertyReference = IfcEnvironmentalImpactValue;
            });

            //lets create the IfcElementQuantity
            IfcPropertySet ifcPropertySet = model.Instances.New <IfcPropertySet>(ps =>
            {
                ps.OwnerHistory = ifcOwnerHistory;
                ps.Name         = "Test:IfcPropertySet";
                ps.Description  = "Property Set";
                ps.HasProperties.Add(ifcPropertySingleValue);
                ps.HasProperties.Add(ifcPropertyEnumeratedValue);
                ps.HasProperties.Add(ifcPropertyBoundedValue);
                ps.HasProperties.Add(ifcPropertyTableValue);
                ps.HasProperties.Add(ifcPropertyListValue);
                ps.HasProperties.Add(ifcPRValueMaterial);
                ps.HasProperties.Add(ifcPRValuePerson);
                ps.HasProperties.Add(ifcPRValueDateTime);
                ps.HasProperties.Add(ifcPRValueMatList);
                ps.HasProperties.Add(ifcPRValueOrg);
                ps.HasProperties.Add(ifcPRValueDate);
                ps.HasProperties.Add(ifcPRValueTime);
                ps.HasProperties.Add(ifcPRValuePersonOrg);
                ps.HasProperties.Add(ifcPRValueMatLayer);
                ps.HasProperties.Add(ifcPRValueRef);
                ps.HasProperties.Add(ifcPRValueTimeSeries);
                ps.HasProperties.Add(ifcPRValueAddress);
                ps.HasProperties.Add(ifcPRValueTelecom);
                ps.HasProperties.Add(ifcPRValueCostValue);
                ps.HasProperties.Add(ifcPRValueEnvironmentalImpact);
            });

            //need to create the relationship
            IfcRelDefinesByProperties ifcRelDefinesByProperties = model.Instances.New <IfcRelDefinesByProperties>(rdbp =>
            {
                rdbp.OwnerHistory = ifcOwnerHistory;
                rdbp.Name         = "Property Association";
                rdbp.Description  = "IfcPropertySet associated to wall";
                rdbp.RelatedObjects.Add(wall);
                rdbp.RelatingPropertyDefinition = ifcPropertySet;
            });
        }
Example #4
0
        /// <summary>
        /// Add Rows to the attribute sheet
        /// </summary>
        /// <param name="_attributes">The attribute Sheet to add the properties to its rows</param>
        /// <param name="propertySet">IfcPropertySet which is holding the IfcPropertySingleValue</param>
        /// <param name="propertySetValues">IEnumerable list of IfcPropertySingleValue to extract to the attribute sheet</param>
        private void ProcessAttributeRow(IfcPropertySet propertySet, IEnumerable <IfcSimpleProperty> propertySetValues)
        {
            //construct the rows
            foreach (IfcSimpleProperty propertySetSimpleProperty in propertySetValues)
            {
                if (propertySetSimpleProperty != null)
                {
                    string value         = "";
                    string name          = propertySetSimpleProperty.Name.ToString();
                    string extIdentifier = null;
                    string extObject     = null;



                    if (string.IsNullOrEmpty(name))
                    {
#if DEBUGATT
                        Console.WriteLine("Excluded attribute has no name");
#endif

                        continue; //skip to next loop item
                    }

                    IEnumerable <COBieAttributeRow> TestRow = _attributes.Rows.Where(r => r.Name == name && r.SheetName == RowParameters["Sheet"] && r.RowName == RowParameters["Name"]);
                    if (TestRow.Any())
                    {
                        continue;                //skip to next loop item
                    }
                    //check what type we of property we have
                    IfcPropertySingleValue ifcPropertySingleValue = propertySetSimpleProperty as IfcPropertySingleValue;
                    //get value
                    if (ifcPropertySingleValue != null)
                    {
                        if (ifcPropertySingleValue.NominalValue != null)
                        {
                            value = ifcPropertySingleValue.NominalValue.Value != null?ifcPropertySingleValue.NominalValue.Value.ToString() : string.Empty;

                            double num;
                            if (double.TryParse(value, out num))
                            {
                                value = num.ToString("F3");
                            }
                            if ((string.IsNullOrEmpty(value)) || (string.Compare(value, ifcPropertySingleValue.Name.ToString(), true) == 0) || (string.Compare(value, "default", true) == 0))
                            {
#if DEBUGATT
                                Console.WriteLine("Excluded attribute {0}, has no value", name);
#endif
                                continue; //skip to next loop item
                            }
                        }
                    }

                    COBieAttributeRow attribute = new COBieAttributeRow(_attributes);
                    attribute.Unit          = Constants.DEFAULT_STRING; //set initially to default, saves the else statements
                    attribute.AllowedValues = Constants.DEFAULT_STRING;
                    attribute.Description   = Constants.DEFAULT_STRING;

                    if (ifcPropertySingleValue != null) //as we can skip on ifcPropertySingleValue we need to split ifcPropertySingleValue testing
                    {
                        if ((ifcPropertySingleValue.Unit != null))
                        {
                            attribute.Unit = COBieData <COBieAttributeRow> .GetUnitName(ifcPropertySingleValue.Unit);
                        }
                    }

                    //Process properties that are not IfcPropertySingleValue
                    IfcPropertyEnumeratedValue ifcPropertyEnumeratedValue = propertySetSimpleProperty as IfcPropertyEnumeratedValue;
                    if (ifcPropertyEnumeratedValue != null)
                    {
                        string EnumValuesHeld = "";
                        if (ifcPropertyEnumeratedValue.EnumerationValues != null)
                        {
                            value = COBieData <COBieAttributeRow> .GetEnumerationValues(ifcPropertyEnumeratedValue.EnumerationValues);
                        }

                        //get  the unit and all possible values held in the Enumeration
                        if (ifcPropertyEnumeratedValue.EnumerationReference != null)
                        {
                            if (ifcPropertyEnumeratedValue.EnumerationReference.Unit != null)
                            {
                                attribute.Unit = COBieData <COBieAttributeRow> .GetUnitName(ifcPropertyEnumeratedValue.EnumerationReference.Unit);
                            }
                            EnumValuesHeld = COBieData <COBieAttributeRow> .GetEnumerationValues(ifcPropertyEnumeratedValue.EnumerationReference.EnumerationValues);

                            if (!string.IsNullOrEmpty(EnumValuesHeld))
                            {
                                attribute.AllowedValues = EnumValuesHeld;
                            }
                        }
                        //change the extIdentifier to the property set name and extObject to the property type
                        extIdentifier = propertySet.Name;
                        extObject     = propertySetSimpleProperty.GetType().Name;
                    }

                    IfcPropertyBoundedValue ifcPropertyBoundedValue = propertySetSimpleProperty as IfcPropertyBoundedValue;
                    if (ifcPropertyBoundedValue != null)
                    {
                        //combine upper and lower into the value field
                        if (ifcPropertyBoundedValue.UpperBoundValue != null)
                        {
                            value = ifcPropertyBoundedValue.UpperBoundValue.ToString();
                        }
                        if (ifcPropertyBoundedValue.LowerBoundValue != null)
                        {
                            if (!string.IsNullOrEmpty(value))
                            {
                                value += " : " + ifcPropertyBoundedValue.LowerBoundValue.ToString();
                            }
                            else
                            {
                                value = ifcPropertyBoundedValue.LowerBoundValue.ToString();
                            }
                        }

                        if ((ifcPropertyBoundedValue.Unit != null))
                        {
                            attribute.Unit = COBieData <COBieAttributeRow> .GetUnitName(ifcPropertyBoundedValue.Unit);
                        }
                        //change the extIdentifier to the property set name and extObject to the property type
                        extIdentifier = propertySet.Name;
                        extObject     = propertySetSimpleProperty.GetType().Name;
                    }

                    IfcPropertyTableValue ifcPropertyTableValue = propertySetSimpleProperty as IfcPropertyTableValue;
                    if (ifcPropertyTableValue != null)
                    {
                        if ((ifcPropertyTableValue.DefiningValues != null) &&
                            (ifcPropertyTableValue.DefinedValues != null) &&
                            (ifcPropertyTableValue.DefiningValues.Count() == ifcPropertyTableValue.DefinedValues.Count())
                            )
                        {
                            StringBuilder cellValue = new StringBuilder();
                            int           i         = 0;
                            foreach (var item in ifcPropertyTableValue.DefiningValues)
                            {
                                cellValue.Append("(");
                                cellValue.Append(item.ToString());
                                cellValue.Append(":");
                                cellValue.Append(ifcPropertyTableValue.DefinedValues[i].ToString());
                                cellValue.Append(")");
                                i++;
                            }
                            value = cellValue.ToString();
                            //get the unit definition
                            string cellUnit = "";
                            if (ifcPropertyTableValue.DefiningUnit != null)
                            {
                                cellUnit = COBieData <COBieAttributeRow> .GetUnitName(ifcPropertyTableValue.DefiningUnit);
                            }
                            else
                            {
                                cellUnit = "Unknown";
                            }
                            cellUnit += ":";
                            if (ifcPropertyTableValue.DefinedUnit != null)
                            {
                                cellUnit += COBieData <COBieAttributeRow> .GetUnitName(ifcPropertyTableValue.DefinedUnit);
                            }
                            else
                            {
                                cellUnit += "Unknown";
                            }
                            attribute.Unit = cellUnit;
                            if (!string.IsNullOrEmpty(ifcPropertyTableValue.Expression))
                            {
                                attribute.AllowedValues = ifcPropertyTableValue.Expression;
                            }
                        }
                        else
                        {
                            throw new ArgumentException("ProcessAttributeRow: IfcPropertyTableValue has unequal column numbers");
                        }
                        //change the extIdentifier to the property set name and extObject to the property type
                        extIdentifier = propertySet.Name;
                        extObject     = propertySetSimpleProperty.GetType().Name;
                    }

                    IfcPropertyReferenceValue ifcPropertyReferenceValue = propertySetSimpleProperty as IfcPropertyReferenceValue;
                    if (ifcPropertyReferenceValue != null)
                    {
                        if (ifcPropertyReferenceValue.UsageName != null)
                        {
                            attribute.Description = (string.IsNullOrEmpty(ifcPropertyReferenceValue.UsageName.ToString())) ? Constants.DEFAULT_STRING : ifcPropertyReferenceValue.UsageName.ToString();
                        }

                        if (ifcPropertyReferenceValue.PropertyReference != null)
                        {
                            value          = ifcPropertyReferenceValue.PropertyReference.ToString();
                            attribute.Unit = ifcPropertyReferenceValue.PropertyReference.GetType().Name;
                        }
                    }
                    IfcPropertyListValue ifcPropertyListValue = propertySetSimpleProperty as IfcPropertyListValue;
                    if (ifcPropertyListValue != null)
                    {
                        if (ifcPropertyListValue.ListValues != null)
                        {
                            value = COBieData <COBieAttributeRow> .GetEnumerationValues(ifcPropertyListValue.ListValues);
                        }

                        //get  the unit and all possible values held in the Enumeration
                        if (ifcPropertyListValue.Unit != null)
                        {
                            attribute.Unit = COBieData <COBieAttributeRow> .GetUnitName(ifcPropertyListValue.Unit);
                        }

                        //change the extIdentifier to the property set name and extObject to the property type
                        extIdentifier = propertySet.Name;
                        extObject     = propertySetSimpleProperty.GetType().Name;
                    }


                    attribute.Name = propertySetSimpleProperty.Name.ToString();

                    //Get category
                    string cat = GetCategory(propertySet);
                    attribute.Category = (cat == Constants.DEFAULT_STRING) ? "Requirement" : cat;

                    attribute.ExtIdentifier = string.IsNullOrEmpty(extIdentifier) ? propertySet.GlobalId.ToString() : extIdentifier;
                    if (string.IsNullOrEmpty(attribute.ExtIdentifier))
                    {
                        attribute.ExtIdentifier = Constants.DEFAULT_STRING;
                    }

                    attribute.ExtObject = string.IsNullOrEmpty(extObject) ? propertySet.Name.ToString() : extObject;
                    if (string.IsNullOrEmpty(attribute.ExtObject))
                    {
                        attribute.ExtObject = Constants.DEFAULT_STRING;
                    }

                    //passed properties from the sheet
                    attribute.SheetName = RowParameters["Sheet"];
                    attribute.RowName   = RowParameters["Name"];
                    string createdBy = COBieData <COBieAttributeRow> .GetEmail(propertySet.OwnerHistory.OwningUser.TheOrganization, propertySet.OwnerHistory.OwningUser.ThePerson);

                    attribute.CreatedBy = (createdBy.Contains("unknown")) ? RowParameters["CreatedBy"] : createdBy; //check for incorrect made up email, if so then use parent CreatedBy
                    string onDate = COBieData <COBieAttributeRow> .GetCreatedOnDate(propertySet.OwnerHistory);

                    attribute.CreatedOn = (string.IsNullOrEmpty(onDate)) ? RowParameters["CreatedOn"] : onDate;
                    attribute.ExtSystem = (propertySet.OwnerHistory.OwningApplication != null) ? propertySet.OwnerHistory.OwningApplication.ApplicationFullName.ToString() : RowParameters["ExtSystem"];
                    if (string.IsNullOrEmpty(attribute.ExtSystem))
                    {
                        attribute.ExtSystem = Constants.DEFAULT_STRING;
                    }

                    //value = NumberValueCheck(value, attribute);
                    attribute.Value = string.IsNullOrEmpty(value) ? Constants.DEFAULT_STRING : value;

                    attribute.Description = propertySetSimpleProperty.Description.ToString();
                    if (string.IsNullOrEmpty(attribute.Description)) //if no description then just use name property
                    {
                        attribute.Description = attribute.Name;
                    }

                    _attributes.AddRow(attribute);
                }
            }
        }
        /// <summary>
        /// Get the IfcPropertyBoundedValue values as a string
        /// </summary>
        /// <param name="ifcPropertyBoundedValue">IfcPropertyBoundedValue object</param>
        /// <param name="ifcGlobalUnits">global unit dictionary</param>
        /// <returns>string</returns>
        public static string FormatePropertyValue(IfcPropertyBoundedValue ifcPropertyBoundedValue, ConcurrentDictionary<string, string> ifcGlobalUnits)
        {
            string lowervalue = string.Empty;
            string uppervalue = string.Empty;
            bool moneyUnit = false;

            string unit = GetUnitAbbreviation(ifcPropertyBoundedValue.Unit, ifcGlobalUnits);
            if (ifcPropertyBoundedValue.Unit is IfcMonetaryUnit)
                moneyUnit = true;

            if (ifcPropertyBoundedValue.LowerBoundValue != null)
                lowervalue = FormatIfcValue(ifcPropertyBoundedValue.LowerBoundValue, unit, moneyUnit);
            else
                lowervalue = "unknown";
            if (ifcPropertyBoundedValue.UpperBoundValue != null)
                uppervalue = FormatIfcValue(ifcPropertyBoundedValue.UpperBoundValue, unit, moneyUnit);
            else
                uppervalue = "unknown";
            return lowervalue + "(lower) : " + uppervalue + "(upper)";
        }