/// <summary> /// Create and setup IfcSite object /// </summary> /// <param name="row">COBieFacilityRow object to read data from</param> /// <returns>IfcSite object</returns> private void CreateSite(COBieFacilityRow row) { IfcSite ifcSite = Model.Instances.New<IfcSite>(); //set owner history SetNewOwnerHistory(ifcSite, row.ExternalSystem, Model.DefaultOwningUser, row.CreatedOn); //using statement will set the Model.OwnerHistoryAddObject to ifcSite.OwnerHistory as OwnerHistoryAddObject is used upon any property changes, //then swaps the original OwnerHistoryAddObject back in the dispose, so set any properties within the using statement using (COBieXBimEditScope context = new COBieXBimEditScope(Model, ifcSite.OwnerHistory)) { AddGlobalId(row.ExternalSiteIdentifier, ifcSite); if (ValidateString(row.SiteName)) ifcSite.Name = row.SiteName; ifcSite.CompositionType = IfcElementCompositionEnum.ELEMENT; IfcLocalPlacement lp = Model.Instances.New<IfcLocalPlacement>(); lp.RelativePlacement = WCS; ifcSite.ObjectPlacement = lp; if (ValidateString(row.SiteDescription)) ifcSite.Description = row.SiteDescription; } }
/// <summary> /// Set the area measure to the building /// </summary> /// <param name="ifcBuilding">Building object</param> /// <param name="row">COBieFacilityRow object holding data</param> private void SetAreaMeasure(IfcBuilding ifcBuilding, COBieFacilityRow row) { IfcSIUnit ifcSIUnitArea = null; if (ValidateString(row.AreaUnits)) { ifcSIUnitArea = GetSIUnit(row.AreaUnits); } string areaMeasure = string.Empty; if (ValidateString(row.AreaMeasurement)) { areaMeasure = row.AreaMeasurement; } IfcQuantityArea IfcQuantityArea = Model.Instances.New<IfcQuantityArea>(qa => { qa.Unit = ifcSIUnitArea; qa.Name = "AreaMeasure"; qa.Description = "Created to maintain COBie information"; }); IfcElementQuantity ifcElementQuantity = Model.Instances.New<IfcElementQuantity>(eq => { eq.Quantities.Add(IfcQuantityArea); eq.MethodOfMeasurement = areaMeasure; eq.Description = "Created to maintain COBie information"; }); IfcRelDefinesByProperties ifcRelDefinesByProperties = Model.Instances.New<IfcRelDefinesByProperties>(rdbp => { rdbp.RelatedObjects.Add(ifcBuilding); rdbp.RelatingPropertyDefinition = ifcElementQuantity; rdbp.Description = "Created to maintain COBie information"; }); }
/// <summary> /// SetUp the Model Project Object /// </summary> /// <param name="row">COBieFacilityRow object to read data from</param> private void SetUpProject(COBieFacilityRow row) { IfcProject ifcProject = Model.IfcProject; ifcProject.Initialize(ProjectUnits.SIUnitsUK); SetOwnerHistory(ifcProject, row.ExternalSystem, Model.DefaultOwningUser, row.CreatedOn); //using statement will set the Model.OwnerHistoryAddObject to ifcProject.OwnerHistory as OwnerHistoryAddObject is used upon any property changes, //then swaps the original OwnerHistoryAddObject back in the dispose, so set any properties within the using statement using (COBieXBimEditScope context = new COBieXBimEditScope(Model, ifcProject.OwnerHistory)) { if (ValidateString(row.ProjectName)) ifcProject.Name = row.ProjectName; if (ValidateString(row.ProjectDescription)) ifcProject.Description = row.ProjectDescription; if (ValidateString(row.Phase)) ifcProject.Phase = row.Phase; if (ValidateString(row.LinearUnits)) { SetUnitToProject(IfcUnitEnum.LENGTHUNIT, row.LinearUnits); } AddGlobalId(row.ExternalProjectIdentifier, ifcProject); if (ValidateString(row.AreaUnits)) { SetUnitToProject(IfcUnitEnum.AREAUNIT, row.AreaUnits); } if (ValidateString(row.VolumeUnits)) { SetUnitToProject(IfcUnitEnum.VOLUMEUNIT, row.VolumeUnits); } if (ValidateString(row.CurrencyUnit)) { SetMonetaryUnit(row.CurrencyUnit); } } }
/// <summary> /// Create and setup the IfcBuilding building object /// </summary> /// <param name="row">COBieFacilityRow object to read data from</param> private void CreateBuilding(COBieFacilityRow row) { IfcBuilding ifcBuilding = Model.Instances.New<IfcBuilding>(); SetNewOwnerHistory(ifcBuilding, row.ExternalSystem, Model.DefaultOwningUser, row.CreatedOn); //using statement will set the Model.OwnerHistoryAddObject to ifcBuilding.OwnerHistory as OwnerHistoryAddObject is used upon any property changes, //then swaps the original OwnerHistoryAddObject back in the dispose, so set any properties within the using statement using (COBieXBimEditScope context = new COBieXBimEditScope(Model, ifcBuilding.OwnerHistory)) { AddGlobalId(row.ExternalFacilityIdentifier, ifcBuilding); if (ValidateString(row.Name)) ifcBuilding.Name = row.Name; //add category AddCategory(row.Category, ifcBuilding); if (ValidateString(row.Description)) ifcBuilding.Description = row.Description; if (ValidateString(row.AreaMeasurement)) { SetAreaMeasure(ifcBuilding, row); } ifcBuilding.CompositionType = IfcElementCompositionEnum.ELEMENT; IfcLocalPlacement lp = Model.Instances.New<IfcLocalPlacement>(); lp.RelativePlacement = WCS; lp.PlacementRelTo = GetSite().ObjectPlacement; ifcBuilding.ObjectPlacement = lp; } }