public void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: _relatingMonetaryUnit = (IfcMonetaryUnit)value.EntityVal; break; case 1: _relatedMonetaryUnit = (IfcMonetaryUnit)value.EntityVal; break; case 2: _exchangeRate = value.RealVal; break; case 3: _rateDateTime = (IfcDateAndTime)value.EntityVal; break; case 4: _rateSource = (IfcLibraryInformation)value.EntityVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: _relatingMonetaryUnit = (IfcMonetaryUnit)(value.EntityVal); return; case 1: _relatedMonetaryUnit = (IfcMonetaryUnit)(value.EntityVal); return; case 2: _exchangeRate = value.RealVal; return; case 3: _rateDateTime = (IfcDateAndTime)(value.EntityVal); return; case 4: _rateSource = (IfcLibraryInformation)(value.EntityVal); return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
public IfcCurrencyRelationship(IfcMonetaryUnit __RelatingMonetaryUnit, IfcMonetaryUnit __RelatedMonetaryUnit, IfcPositiveRatioMeasure __ExchangeRate, IfcDateAndTime __RateDateTime, IfcLibraryInformation __RateSource) { this._RelatingMonetaryUnit = __RelatingMonetaryUnit; this._RelatedMonetaryUnit = __RelatedMonetaryUnit; this._ExchangeRate = __ExchangeRate; this._RateDateTime = __RateDateTime; this._RateSource = __RateSource; }
public IfcDocumentInformation(IfcIdentifier __DocumentId, IfcLabel __Name, IfcText?__Description, IfcDocumentReference[] __DocumentReferences, IfcText?__Purpose, IfcText?__IntendedUse, IfcText?__Scope, IfcLabel?__Revision, IfcActorSelect __DocumentOwner, IfcActorSelect[] __Editors, IfcDateAndTime __CreationTime, IfcDateAndTime __LastRevisionTime, IfcDocumentElectronicFormat __ElectronicFormat, IfcCalendarDate __ValidFrom, IfcCalendarDate __ValidUntil, IfcDocumentConfidentialityEnum?__Confidentiality, IfcDocumentStatusEnum?__Status) { this._DocumentId = __DocumentId; this._Name = __Name; this._Description = __Description; this._DocumentReferences = new HashSet <IfcDocumentReference>(__DocumentReferences); this._Purpose = __Purpose; this._IntendedUse = __IntendedUse; this._Scope = __Scope; this._Revision = __Revision; this._DocumentOwner = __DocumentOwner; this._Editors = new HashSet <IfcActorSelect>(__Editors); this._CreationTime = __CreationTime; this._LastRevisionTime = __LastRevisionTime; this._ElectronicFormat = __ElectronicFormat; this._ValidFrom = __ValidFrom; this._ValidUntil = __ValidUntil; this._Confidentiality = __Confidentiality; this._Status = __Status; }
/// <summary> /// Get the string value for the IfcDateTimeSelect /// </summary> /// <param name="ifcDateTimeSelect">IfcDateTimeSelect</param> /// <returns>string</returns> public static string GetAsString(this IfcDateTimeSelect ifcDateTimeSelect) { if (ifcDateTimeSelect is IfcDateAndTime) { IfcDateAndTime datetime = (ifcDateTimeSelect as IfcDateAndTime); int minute = 0; if (datetime.TimeComponent.MinuteComponent.HasValue) { minute = (int)datetime.TimeComponent.MinuteComponent.Value; } int second = 0; if (datetime.TimeComponent.SecondComponent.HasValue) { second = (int)datetime.TimeComponent.SecondComponent.Value; } return(new DateTime(datetime.DateComponent.YearComponent, datetime.DateComponent.MonthComponent, datetime.DateComponent.DayComponent, datetime.TimeComponent.HourComponent, minute, second).ToString()); } if (ifcDateTimeSelect is IfcCalendarDate) { IfcCalendarDate date = (ifcDateTimeSelect as IfcCalendarDate); return(new DateTime(date.YearComponent, date.MonthComponent, date.DayComponent).ToString("d")); } if (ifcDateTimeSelect is IfcLocalTime) { IfcLocalTime time = (ifcDateTimeSelect as IfcLocalTime); int minute = 0; if (time.MinuteComponent.HasValue) { minute = (int)time.MinuteComponent.Value; } int second = 0; if (time.SecondComponent.HasValue) { second = (int)time.SecondComponent.Value; } return(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, time.HourComponent, minute, second).ToString("HH:mm:ss")); } return(string.Empty); }
public static string ToISODateTimeString(this IfcDateAndTime dateAndTime) { var year = 1; var month = 1; var day = 1; var hour = 0; var minute = 0; double seconds = 0; var milliSeconds = 0; if (dateAndTime.DateComponent != null) { year = (int)dateAndTime.DateComponent.YearComponent; month = (int)dateAndTime.DateComponent.MonthComponent; day = (int)dateAndTime.DateComponent.DayComponent; } if (dateAndTime.TimeComponent != null) { hour = (int)dateAndTime.TimeComponent.HourComponent; if (dateAndTime.TimeComponent.MinuteComponent.HasValue) { minute = (int)dateAndTime.TimeComponent.MinuteComponent.Value; } if (dateAndTime.TimeComponent.SecondComponent.HasValue) { seconds = dateAndTime.TimeComponent.SecondComponent.Value; } var secondInt = Math.Truncate(seconds); milliSeconds = (int)((seconds - secondInt) * 1000); seconds = secondInt; } var dateTime = new DateTime(year, month, day, hour, minute, (int)seconds, milliSeconds); return(dateTime.ToString("yyyy-MM-ddThh:mm:ss.fff")); }
public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: _documentId = value.StringVal; return; case 1: _name = value.StringVal; return; case 2: _description = value.StringVal; return; case 3: _documentReferences.InternalAdd((IfcDocumentReference)value.EntityVal); return; case 4: _purpose = value.StringVal; return; case 5: _intendedUse = value.StringVal; return; case 6: _scope = value.StringVal; return; case 7: _revision = value.StringVal; return; case 8: _documentOwner = (IfcActorSelect)(value.EntityVal); return; case 9: _editors.InternalAdd((IfcActorSelect)value.EntityVal); return; case 10: _creationTime = (IfcDateAndTime)(value.EntityVal); return; case 11: _lastRevisionTime = (IfcDateAndTime)(value.EntityVal); return; case 12: _electronicFormat = (IfcDocumentElectronicFormat)(value.EntityVal); return; case 13: _validFrom = (IfcCalendarDate)(value.EntityVal); return; case 14: _validUntil = (IfcCalendarDate)(value.EntityVal); return; case 15: _confidentiality = (IfcDocumentConfidentialityEnum)System.Enum.Parse(typeof(IfcDocumentConfidentialityEnum), value.EnumVal, true); return; case 16: _status = (IfcDocumentStatusEnum)System.Enum.Parse(typeof(IfcDocumentStatusEnum), value.EnumVal, true); return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
public void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: _documentId = value.StringVal; break; case 1: _name = value.StringVal; break; case 2: _description = value.StringVal; break; case 3: if (_documentReferences == null) { _documentReferences = new XbimSet <IfcDocumentReference>(this); } ((IXbimNoNotifyCollection)_documentReferences).Add((IfcDocumentReference)value.EntityVal); break; case 4: _purpose = value.StringVal; break; case 5: _intendedUse = value.StringVal; break; case 6: _scope = value.StringVal; break; case 7: _revision = value.StringVal; break; case 8: _documentOwner = (IfcActorSelect)value.EntityVal; break; case 9: if (_editors == null) { _editors = new XbimSet <IfcActorSelect>(this); } ((IXbimNoNotifyCollection)_editors).Add((IfcActorSelect)value.EntityVal); break; case 10: _creationTime = (IfcDateAndTime)value.EntityVal; break; case 11: _lastRevisionTime = (IfcDateAndTime)value.EntityVal; break; case 12: _electronicFormat = (IfcDocumentElectronicFormat)value.EntityVal; break; case 13: _validFrom = (IfcCalendarDate)value.EntityVal; break; case 14: _validUntil = (IfcCalendarDate)value.EntityVal; break; case 15: _confidentiality = (IfcDocumentConfidentialityEnum) Enum.Parse(typeof(IfcDocumentConfidentialityEnum), value.EnumVal, true); break; case 16: _status = (IfcDocumentStatusEnum)Enum.Parse(typeof(IfcDocumentStatusEnum), value.EnumVal, true); break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
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; }); }