コード例 #1
0
        public static string GetAsString(this IfcTimeSeries ifcTimeSeries)
        {
            StringBuilder timeSeries = new StringBuilder();
            string        start      = ifcTimeSeries.StartTime.GetAsString();

            if (!string.IsNullOrEmpty(start))
            {
                timeSeries.Append("Start:");
                timeSeries.Append(start);
                timeSeries.Append(", ");
            }
            string end = ifcTimeSeries.EndTime.GetAsString();

            if (!string.IsNullOrEmpty(end))
            {
                timeSeries.Append("End:");
                timeSeries.Append(end);
                timeSeries.Append(", ");
            }

            if (ifcTimeSeries is IfcRegularTimeSeries)
            {
                IfcRegularTimeSeries ifcRegularTimeSeries = (ifcTimeSeries as IfcRegularTimeSeries);
                timeSeries.Append("TimeStep:");
                timeSeries.Append(string.Format("{0,0:N2}", ifcRegularTimeSeries.TimeStep.Value));

                //Values field is private?
            }
            if (ifcTimeSeries is IfcIrregularTimeSeries)
            {
                //Values field is private?
            }

            return(timeSeries.ToString());
        }
コード例 #2
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;
            });
        }