/// <summary> /// Fill sheet rows for Floor sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieFloorRow> Fill() { ProgressIndicator.ReportMessage("Starting Floors..."); //create new sheet COBieSheet <COBieFloorRow> floors = new COBieSheet <COBieFloorRow>(Constants.WORKSHEET_FLOOR); // get all IfcBuildingStory objects from IFC file IEnumerable <IfcBuildingStorey> buildingStories = Model.Instances.OfType <IfcBuildingStorey>(); COBieDataPropertySetValues allPropertyValues = new COBieDataPropertySetValues(); //properties helper class COBieDataAttributeBuilder attributeBuilder = new COBieDataAttributeBuilder(Context, allPropertyValues); attributeBuilder.InitialiseAttributes(ref _attributes); //IfcClassification ifcClassification = Model.Instances.OfType<IfcClassification>().FirstOrDefault(); //list of attributes to exclude form attribute sheet //set up filters on COBieDataPropertySetValues for the SetAttributes only attributeBuilder.ExcludeAttributePropertyNames.AddRange(Context.Exclude.Floor.AttributesEqualTo); attributeBuilder.ExcludeAttributePropertyNamesWildcard.AddRange(Context.Exclude.Floor.AttributesContain); attributeBuilder.RowParameters["Sheet"] = "Floor"; ProgressIndicator.Initialise("Creating Floors", buildingStories.Count()); foreach (IfcBuildingStorey ifcBuildingStorey in buildingStories) { ProgressIndicator.IncrementAndUpdate(); COBieFloorRow floor = new COBieFloorRow(floors); string name = ifcBuildingStorey.Name; if (string.IsNullOrEmpty(ifcBuildingStorey.Name)) { ifcBuildingStorey.Name = "Name Unknown " + UnknownCount.ToString(); UnknownCount++; } //set allPropertyValues to this element allPropertyValues.SetAllPropertyValues(ifcBuildingStorey); //set the internal filtered IfcPropertySingleValues List in allPropertyValues floor.Name = name; string createBy = allPropertyValues.GetPropertySingleValueValue("COBieCreatedBy", false); //support for COBie Toolkit for Autodesk Revit floor.CreatedBy = ValidateString(createBy) ? createBy : GetTelecomEmailAddress(ifcBuildingStorey.OwnerHistory); string createdOn = allPropertyValues.GetPropertySingleValueValue("COBieCreatedOn", false); //support for COBie Toolkit for Autodesk Revit floor.CreatedOn = ValidateString(createdOn) ? createdOn : GetCreatedOnDateAsFmtString(ifcBuildingStorey.OwnerHistory); floor.Category = GetCategory(ifcBuildingStorey); string extSystem = allPropertyValues.GetPropertySingleValueValue("COBieExtSystem", false);//support for COBie Toolkit for Autodesk Revit floor.ExtSystem = ValidateString(extSystem) ? extSystem : GetExternalSystem(ifcBuildingStorey); floor.ExtObject = ifcBuildingStorey.GetType().Name; floor.ExtIdentifier = ifcBuildingStorey.GlobalId; string description = allPropertyValues.GetPropertySingleValueValue("COBieDescription", false);//support for COBie Toolkit for Autodesk Revit floor.Description = ValidateString(description) ? description : GetFloorDescription(ifcBuildingStorey); floor.Elevation = (string.IsNullOrEmpty(ifcBuildingStorey.Elevation.ToString())) ? DEFAULT_NUMERIC : string.Format("{0}", (double)ifcBuildingStorey.Elevation); floor.Height = GetFloorHeight(ifcBuildingStorey, allPropertyValues); floors.AddRow(floor); //fill in the attribute information attributeBuilder.RowParameters["Name"] = floor.Name; attributeBuilder.RowParameters["CreatedBy"] = floor.CreatedBy; attributeBuilder.RowParameters["CreatedOn"] = floor.CreatedOn; attributeBuilder.RowParameters["ExtSystem"] = floor.ExtSystem; attributeBuilder.PopulateAttributesRows(ifcBuildingStorey); //fill attribute sheet rows//pass data from this sheet info as Dictionary } floors.OrderBy(s => s.Name); ProgressIndicator.Finalise(); return(floors); }
/// <summary> /// Fill sheet rows for Job sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieJobRow> Fill() { ProgressIndicator.ReportMessage("Starting Jobs..."); //create new sheet var jobs = new COBieSheet <COBieJobRow>(Constants.WORKSHEET_JOB); // get all IfcTask objects from IFC file var ifcTasks = Model.FederatedInstances.OfType <IfcTask>(); var allPropertyValues = new COBieDataPropertySetValues(); //properties helper class //IfcTypeObject typObj = Model.FederatedInstances.OfType<IfcTypeObject>().FirstOrDefault(); var cer = Model.FederatedInstances.OfType <IfcConstructionEquipmentResource>().FirstOrDefault(); ProgressIndicator.Initialise("Creating Jobs", ifcTasks.Count()); foreach (var ifcTask in ifcTasks) { ProgressIndicator.IncrementAndUpdate(); if (ifcTask == null) { continue; } var job = new COBieJobRow(jobs); job.Name = (string.IsNullOrEmpty(ifcTask.Name.ToString())) ? DEFAULT_STRING : ifcTask.Name.ToString(); job.CreatedBy = GetTelecomEmailAddress(ifcTask.OwnerHistory); job.CreatedOn = GetCreatedOnDateAsFmtString(ifcTask.OwnerHistory); job.Category = ifcTask.ObjectType.ToString(); job.Status = (string.IsNullOrEmpty(ifcTask.Status.ToString())) ? DEFAULT_STRING : ifcTask.Status.ToString(); job.TypeName = GetObjectType(ifcTask); job.Description = (string.IsNullOrEmpty(ifcTask.Description.ToString())) ? DEFAULT_STRING : ifcTask.Description.ToString(); allPropertyValues.SetAllPropertyValues(ifcTask); //set properties values to this task var ifcPropertySingleValue = allPropertyValues.GetPropertySingleValue("TaskDuration"); job.Duration = ((ifcPropertySingleValue != null) && (ifcPropertySingleValue.NominalValue != null)) ? ConvertNumberOrDefault(ifcPropertySingleValue.NominalValue.ToString()) : DEFAULT_NUMERIC; var unitName = ((ifcPropertySingleValue != null) && (ifcPropertySingleValue.Unit != null)) ? GetUnitName(ifcPropertySingleValue.Unit) : null; job.DurationUnit = (string.IsNullOrEmpty(unitName)) ? DEFAULT_STRING : unitName; ifcPropertySingleValue = allPropertyValues.GetPropertySingleValue("TaskStartDate"); job.Start = GetStartTime(ifcPropertySingleValue); unitName = ((ifcPropertySingleValue != null) && (ifcPropertySingleValue.Unit != null)) ? GetUnitName(ifcPropertySingleValue.Unit) : null; job.TaskStartUnit = (string.IsNullOrEmpty(unitName)) ? DEFAULT_STRING : unitName; ifcPropertySingleValue = allPropertyValues.GetPropertySingleValue("TaskInterval"); job.Frequency = ((ifcPropertySingleValue != null) && (ifcPropertySingleValue.NominalValue != null)) ? ConvertNumberOrDefault(ifcPropertySingleValue.NominalValue.ToString()) : DEFAULT_NUMERIC; unitName = ((ifcPropertySingleValue != null) && (ifcPropertySingleValue.Unit != null)) ? GetUnitName(ifcPropertySingleValue.Unit) : null; job.FrequencyUnit = (string.IsNullOrEmpty(unitName)) ? DEFAULT_STRING : unitName; job.ExtSystem = GetExternalSystem(ifcTask); job.ExtObject = ifcTask.GetType().Name; job.ExtIdentifier = ifcTask.GlobalId; job.TaskNumber = (string.IsNullOrEmpty(ifcTask.TaskId.ToString())) ? DEFAULT_STRING : ifcTask.TaskId.ToString(); job.Priors = GetPriors(ifcTask); job.ResourceNames = GetResources(ifcTask); jobs.AddRow(job); } jobs.OrderBy(s => s.Name); ProgressIndicator.Finalise(); return(jobs); }
/// <summary> /// Fill sheet rows for Contact sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieContactRow> Fill() { ProgressIndicator.ReportMessage("Starting Contacts..."); ClearEMails(); //clear the email dictionary for a new file conversion //create new sheet COBieSheet <COBieContactRow> contacts = new COBieSheet <COBieContactRow>(Constants.WORKSHEET_CONTACT); IEnumerable <string> cobieContacts = Model.Instances.OfType <IfcPropertySingleValue>().Where(psv => psv.Name == "COBieCreatedBy" || psv.Name == "COBieTypeCreatedBy").GroupBy(psv => psv.NominalValue).Select(g => g.First().NominalValue.ToString()); IEnumerable <IfcPersonAndOrganization> ifcPersonAndOrganizations = Model.Instances.OfType <IfcPersonAndOrganization>(); ProgressIndicator.Initialise("Creating Contacts", ifcPersonAndOrganizations.Count() + cobieContacts.Count()); List <IfcOrganizationRelationship> ifcOrganizationRelationships = null; foreach (IfcPersonAndOrganization ifcPersonAndOrganization in ifcPersonAndOrganizations) { ProgressIndicator.IncrementAndUpdate(); //check we do not have a default email address, if skip it as we want the validation warning string email = GetTelecomEmailAddress(ifcPersonAndOrganization); if (email == Constants.DEFAULT_EMAIL) { continue; } COBieContactRow contact = new COBieContactRow(contacts); // get person and organization IfcOrganization ifcOrganization = ifcPersonAndOrganization.TheOrganization; IfcPerson ifcPerson = ifcPersonAndOrganization.ThePerson; contact.Email = email; //lets default the creator to that user who created the project for now, no direct link to OwnerHistory on IfcPersonAndOrganization, IfcPerson or IfcOrganization contact.CreatedBy = GetTelecomEmailAddress(Model.IfcProject.OwnerHistory); contact.CreatedOn = GetCreatedOnDateAsFmtString(Model.IfcProject.OwnerHistory); IfcActorRole ifcActorRole = null; if (ifcPerson.Roles != null) { ifcActorRole = ifcPerson.Roles.FirstOrDefault(); } if (ifcOrganization.Roles != null) { ifcActorRole = ifcOrganization.Roles.FirstOrDefault(); } if ((ifcActorRole != null) && (!string.IsNullOrEmpty(ifcActorRole.UserDefinedRole))) { contact.Category = ifcActorRole.UserDefinedRole.ToString(); } else { contact.Category = DEFAULT_STRING; } contact.Company = (string.IsNullOrEmpty(ifcOrganization.Name)) ? DEFAULT_STRING : ifcOrganization.Name.ToString(); contact.Phone = GetTelecomTelephoneNumber(ifcPersonAndOrganization); contact.ExtSystem = DEFAULT_STRING; // TODO: Person is not a Root object so has no Owner. What should this be? contact.ExtObject = "IfcPersonAndOrganization"; if (!string.IsNullOrEmpty(ifcPerson.Id)) { contact.ExtIdentifier = ifcPerson.Id; } //get department string department = ""; if (ifcPerson.Addresses != null) { department = ifcPerson.Addresses.PostalAddresses.Select(dept => dept.InternalLocation).Where(dept => !string.IsNullOrEmpty(dept)).FirstOrDefault(); } if (string.IsNullOrEmpty(department)) { if (ifcOrganizationRelationships == null) { ifcOrganizationRelationships = Model.Instances.OfType <IfcOrganizationRelationship>().ToList(); } IfcOrganization ifcRelOrganization = ifcOrganizationRelationships .Where(Or => Or.RelatingOrganization.EntityLabel == ifcOrganization.EntityLabel && Or.RelatedOrganizations.Last() != null) .Select(Or => Or.RelatedOrganizations.Last()) .LastOrDefault(); if (ifcRelOrganization != null) { department = ifcRelOrganization.Name.ToString(); } } if (string.IsNullOrEmpty(department)) { department = ifcOrganization.Description.ToString(); //only place to match example files } contact.Department = (string.IsNullOrEmpty(department)) ? contact.Company : department; contact.OrganizationCode = (string.IsNullOrEmpty(ifcOrganization.Id)) ? DEFAULT_STRING : ifcOrganization.Id.ToString(); contact.GivenName = (string.IsNullOrEmpty(ifcPerson.GivenName)) ? DEFAULT_STRING : ifcPerson.GivenName.ToString(); contact.FamilyName = (string.IsNullOrEmpty(ifcPerson.FamilyName)) ? DEFAULT_STRING : ifcPerson.FamilyName.ToString(); if (ifcPerson.Addresses != null) { GetContactAddress(contact, ifcPerson.Addresses); } else { GetContactAddress(contact, ifcOrganization.Addresses); } contacts.AddRow(contact); } foreach (string email in cobieContacts) { ProgressIndicator.IncrementAndUpdate(); COBieContactRow contact = new COBieContactRow(contacts); contact.Email = email; //lets default the creator to that user who created the project for now, no direct link to OwnerHistory on IfcPersonAndOrganization, IfcPerson or IfcOrganization contact.CreatedBy = GetTelecomEmailAddress(Model.IfcProject.OwnerHistory); contact.CreatedOn = GetCreatedOnDateAsFmtString(Model.IfcProject.OwnerHistory); contact.Category = DEFAULT_STRING; contact.Company = DEFAULT_STRING; contact.Phone = DEFAULT_STRING; contact.ExtSystem = DEFAULT_STRING; contact.ExtObject = "IfcPropertySingleValue"; contact.Department = DEFAULT_STRING; contact.OrganizationCode = DEFAULT_STRING; contact.GivenName = DEFAULT_STRING; contact.FamilyName = DEFAULT_STRING; contact.Street = DEFAULT_STRING; contact.PostalBox = DEFAULT_STRING; contact.Town = DEFAULT_STRING; contact.StateRegion = DEFAULT_STRING; contact.PostalCode = DEFAULT_STRING; contact.Country = DEFAULT_STRING; contacts.AddRow(contact); } ProgressIndicator.Finalise(); contacts.OrderBy(s => s.Email); return(contacts); }
/// <summary> /// Fill sheet rows for Coordinate sheet /// </summary> public override COBieSheet <COBieCoordinateRow> Fill() { //get the conversion to the COBie units (metres or feet) double conversionFactor; var cobieUnits = Context.WorkBookUnits.LengthUnit.ToLowerInvariant(); if (cobieUnits == "meters" || cobieUnits == "metres") { conversionFactor = Model.ModelFactors.OneMetre; } else if (cobieUnits == "millimeters" || cobieUnits == "millimetres") { conversionFactor = Model.ModelFactors.OneMilliMetre; } else if (cobieUnits == "feet" || cobieUnits == "foot") { conversionFactor = Model.ModelFactors.OneFoot; } else if (cobieUnits == "inch" || cobieUnits == "inches") { conversionFactor = Model.ModelFactors.OneInch; } else { throw new Exception( string.Format("The COBie units are incorrectly set, the provided value {0} is invalid.", cobieUnits)); } XbimMatrix3D globalTransform = XbimMatrix3D.CreateScale(1 / conversionFactor); var coordinates = new COBieSheet <COBieCoordinateRow>(Constants.WORKSHEET_COORDINATE); ProgressIndicator.ReportMessage("Starting Coordinates..."); //Create new sheet //Get buildings and spaces var ifcBuildingStoreys = Model.FederatedInstances.OfType <IfcBuildingStorey>(); var ifcSpaces = Model.FederatedInstances.OfType <IfcSpace>() .OrderBy(ifcSpace => ifcSpace.Name, new CompareIfcLabel()); var ifcProducts = ifcBuildingStoreys.Union <IfcProduct>(ifcSpaces); //add spaces //get component products as shown in Component sheet var relAggregates = Model.FederatedInstances.OfType <IfcRelAggregates>(); var relSpatial = Model.FederatedInstances.OfType <IfcRelContainedInSpatialStructure>(); var ifcElements = ((from x in relAggregates from y in x.RelatedObjects where !Context.Exclude.ObjectType.Component.Contains(y.GetType()) select y).Union(from x in relSpatial from y in x.RelatedElements where !Context.Exclude.ObjectType.Component.Contains(y.GetType()) select y)).OfType <IfcProduct>(); //.GroupBy(el => el.Name).Select(g => g.First()) ifcProducts = ifcProducts.Union(ifcElements); var productList = ifcProducts as IList <IfcProduct> ?? ifcProducts.ToList(); ProgressIndicator.Initialise("Creating Coordinates", productList.Count()); var m3D = new Xbim3DModelContext(Model); foreach (var ifcProduct in productList) { ProgressIndicator.IncrementAndUpdate(); //if no name to link the row name too skip it, as no way to link back to the parent object //if (string.IsNullOrEmpty(ifcProduct.Name)) // continue; var coordinate = new COBieCoordinateRow(coordinates) { Name = (string.IsNullOrEmpty(ifcProduct.Name.ToString())) ? DEFAULT_STRING : ifcProduct.Name.ToString(), CreatedBy = GetTelecomEmailAddress(ifcProduct.OwnerHistory), CreatedOn = GetCreatedOnDateAsFmtString(ifcProduct.OwnerHistory) }; // (ifcBuildingStorey == null || ifcBuildingStorey.Name.ToString() == "") ? "CoordinateName" : ifcBuildingStorey.Name.ToString(); coordinate.RowName = coordinate.Name; XbimPoint3D?ifcCartesianPointLower = null; XbimPoint3D?ifcCartesianPointUpper = null; var transBox = new TransformedBoundingBox(); if (ifcProduct is IfcBuildingStorey) { XbimMatrix3D worldMatrix = ifcProduct.ObjectPlacement.ToMatrix3D(); ifcCartesianPointLower = new XbimPoint3D(worldMatrix.OffsetX, worldMatrix.OffsetY, worldMatrix.OffsetZ); //get the offset from the world coordinates system 0,0,0 point, i.e. origin point of this object in world space coordinate.SheetName = "Floor"; coordinate.Category = "point"; ifcCartesianPointUpper = null; } else { if (ifcProduct is IfcSpace) { coordinate.SheetName = "Space"; } else { coordinate.SheetName = "Component"; } coordinate.Category = "box-lowerleft"; //and box-upperright, so two values required when we do this var boundBox = XbimRect3D.Empty; XbimMatrix3D transform = XbimMatrix3D.Identity; foreach (var shapeInstance in m3D.ShapeInstancesOf(ifcProduct)) { if (boundBox.IsEmpty) { boundBox = shapeInstance.BoundingBox; } else { boundBox.Union(shapeInstance.BoundingBox); } transform = shapeInstance.Transformation; } if (!boundBox.IsEmpty) { XbimMatrix3D m = globalTransform * transform; transBox = new TransformedBoundingBox(boundBox, m); //set points ifcCartesianPointLower = transBox.MinPt; ifcCartesianPointUpper = transBox.MaxPt; } } if (ifcCartesianPointLower.HasValue) { coordinate.CoordinateXAxis = string.Format("{0}", (double)ifcCartesianPointLower.Value.X); coordinate.CoordinateYAxis = string.Format("{0}", (double)ifcCartesianPointLower.Value.Y); coordinate.CoordinateZAxis = string.Format("{0}", (double)ifcCartesianPointLower.Value.Z); coordinate.ExtSystem = GetExternalSystem(ifcProduct); coordinate.ExtObject = ifcProduct.GetType().Name; if (!string.IsNullOrEmpty(ifcProduct.GlobalId)) { coordinate.ExtIdentifier = ifcProduct.GlobalId.ToString(); } coordinate.ClockwiseRotation = transBox.ClockwiseRotation.ToString("F4"); coordinate.ElevationalRotation = transBox.ElevationalRotation.ToString("F4"); coordinate.YawRotation = transBox.YawRotation.ToString("F4"); coordinates.AddRow(coordinate); } if (ifcCartesianPointUpper.HasValue) //we need a second row for upper point { var coordinateUpper = new COBieCoordinateRow(coordinates); coordinateUpper.Name = coordinate.Name; coordinateUpper.CreatedBy = coordinate.CreatedBy; coordinateUpper.CreatedOn = coordinate.CreatedOn; coordinateUpper.RowName = coordinate.RowName; coordinateUpper.SheetName = coordinate.SheetName; coordinateUpper.Category = "box-upperright"; coordinateUpper.CoordinateXAxis = string.Format("{0}", (double)ifcCartesianPointUpper.Value.X); coordinateUpper.CoordinateYAxis = string.Format("{0}", (double)ifcCartesianPointUpper.Value.Y); coordinateUpper.CoordinateZAxis = string.Format("{0}", (double)ifcCartesianPointUpper.Value.Z); coordinateUpper.ExtSystem = coordinate.ExtSystem; coordinateUpper.ExtObject = coordinate.ExtObject; coordinateUpper.ExtIdentifier = coordinate.ExtIdentifier; coordinateUpper.ClockwiseRotation = coordinate.ClockwiseRotation; coordinateUpper.ElevationalRotation = coordinate.ElevationalRotation; coordinateUpper.YawRotation = coordinate.YawRotation; coordinates.AddRow(coordinateUpper); } } coordinates.OrderBy(s => s.Name); ProgressIndicator.Finalise(); return(coordinates); }
/// <summary> /// Fill sheet rows for Connection sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieConnectionRow> Fill() { ProgressIndicator.ReportMessage("Starting Connections..."); //Create new sheet COBieSheet <COBieConnectionRow> connections = new COBieSheet <COBieConnectionRow>(Constants.WORKSHEET_CONNECTION); // get all IfcRelConnectsElements objects from IFC file IEnumerable <IfcRelConnectsElements> ifcRelConnectsElements = Model.Instances.OfType <IfcRelConnectsElements>() .Where(rce => rce.RelatedElement != null && !Context.Exclude.ObjectType.Component.Contains(rce.RelatedElement.GetType()) && rce.RelatingElement != null && !Context.Exclude.ObjectType.Component.Contains(rce.RelatingElement.GetType()) ); //get ifcRelConnectsPorts only if we have ifcRelConnectsElements IEnumerable <IfcRelConnectsPorts> ifcRelConnectsPorts = Enumerable.Empty <IfcRelConnectsPorts>(); if (ifcRelConnectsElements.Count() > 0) { ifcRelConnectsPorts = Model.Instances.OfType <IfcRelConnectsPorts>(); } ProgressIndicator.Initialise("Creating Connections", ifcRelConnectsElements.Count()); int ids = 0; foreach (IfcRelConnectsElements ifcRelConnectsElement in ifcRelConnectsElements) { ProgressIndicator.IncrementAndUpdate(); IfcElement relatingElement = ifcRelConnectsElement.RelatingElement; IfcElement relatedElement = ifcRelConnectsElement.RelatedElement; COBieConnectionRow conn = new COBieConnectionRow(connections); //try and get the IfcRelConnectsPorts first for relatingElement then for relatedElement IEnumerable <IfcRelConnectsPorts> ifcRelConnectsPortsElement = ifcRelConnectsPorts.Where(rcp => (rcp.RealizingElement != null) && ((rcp.RealizingElement == relatingElement) || (rcp.RealizingElement == relatedElement))); string connectionName = ""; connectionName = (string.IsNullOrEmpty(ifcRelConnectsElement.Name)) ? "" : ifcRelConnectsElement.Name.ToString(); conn.CreatedBy = GetTelecomEmailAddress(ifcRelConnectsElement.OwnerHistory); conn.CreatedOn = GetCreatedOnDateAsFmtString(ifcRelConnectsElement.OwnerHistory); conn.ConnectionType = GetComponentDescription(ifcRelConnectsElement); conn.SheetName = GetSheetByObjectType(relatingElement.GetType()); conn.RowName1 = ((relatingElement != null) && (!string.IsNullOrEmpty(relatingElement.Name.ToString()))) ? relatingElement.Name.ToString() : DEFAULT_STRING; conn.RowName2 = ((relatedElement != null) && (!string.IsNullOrEmpty(relatedElement.Name.ToString()))) ? relatedElement.Name.ToString() : DEFAULT_STRING; //second attempt to get a name, if no IfcElement name then see if the associated type has a name //if (conn.RowName1 == DEFAULT_STRING) conn.RowName1 = GetTypeName(relatingElement); //if (conn.RowName2 == DEFAULT_STRING) conn.RowName2 = GetTypeName(relatedElement); //try and get IfcRelConnectsPorts by using relatingElement then relatedElement is the RelizingElement, but this is optional property, but the IfcRelConnectsPorts object document states //"Each of the port is being attached to the IfcElement by using the IfcRelConnectsPortToElement relationship" and the IfcRelConnectsPortToElement is a inverse reference to HasPorts //on the IfcElement, so if no IfcRelConnectsPorts found for either Element, then check the HasPosts property of each element. List <string> realizingElement = new List <string>(); List <string> relatedPort = new List <string>(); List <string> relatingPort = new List <string>(); foreach (IfcRelConnectsPorts port in ifcRelConnectsPortsElement) { if ((string.IsNullOrEmpty(connectionName)) && (string.IsNullOrEmpty(port.Name))) { connectionName = port.Name; } if ((port.RealizingElement != null) && (!string.IsNullOrEmpty(port.RealizingElement.ToString()))) //removed to allow export to xbim to keep sequence && (!realizingElement.Contains(port.RealizingElement.ToString())) { realizingElement.Add(port.RealizingElement.ToString()); } if ((port.RelatedPort != null) && (!string.IsNullOrEmpty(port.RelatedPort.Name.ToString()))) //removed to allow export to xbim to keep sequence && (!relatedPort.Contains(port.RelatedPort.Name.ToString())) { relatedPort.Add(port.RelatedPort.Name.ToString()); } if ((port.RelatingPort != null) && (!string.IsNullOrEmpty(port.RelatingPort.Name.ToString()))) //removed to allow export to xbim to keep sequence && (!relatingPort.Contains(port.RelatingPort.Name.ToString())) { relatingPort.Add(port.RelatingPort.Name.ToString()); } } conn.RealizingElement = (realizingElement.Count > 0) ? COBieXBim.JoinStrings(':', realizingElement) : DEFAULT_STRING; //no related port found so lets try and get from IfcElement.HasPorts if (relatedPort.Count == 0) { IEnumerable <IfcRelConnectsPortToElement> relatedPorts = relatedElement.HasPorts.Where(rcpe => rcpe.RelatingPort != null); foreach (IfcRelConnectsPortToElement port in relatedPorts) { if ((string.IsNullOrEmpty(connectionName)) && (string.IsNullOrEmpty(port.Name))) { connectionName = port.Name; } if ((port.RelatingPort != null) && (!string.IsNullOrEmpty(port.RelatingPort.Name.ToString())) && (!relatedPort.Contains(port.RelatingPort.Name.ToString()))) { relatedPort.Add(port.RelatingPort.Name.ToString()); } } } //no relating port found so lets try and get from IfcElement.HasPorts if (relatingPort.Count == 0) { IEnumerable <IfcRelConnectsPortToElement> relatingPorts = relatingElement.HasPorts.Where(rcpe => rcpe.RelatingPort != null); foreach (IfcRelConnectsPortToElement port in relatingPorts) { if ((string.IsNullOrEmpty(connectionName)) && (string.IsNullOrEmpty(port.Name))) { connectionName = port.Name; } if ((port.RelatingPort != null) && (!string.IsNullOrEmpty(port.RelatingPort.Name.ToString())) && (!relatedPort.Contains(port.RelatingPort.Name.ToString()))) { relatingPort.Add(port.RelatingPort.Name.ToString()); } } } conn.PortName1 = (relatingPort.Count > 0) ? COBieXBim.JoinStrings(':', relatingPort) : DEFAULT_STRING; conn.PortName2 = (relatedPort.Count > 0) ? COBieXBim.JoinStrings(':', relatedPort) : DEFAULT_STRING; conn.ExtSystem = GetExternalSystem(ifcRelConnectsElement); conn.ExtObject = ifcRelConnectsElement.GetType().Name; conn.ExtIdentifier = ifcRelConnectsElement.GlobalId; //if no ifcRelConnectsElement Name or Port names then revert to the index number conn.Name = (string.IsNullOrEmpty(connectionName)) ? ids.ToString() : connectionName; conn.Description = (string.IsNullOrEmpty(ifcRelConnectsElement.Description)) ? DEFAULT_STRING : ifcRelConnectsElement.Description.ToString(); connections.AddRow(conn); ids++; } connections.OrderBy(s => s.Name); ProgressIndicator.Finalise(); return(connections); }
/// <summary> /// Fill sheet rows for Type sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieTypeRow> Fill() { #if DEBUG Stopwatch timer = new Stopwatch(); timer.Start(); #endif ProgressIndicator.ReportMessage("Starting Types..."); // Create new Sheet COBieSheet <COBieTypeRow> types = new COBieSheet <COBieTypeRow>(Constants.WORKSHEET_TYPE); //group the types by name as we need to filter duplicate items in for each loop IEnumerable <IfcTypeObject> ifcTypeObjects = Model.Instances.OfType <IfcTypeObject>() .Select(type => type) .Where(type => !Context.Exclude.ObjectType.Types.Contains(type.GetType())) .GroupBy(type => type.Name).SelectMany(g => g);//.Distinct() //set up property set helper class COBieDataPropertySetValues allPropertyValues = new COBieDataPropertySetValues(); //properties helper class COBieDataAttributeBuilder attributeBuilder = new COBieDataAttributeBuilder(Context, allPropertyValues); attributeBuilder.InitialiseAttributes(ref _attributes); attributeBuilder.ExcludeAttributePropertyNames.AddRange(Context.Exclude.Types.AttributesEqualTo); //we do not want for the attribute sheet so filter them out attributeBuilder.ExcludeAttributePropertyNamesWildcard.AddRange(Context.Exclude.Types.AttributesContain); //we do not want for the attribute sheet so filter them out attributeBuilder.ExcludeAttributePropertySetNames.AddRange(Context.Exclude.Types.PropertySetsEqualTo); //exclude the property set from selection of values attributeBuilder.RowParameters["Sheet"] = "Type"; ProgressIndicator.Initialise("Creating Types", ifcTypeObjects.Count()); //COBieTypeRow lastRow = null; foreach (IfcTypeObject type in ifcTypeObjects) { ProgressIndicator.IncrementAndUpdate(); COBieTypeRow typeRow = new COBieTypeRow(types); // TODO: Investigate centralising this common code. string name = type.Name; if (string.IsNullOrEmpty(type.Name)) { name = "Name Unknown " + UnknownCount.ToString(); UnknownCount++; } //set allPropertyValues to this element allPropertyValues.SetAllPropertyValues(type); //set the internal filtered IfcPropertySingleValues List in allPropertyValues typeRow.Name = name; string create_By = allPropertyValues.GetPropertySingleValueValue("COBieTypeCreatedBy", false); //support for COBie Toolkit for Autodesk Revit typeRow.CreatedBy = ValidateString(create_By) ? create_By : GetTelecomEmailAddress(type.OwnerHistory); string created_On = allPropertyValues.GetPropertySingleValueValue("COBieTypeCreatedOn", false); //support for COBie Toolkit for Autodesk Revit typeRow.CreatedOn = ValidateString(created_On) ? created_On : GetCreatedOnDateAsFmtString(type.OwnerHistory); typeRow.Category = GetCategory(allPropertyValues); string description = allPropertyValues.GetPropertySingleValueValue("COBieDescription", false);//support for COBie Toolkit for Autodesk Revit typeRow.Description = ValidateString(description) ? description : GetTypeObjDescription(type); string ext_System = allPropertyValues.GetPropertySingleValueValue("COBieTypeExtSystem", false);//support for COBie Toolkit for Autodesk Revit typeRow.ExtSystem = ValidateString(ext_System) ? ext_System : GetExternalSystem(type); typeRow.ExtObject = type.GetType().Name; typeRow.ExtIdentifier = type.GlobalId; FillPropertySetsValues(allPropertyValues, type, typeRow); //not duplicate so add to sheet //if (CheckForDuplicateRow(lastRow, typeRow)) //{ string rowhash = typeRow.RowHashValue; if (RowHashs.ContainsKey(rowhash)) { continue; } else { types.AddRow(typeRow); RowHashs.Add(rowhash, true); } //lastRow = typeRow; //save this row to test on next loop //} // Provide Attribute sheet with our context //fill in the attribute information attributeBuilder.RowParameters["Name"] = typeRow.Name; attributeBuilder.RowParameters["CreatedBy"] = typeRow.CreatedBy; attributeBuilder.RowParameters["CreatedOn"] = typeRow.CreatedOn; attributeBuilder.RowParameters["ExtSystem"] = typeRow.ExtSystem; attributeBuilder.PopulateAttributesRows(type); //fill attribute sheet rows } ProgressIndicator.Finalise(); //--------------Loop all IfcMaterialLayerSet----------------------------- ProgressIndicator.ReportMessage("Starting MaterialLayerSets..."); IEnumerable <IfcMaterialLayerSet> ifcMaterialLayerSets = Model.Instances.OfType <IfcMaterialLayerSet>(); ChildNamesList rowHolderChildNames = new ChildNamesList(); ChildNamesList rowHolderLayerChildNames = new ChildNamesList(); string createdBy = DEFAULT_STRING, createdOn = DEFAULT_STRING, extSystem = DEFAULT_STRING; ProgressIndicator.Initialise("Creating MaterialLayerSets", ifcMaterialLayerSets.Count()); foreach (IfcMaterialLayerSet ifcMaterialLayerSet in ifcMaterialLayerSets) { ProgressIndicator.IncrementAndUpdate(); //Material layer has no owner history, so lets take the owner history from IfcRelAssociatesMaterial.RelatingMaterial -> (IfcMaterialLayerSetUsage.ForLayerSet -> IfcMaterialLayerSet) || IfcMaterialLayerSet || IfcMaterialLayer as it is a IfcMaterialSelect IfcOwnerHistory ifcOwnerHistory = GetMaterialOwnerHistory(ifcMaterialLayerSet); if (ifcOwnerHistory != null) { createdBy = GetTelecomEmailAddress(ifcOwnerHistory); createdOn = GetCreatedOnDateAsFmtString(ifcOwnerHistory); extSystem = GetExternalSystem(ifcOwnerHistory); } else //default to the project as we failed to find a IfcRoot object to extract it from { createdBy = GetTelecomEmailAddress(Model.IfcProject.OwnerHistory); createdOn = GetCreatedOnDateAsFmtString(Model.IfcProject.OwnerHistory); extSystem = GetExternalSystem(Model.IfcProject.OwnerHistory); } //add materialLayerSet name to rows COBieTypeRow matSetRow = new COBieTypeRow(types); matSetRow.Name = (string.IsNullOrEmpty(ifcMaterialLayerSet.Name)) ? DEFAULT_STRING : ifcMaterialLayerSet.Name; matSetRow.CreatedBy = createdBy; matSetRow.CreatedOn = createdOn; matSetRow.ExtSystem = extSystem; matSetRow.ExtObject = ifcMaterialLayerSet.GetType().Name; matSetRow.AssetType = "Fixed"; types.AddRow(matSetRow); //loop the materials within the material layer set foreach (IfcMaterialLayer ifcMaterialLayer in ifcMaterialLayerSet.MaterialLayers) { if ((ifcMaterialLayer.Material != null) && (!string.IsNullOrEmpty(ifcMaterialLayer.Material.Name)) ) { string name = ifcMaterialLayer.Material.Name.ToString().Trim(); double thickness = ifcMaterialLayer.LayerThickness; string keyName = name + " (" + thickness.ToString() + ")"; if (!rowHolderLayerChildNames.Contains(keyName.ToLower())) //check we do not already have it { COBieTypeRow matRow = new COBieTypeRow(types); matRow.Name = keyName; matRow.CreatedBy = createdBy; matRow.CreatedOn = createdOn; matRow.ExtSystem = extSystem; matRow.ExtObject = ifcMaterialLayer.GetType().Name; matRow.AssetType = "Fixed"; matRow.NominalWidth = thickness.ToString(); rowHolderLayerChildNames.Add(keyName.ToLower()); //we also don't want to repeat on the IfcMaterial loop below if (!rowHolderChildNames.Contains(name.ToLower())) { rowHolderChildNames.Add(name.ToLower()); } types.AddRow(matRow); } } } } ProgressIndicator.Finalise(); //--------Loop Materials in case they are not in a layer Set----- ProgressIndicator.ReportMessage("Starting Materials..."); IEnumerable <IfcMaterial> ifcMaterials = Model.Instances.OfType <IfcMaterial>(); ProgressIndicator.Initialise("Creating Materials", ifcMaterials.Count()); foreach (IfcMaterial ifcMaterial in ifcMaterials) { ProgressIndicator.IncrementAndUpdate(); string name = ifcMaterial.Name.ToString().Trim(); if (!string.IsNullOrEmpty(ifcMaterial.Name)) { if (!rowHolderChildNames.Contains(name.ToLower())) //check we do not already have it { COBieTypeRow matRow = new COBieTypeRow(types); matRow.Name = name; matRow.CreatedBy = createdBy; //no way of extraction on material, if no material layer set, so use last found in Layer Set loop matRow.CreatedOn = createdOn; //ditto matRow.ExtSystem = extSystem; //ditto matRow.ExtObject = ifcMaterial.GetType().Name; matRow.AssetType = "Fixed"; types.AddRow(matRow); } rowHolderChildNames.Add(name.ToLower()); } } types.OrderBy(s => s.Name); ProgressIndicator.Finalise(); #if DEBUG timer.Stop(); Console.WriteLine(String.Format("Time to generate Type data = {0} seconds", timer.Elapsed.TotalSeconds.ToString("F3"))); #endif return(types); }
/// <summary> /// Fill sheet rows for System sheet /// </summary> /// <returns>COBieSheet</returns> public COBieSheet <COBieSystemRow> Fill(Dictionary <string, HashSet <string> > compIndices) { ProgressIndicator.ReportMessage("Starting Systems..."); //Create new sheet COBieSheet <COBieSystemRow> systems = new COBieSheet <COBieSystemRow>(Constants.WORKSHEET_SYSTEM); // get all IfcSystem, IfcGroup and IfcElectricalCircuit objects from IFC file IEnumerable <IfcGroup> ifcGroups = Model.FederatedInstances.OfType <IfcGroup>().Where(ifcg => ifcg is IfcSystem); //get anything that is IfcSystem or derived from it eg IfcElectricalCircuit //IEnumerable<IfcSystem> ifcSystems = Model.FederatedInstances.OfType<IfcSystem>(); //IEnumerable<IfcElectricalCircuit> ifcElectricalCircuits = Model.FederatedInstances.OfType<IfcElectricalCircuit>(); //ifcGroups = ifcGroups.Union(ifcSystems); //ifcGroups = ifcGroups.Union(ifcElectricalCircuits); //Alternative method of extraction List <string> PropertyNames = new List <string> { "Circuit Number", "System Name" }; IEnumerable <IfcPropertySet> ifcPropertySets = from ps in Model.FederatedInstances.OfType <IfcPropertySet>() from psv in ps.HasProperties.OfType <IfcPropertySingleValue>() where PropertyNames.Contains(psv.Name) select ps; ProgressIndicator.Initialise("Creating Systems", ifcGroups.Count() + ifcPropertySets.Count()); foreach (IfcGroup ifcGroup in ifcGroups) { ProgressIndicator.IncrementAndUpdate(); IEnumerable <IfcProduct> ifcProducts = (ifcGroup.IsGroupedBy == null) ? Enumerable.Empty <IfcProduct>() : ifcGroup.IsGroupedBy.RelatedObjects.OfType <IfcProduct>(); foreach (IfcProduct product in ifcProducts) { COBieSystemRow sys = new COBieSystemRow(systems); sys.Name = ifcGroup.Name; sys.CreatedBy = GetTelecomEmailAddress(ifcGroup.OwnerHistory); sys.CreatedOn = GetCreatedOnDateAsFmtString(ifcGroup.OwnerHistory); sys.Category = GetCategory(ifcGroup); string name = product.Name; if (string.IsNullOrEmpty(product.Name) || (product.Name == Constants.DEFAULT_STRING)) { name = product.GetType().Name + " Name Unknown " + UnknownCount.ToString(); UnknownCount++; } else { if (compIndices.Count > 0) //check we have values { //check for name in components , if missing exclude from system, unknown names are listed see above if (!compIndices["Name"].Contains(name, StringComparer.OrdinalIgnoreCase)) { continue; } } } sys.ComponentNames = product.Name; sys.ExtSystem = GetExternalSystem(ifcGroup); sys.ExtObject = ifcGroup.GetType().Name; //need to create product if filtered out in the components sheet if (!string.IsNullOrEmpty(ifcGroup.GlobalId)) { sys.ExtIdentifier = ifcGroup.GlobalId;//need to create product if filtered out in the components sheet } sys.Description = GetSystemDescription(ifcGroup); systems.AddRow(sys); } //check if no products then add group only, new line for each, or should we do as assembly? conCant with : if (!ifcProducts.Any()) { COBieSystemRow sys = new COBieSystemRow(systems); sys.Name = ifcGroup.Name; sys.CreatedBy = GetTelecomEmailAddress(ifcGroup.OwnerHistory); sys.CreatedOn = GetCreatedOnDateAsFmtString(ifcGroup.OwnerHistory); sys.Category = GetCategory(ifcGroup); sys.ComponentNames = DEFAULT_STRING; sys.ExtSystem = GetExternalSystem(ifcGroup); sys.ExtObject = ifcGroup.GetType().Name; if (!string.IsNullOrEmpty(ifcGroup.GlobalId)) { sys.ExtIdentifier = ifcGroup.GlobalId; } sys.Description = GetSystemDescription(ifcGroup); systems.AddRow(sys); } } foreach (IfcPropertySet ifcPropertySet in ifcPropertySets) { ProgressIndicator.IncrementAndUpdate(); string name = ""; IfcRelDefinesByProperties ifcRelDefinesByProperties = ifcPropertySet.PropertyDefinitionOf.FirstOrDefault(); //one or zero IfcPropertySingleValue ifcPropertySingleValue = ifcPropertySet.HasProperties.OfType <IfcPropertySingleValue>().Where(psv => PropertyNames.Contains(psv.Name)).FirstOrDefault(); if ((ifcPropertySingleValue != null) && (ifcPropertySingleValue.NominalValue != null) && (!string.IsNullOrEmpty(ifcPropertySingleValue.NominalValue.ToString()))) { name = ifcPropertySingleValue.NominalValue.ToString(); } else //try for "System Classification" Not in matrix but looks a good candidate { IfcPropertySingleValue ifcPropertySVClassification = ifcPropertySet.HasProperties.OfType <IfcPropertySingleValue>().Where(psv => psv.Name == "System Classification").FirstOrDefault(); if ((ifcPropertySVClassification != null) && (ifcPropertySVClassification.NominalValue != null) && (!string.IsNullOrEmpty(ifcPropertySVClassification.NominalValue.ToString()))) { name = ifcPropertySVClassification.NominalValue.ToString(); } } foreach (IfcObject ifcObject in ifcRelDefinesByProperties.RelatedObjects) { if (ifcObject != null) { COBieSystemRow sys = new COBieSystemRow(systems); //OK if we have no name lets just guess at the first value as we need a value if (string.IsNullOrEmpty(name)) { //get first text value held in NominalValue var names = ifcPropertySet.HasProperties.OfType <IfcPropertySingleValue>().Where(psv => (psv.NominalValue != null) && (!string.IsNullOrEmpty(psv.NominalValue.ToString()))).Select(psv => psv.NominalValue).FirstOrDefault(); if (names != null) { name = names.ToString(); } else { //OK last chance, lets take the property name that is not in the filter list of strings, ie. != "Circuit Number", "System Name" or "System Classification" from above IfcPropertySingleValue propname = ifcPropertySet.HasProperties.OfType <IfcPropertySingleValue>().Where(psv => !PropertyNames.Contains(psv.Name)).FirstOrDefault(); if (propname != null) { name = propname.Name.ToString(); } } } sys.Name = string.IsNullOrEmpty(name) ? DEFAULT_STRING : name; sys.CreatedBy = GetTelecomEmailAddress(ifcObject.OwnerHistory); sys.CreatedOn = GetCreatedOnDateAsFmtString(ifcObject.OwnerHistory); sys.Category = (ifcPropertySingleValue.Name == "Circuit Number") ? "circuit" : GetCategory(ifcObject); //per matrix v9 //check that the element is in the component list if (compIndices.Count > 0) //check we have values { //check for name in components , if missing exclude from system, unknown names are listed see above if (!compIndices["Name"].Contains(ifcObject.Name.ToString(), StringComparer.OrdinalIgnoreCase)) { continue; } } sys.ComponentNames = ifcObject.Name; sys.ExtSystem = GetExternalSystem(ifcPropertySet); sys.ExtObject = ifcPropertySingleValue.GetType().Name; sys.Description = string.IsNullOrEmpty(name) ? DEFAULT_STRING : name;; systems.AddRow(sys); } } } systems.OrderBy(s => s.Name); ProgressIndicator.Finalise(); return(systems); }
/// <summary> /// Fill sheet rows for Issue sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieIssueRow> Fill() { ProgressIndicator.ReportMessage("Starting Issues..."); var ifcProject = Model.Instances.FirstOrDefault <IIfcProject>(); Debug.Assert(ifcProject != null); //create new sheet var issues = new COBieSheet <COBieIssueRow>(Constants.WORKSHEET_ISSUE); //IEnumerable<IfcPropertySet> ifcProperties = Model.FederatedInstances.OfType<IfcPropertySet>().Where(ps => ps.Name.ToString() == "Pset_Risk"); #region IFcApproval // get all IfcApproval objects from IFC file IEnumerable <IfcApproval> ifcApprovals = Model.FederatedInstances.OfType <IfcApproval>(); ProgressIndicator.Initialise("Creating Issues (from IfcApprovals)", ifcApprovals.Count()); List <IfcRelAssociatesApproval> ifcRelAssociatesApprovals = Model.FederatedInstances.OfType <IfcRelAssociatesApproval>().ToList(); foreach (IfcApproval ifcApproval in ifcApprovals) { ProgressIndicator.IncrementAndUpdate(); COBieIssueRow issue = new COBieIssueRow(issues); //get the associated property setIfcPropertySet var ifcPropertySet = ifcRelAssociatesApprovals .Where(ral => ral.RelatingApproval == ifcApproval) .SelectMany(ral => ral.RelatedObjects.OfType <IfcPropertySet>()) .Where(ps => ps.Name == "Pset_Risk") .FirstOrDefault(); List <IfcSimpleProperty> propertyList = new List <IfcSimpleProperty>(); if (ifcPropertySet != null) { propertyList = ifcPropertySet.HasProperties.OfType <IfcSimpleProperty>().ToList(); } issue.Name = (string.IsNullOrEmpty(ifcApproval.Name)) ? DEFAULT_STRING : ifcApproval.Name.ToString(); //lets default the creator to that user who created the project for now, no direct link to OwnerHistory on IfcApproval if (ifcPropertySet != null) { //use "Pset_Risk" Property Set as source for this issue.CreatedBy = GetTelecomEmailAddress(ifcPropertySet.OwnerHistory); issue.CreatedOn = GetCreatedOnDateAsFmtString(ifcPropertySet.OwnerHistory); } else { //if property set is null use project defaults issue.CreatedBy = GetTelecomEmailAddress(ifcProject.OwnerHistory); issue.CreatedOn = GetCreatedOnDateAsFmtString(ifcProject.OwnerHistory); } Interval propValues = GetPropertyEnumValue(propertyList, "RiskType"); issue.Type = propValues.Value; propValues = GetPropertyEnumValue(propertyList, "RiskRating"); issue.Risk = propValues.Value; propValues = GetPropertyEnumValue(propertyList, "AssessmentOfRisk"); issue.Chance = propValues.Value; propValues = GetPropertyEnumValue(propertyList, "RiskConsequence"); issue.Impact = propValues.Value; //GetIt(typeof(IfcApproval)); //Risk assessment has to be on a task so we should have one List <IfcRoot> IfcRoots = GetIfcObjects(ifcApproval); issue.SheetName1 = (IfcRoots.Count > 0) ? GetSheetByObjectType(IfcRoots[0].GetType()) : DEFAULT_STRING; issue.RowName1 = (IfcRoots.Count > 0) ? IfcRoots[0].Name.ToString() : DEFAULT_STRING; //assuming that this row is a person associated with the ifcApproval, but might be a task string email = GetContact(ifcApproval); if (email == DEFAULT_STRING) //if no email, see if we have another ifcobject { issue.SheetName2 = (IfcRoots.Count > 1) ? GetSheetByObjectType(IfcRoots[1].GetType()) : DEFAULT_STRING; issue.RowName2 = (IfcRoots.Count > 1) ? IfcRoots[1].Name.ToString() : DEFAULT_STRING; } else { issue.SheetName2 = (email != DEFAULT_STRING) ? Constants.WORKSHEET_CONTACT : DEFAULT_STRING; issue.RowName2 = (email != DEFAULT_STRING) ? email : DEFAULT_STRING; } issue.Description = (string.IsNullOrEmpty(ifcApproval.Description.ToString())) ? DEFAULT_STRING : ifcApproval.Description.ToString(); propValues = GetPropertyEnumValue(propertyList, "RiskOwner"); issue.Owner = propValues.Value; propValues = GetPropertyValue(propertyList, "PreventiveMeasures"); issue.Mitigation = propValues.Value; issue.ExtSystem = (ifcPropertySet != null) ? GetExternalSystem(ifcPropertySet) : DEFAULT_STRING; issue.ExtObject = ifcApproval.GetType().Name; issue.ExtIdentifier = ifcApproval.Identifier.ToString(); issues.AddRow(issue); } ProgressIndicator.Finalise(); #endregion #region HS_Risk_UK // get all HS_Risk_UK Issues IEnumerable <IfcPropertySet> ifcProperties = Model.FederatedInstances.OfType <IfcPropertySet>().Where(ps => ps.Name.ToString() == "HS_Risk_UK"); ProgressIndicator.Initialise("Creating Issues (from HS_Risk_UK psets)", ifcProperties.Count()); foreach (IfcPropertySet propSet in ifcProperties) { ProgressIndicator.IncrementAndUpdate(); COBieIssueRow issue = new COBieIssueRow(issues); List <IfcSimpleProperty> HSpropertyList = propSet.HasProperties.OfType <IfcSimpleProperty>().ToList(); Interval propValues = GetPropertyValue(HSpropertyList, "RiskName"); issue.Name = (propValues.Value == DEFAULT_STRING) ? propSet.Name.ToString() : propValues.Value.ToString(); // //lets default the creator to that user who created the project for now, no direct link to OwnerHistory on IfcApproval if (propSet != null) { //use "Pset_Risk" Property Set as source for this issue.CreatedBy = GetTelecomEmailAddress(propSet.OwnerHistory); issue.CreatedOn = GetCreatedOnDateAsFmtString(propSet.OwnerHistory); } else { //if property set is null use project defaults issue.CreatedBy = GetTelecomEmailAddress(ifcProject.OwnerHistory); issue.CreatedOn = GetCreatedOnDateAsFmtString(ifcProject.OwnerHistory); } propValues = GetPropertyValue(HSpropertyList, "RiskCategory"); issue.Type = propValues.Value; propValues = GetPropertyValue(HSpropertyList, "LevelOfRisk"); issue.Risk = propValues.Value; propValues = GetPropertyValue(HSpropertyList, "RiskLikelihood"); issue.Chance = propValues.Value; propValues = GetPropertyValue(HSpropertyList, "RiskConsequence"); issue.Impact = propValues.Value; //TODO: We need to extend the functionality here as right now we make some assumptions: //1. The Issue SheetName1/RowName1 refers to a Component attached to the property set (it could be something else) //2. The component has an associated space, which makes up Sheetname2/Rowname2 IfcRoot ifcRoot = GetAssociatedObject(propSet); issue.SheetName1 = GetSheetByObjectType(ifcRoot.GetType()); issue.RowName1 = (!string.IsNullOrEmpty(ifcRoot.Name.ToString())) ? ifcRoot.Name.ToString() : DEFAULT_STRING; var SpaceBoundingBoxInfo = new List <SpaceInfo>(); issue.RowName2 = COBieHelpers.GetComponentRelatedSpace(ifcRoot as IfcElement, Model, SpaceBoundingBoxInfo, Context); issue.SheetName2 = "Space"; //End TODO propValues = GetPropertyValue(HSpropertyList, "RiskDescription"); issue.Description = (propValues.Value == DEFAULT_STRING) ? propSet.Name.ToString() : propValues.Value.ToString(); propValues = GetPropertyValue(HSpropertyList, "OwnerDiscipline"); issue.Owner = propValues.Value; propValues = GetPropertyValue(HSpropertyList, "AgreedMitigation"); issue.Mitigation = propValues.Value; issue.ExtSystem = (propSet != null) ? GetExternalSystem(propSet) : DEFAULT_STRING; issue.ExtObject = "HS_Risk_UK"; issue.ExtIdentifier = propSet.GlobalId.ToString();//ifcApproval.Identifier.ToString(); // issues.AddRow(issue); } issues.OrderBy(s => s.Name); ProgressIndicator.Finalise(); #endregion #region PSet_Risk // get all PSet_Risk issues ifcProperties = Model.FederatedInstances.OfType <IfcPropertySet>().Where(ps => ps.Name.ToString() == "PSet_Risk"); ProgressIndicator.Initialise("Creating Issues (from PSet_Risk)", ifcProperties.Count()); foreach (IfcPropertySet propSet in ifcProperties) { ProgressIndicator.IncrementAndUpdate(); COBieIssueRow issue = new COBieIssueRow(issues); List <IfcSimpleProperty> RiskpropertyList = propSet.HasProperties.OfType <IfcSimpleProperty>().ToList(); Interval propValues = GetPropertyValue(RiskpropertyList, "RiskName"); issue.Name = (propValues.Value == DEFAULT_STRING) ? propSet.Name.ToString() : propValues.Value.ToString(); //TODO: Fill in the rest of these properties issues.AddRow(issue); } ProgressIndicator.Finalise(); #endregion issues.OrderBy(s => s.Name); return(issues); }
/// <summary> /// Fill sheet rows for Spare sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieSpareRow> Fill() { ProgressIndicator.ReportMessage("Starting Spares..."); //Create new sheet COBieSheet <COBieSpareRow> spares = new COBieSheet <COBieSpareRow>(Constants.WORKSHEET_SPARE); // get all IfcBuildingStory objects from IFC file IEnumerable <IfcConstructionProductResource> ifcConstructionProductResources = Model.FederatedInstances.OfType <IfcConstructionProductResource>(); COBieDataPropertySetValues allPropertyValues = new COBieDataPropertySetValues(); //properties helper class COBieDataAttributeBuilder attributeBuilder = new COBieDataAttributeBuilder(Context, allPropertyValues); attributeBuilder.InitialiseAttributes(ref _attributes); attributeBuilder.RowParameters["Sheet"] = "Spare"; //set up filters on COBieDataPropertySetValues attributeBuilder.ExcludeAttributePropertyNames.AddRange(Context.Exclude.Spare.AttributesEqualTo); attributeBuilder.ExcludeAttributePropertyNamesWildcard.AddRange(Context.Exclude.Spare.AttributesContain); //IfcTypeObject typeObject = Model.FederatedInstances.OfType<IfcTypeObject>().FirstOrDefault(); ProgressIndicator.Initialise("Creating Spares", ifcConstructionProductResources.Count()); foreach (IfcConstructionProductResource ifcConstructionProductResource in ifcConstructionProductResources) { ProgressIndicator.IncrementAndUpdate(); COBieSpareRow spare = new COBieSpareRow(spares); //set allPropertyValues to this element allPropertyValues.SetAllPropertyValues(ifcConstructionProductResource); //set the internal filtered IfcPropertySingleValues List in allPropertyValues spare.Name = (string.IsNullOrEmpty(ifcConstructionProductResource.Name)) ? "" : ifcConstructionProductResource.Name.ToString(); string createBy = allPropertyValues.GetPropertySingleValueValue("COBieCreatedBy", false); //support for COBie Toolkit for Autodesk Revit spare.CreatedBy = ValidateString(createBy) ? createBy : GetTelecomEmailAddress(ifcConstructionProductResource.OwnerHistory); string createdOn = allPropertyValues.GetPropertySingleValueValue("COBieCreatedOn", false); //support for COBie Toolkit for Autodesk Revit spare.CreatedOn = ValidateString(createdOn) ? createdOn : GetCreatedOnDateAsFmtString(ifcConstructionProductResource.OwnerHistory); spare.Category = GetCategory(ifcConstructionProductResource); spare.TypeName = GetObjectType(ifcConstructionProductResource); string extSystem = allPropertyValues.GetPropertySingleValueValue("COBieExtSystem", false);//support for COBie Toolkit for Autodesk Revit spare.ExtSystem = ValidateString(extSystem) ? extSystem : GetExternalSystem(ifcConstructionProductResource); spare.ExtObject = ifcConstructionProductResource.GetType().Name; spare.ExtIdentifier = ifcConstructionProductResource.GlobalId; string description = allPropertyValues.GetPropertySingleValueValue("COBieDescription", false);//support for COBie Toolkit for Autodesk Revit if (ValidateString(description)) { spare.Description = description; } else { spare.Description = (ifcConstructionProductResource == null) ? "" : ifcConstructionProductResource.Description.ToString(); } //get information from Pset_Spare_COBie property set var ifcPropertySet = ifcConstructionProductResource.GetPropertySet("Pset_Spare_COBie"); if (ifcPropertySet != null) { var ifcPropertySingleValue = ifcPropertySet.HasProperties.OfType <IIfcPropertySingleValue>().FirstOrDefault(p => p.Name == "Suppliers"); spare.Suppliers = ((ifcPropertySingleValue != null) && (!string.IsNullOrEmpty(ifcPropertySingleValue.NominalValue.ToString()))) ? ifcPropertySingleValue.NominalValue.ToString() : DEFAULT_STRING; ifcPropertySingleValue = ifcPropertySet.HasProperties.OfType <IIfcPropertySingleValue>().FirstOrDefault(p => p.Name == "SetNumber"); spare.SetNumber = ((ifcPropertySingleValue != null) && (!string.IsNullOrEmpty(ifcPropertySingleValue.NominalValue.ToString()))) ? ifcPropertySingleValue.NominalValue.ToString() : DEFAULT_STRING;; ifcPropertySingleValue = ifcPropertySet.HasProperties.OfType <IIfcPropertySingleValue>().FirstOrDefault(p => p.Name == "PartNumber"); spare.PartNumber = ((ifcPropertySingleValue != null) && (!string.IsNullOrEmpty(ifcPropertySingleValue.NominalValue.ToString()))) ? ifcPropertySingleValue.NominalValue.ToString() : DEFAULT_STRING;; } else { spare.Suppliers = DEFAULT_STRING; spare.SetNumber = DEFAULT_STRING; spare.PartNumber = DEFAULT_STRING; } if ((spare.Name == DEFAULT_STRING) && (spare.TypeName == DEFAULT_STRING) && (spare.Description == DEFAULT_STRING)) { continue; } spares.AddRow(spare); //----------fill in the attribute information for spaces----------- //fill in the attribute information attributeBuilder.RowParameters["Name"] = spare.Name; attributeBuilder.RowParameters["CreatedBy"] = spare.CreatedBy; attributeBuilder.RowParameters["CreatedOn"] = spare.CreatedOn; attributeBuilder.RowParameters["ExtSystem"] = spare.ExtSystem; attributeBuilder.PopulateAttributesRows(ifcConstructionProductResource); //fill attribute sheet rows//pass data from this sheet info as Dictionary } spares.OrderBy(s => s.Name); ProgressIndicator.Finalise(); return(spares); }
/// <summary> /// Fill sheet rows for Assembly sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieAssemblyRow> Fill() { ProgressIndicator.ReportMessage("Starting Assemblies..."); //Create new sheet var ifcProject = Model.Instances.FirstOrDefault <IIfcProject>(); Debug.Assert(ifcProject != null); COBieSheet <COBieAssemblyRow> assemblies = new COBieSheet <COBieAssemblyRow>(Constants.WORKSHEET_ASSEMBLY); // get ifcRelAggregates objects from IFC file what are not in the excludedTypes type list IEnumerable <IfcRelAggregates> ifcRelAggregates = Model.FederatedInstances.OfType <IfcRelAggregates>(); IEnumerable <IfcRelNests> ifcRelNests = Model.FederatedInstances.OfType <IfcRelNests>(); IEnumerable <IfcRelDecomposes> relAll = (from ra in ifcRelAggregates where ((ra.RelatingObject is IfcProduct) || (ra.RelatingObject is IfcTypeObject)) && !Context.Exclude.ObjectType.Assembly.Contains(ra.RelatingObject.GetType()) select ra as IfcRelDecomposes).Union (from rn in ifcRelNests where ((rn.RelatingObject is IfcProduct) || (rn.RelatingObject is IfcTypeObject)) && !Context.Exclude.ObjectType.Assembly.Contains(rn.RelatingObject.GetType()) select rn as IfcRelDecomposes); ProgressIndicator.Initialise("Creating Assemblies", relAll.Count()); int childColumnLength = 255; //default vale, reassigned below foreach (IfcRelDecomposes ra in relAll) { ProgressIndicator.IncrementAndUpdate(); COBieAssemblyRow assembly = new COBieAssemblyRow(assemblies); if (string.IsNullOrEmpty(ra.Name)) { if (!string.IsNullOrEmpty(ra.RelatingObject.Name)) { assembly.Name = (string.IsNullOrEmpty(ra.RelatingObject.Name)) ? DEFAULT_STRING : ra.RelatingObject.Name.ToString(); } else { assembly.Name = DEFAULT_STRING; } } else { assembly.Name = ra.Name.ToString(); } assembly.CreatedBy = GetTelecomEmailAddress(ra.OwnerHistory); assembly.CreatedOn = GetCreatedOnDateAsFmtString(ra.OwnerHistory); assembly.SheetName = GetSheetByObjectType(ra.RelatingObject.GetType()); assembly.ParentName = ra.RelatingObject.Name; assembly.AssemblyType = "Fixed"; //as Responsibility matrix instruction assembly.ExtSystem = GetExternalSystem(ra); assembly.ExtObject = ra.GetType().Name; if (!string.IsNullOrEmpty(ra.GlobalId)) { assembly.ExtIdentifier = ra.GlobalId.ToString(); } assembly.Description = GetAssemblyDescription(ra); //get the assembly child names of objects that make up assembly ChildNamesList childNamesUnique = ExtractChildNames(ra); if (childColumnLength == 0) { childColumnLength = assembly["ChildNames"].COBieColumn.ColumnLength; } ChildNamesList childNames = ConCatChildNamesList(childNamesUnique, childColumnLength); if (childNames.Count > 0) { AddChildRows(assemblies, assembly, childNames); } } //--------------Loop all IfcMaterialLayerSet----------------------------- IEnumerable <IfcMaterialLayerSet> ifcMaterialLayerSets = Model.FederatedInstances.OfType <IfcMaterialLayerSet>(); char setNamePostFix = 'A'; foreach (IfcMaterialLayerSet ifcMaterialLayerSet in ifcMaterialLayerSets) { COBieAssemblyRow assembly = new COBieAssemblyRow(assemblies); if (string.IsNullOrEmpty(ifcMaterialLayerSet.LayerSetName)) { assembly.Name = "Material Layer Set " + setNamePostFix; setNamePostFix++; } else { assembly.Name = ifcMaterialLayerSet.LayerSetName.ToString(); } //Material layer has no owner history, so lets take the owner history from IfcRelAssociatesMaterial.RelatingMaterial -> (IfcMaterialLayerSetUsage.ForLayerSet -> IfcMaterialLayerSet) || IfcMaterialLayerSet || IfcMaterialLayer as it is a IfcMaterialSelect IfcOwnerHistory ifcOwnerHistory = GetMaterialOwnerHistory(ifcMaterialLayerSet); if (ifcOwnerHistory != null) { assembly.CreatedBy = GetTelecomEmailAddress(ifcOwnerHistory); assembly.CreatedOn = GetCreatedOnDateAsFmtString(ifcOwnerHistory); assembly.ExtSystem = GetExternalSystem(ifcOwnerHistory); } else //default to the project as we failed to find a IfcRoot object to extract it from { assembly.CreatedBy = GetTelecomEmailAddress(ifcProject.OwnerHistory); assembly.CreatedOn = GetCreatedOnDateAsFmtString(ifcProject.OwnerHistory); assembly.ExtSystem = GetExternalSystem(ifcProject.OwnerHistory); } assembly.SheetName = Constants.WORKSHEET_TYPE; //any material objects should be in the TYPE sheet assembly.Description = GetMaterialSetDescription(ifcMaterialLayerSet.MaterialLayers.ToList()); assembly.ParentName = (!string.IsNullOrEmpty(ifcMaterialLayerSet.LayerSetName)) ? ifcMaterialLayerSet.LayerSetName : new IfcLabel(DEFAULT_STRING); assembly.AssemblyType = "Layer"; assembly.ExtObject = ifcMaterialLayerSet.GetType().Name; //Loop Material names ChildNamesList childNamesUnique = ExtractChildNames(ifcMaterialLayerSet.MaterialLayers.ToList()); ChildNamesList childNames = ConCatChildNamesList(childNamesUnique, childColumnLength); //childColumnLength is max number of chars for the ChildNames cell if (childNames.Count > 0) { AddChildRows(assemblies, assembly, childNames); } } assemblies.OrderBy(s => s.Name); ProgressIndicator.Finalise(); return(assemblies); }
/// <summary> /// Fill sheet rows for Space sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieSpaceRow> Fill() { #if DEBUG Stopwatch timer = new Stopwatch(); timer.Start(); #endif ProgressIndicator.ReportMessage("Starting Spaces..."); //create new sheet COBieSheet <COBieSpaceRow> spaces = new COBieSheet <COBieSpaceRow>(Constants.WORKSHEET_SPACE); // get all IfcBuildingStory objects from IFC file List <IfcSpace> ifcSpaces = Model.Instances.OfType <IfcSpace>().OrderBy(ifcSpace => ifcSpace.Name, new CompareIfcLabel()).ToList(); COBieDataPropertySetValues allPropertyValues = new COBieDataPropertySetValues(); //properties helper class COBieDataAttributeBuilder attributeBuilder = new COBieDataAttributeBuilder(Context, allPropertyValues); attributeBuilder.InitialiseAttributes(ref _attributes); if (Context.DepartmentsUsedAsZones) { attributeBuilder.ExcludeAttributePropertyNames.Add("Department"); //remove the department property from selection } //set up filters on COBieDataPropertySetValues attributeBuilder.ExcludeAttributePropertyNames.AddRange(Context.Exclude.Space.AttributesEqualTo); attributeBuilder.ExcludeAttributePropertyNamesWildcard.AddRange(Context.Exclude.Space.AttributesContain); attributeBuilder.ExcludeAttributePropertySetNames.AddRange(Context.Exclude.Space.PropertySetsEqualTo); attributeBuilder.RowParameters["Sheet"] = "Space"; ProgressIndicator.Initialise("Creating Spaces", ifcSpaces.Count()); foreach (IfcSpace ifcSpace in ifcSpaces) { ProgressIndicator.IncrementAndUpdate(); COBieSpaceRow space = new COBieSpaceRow(spaces); //set allPropertyValues to this element allPropertyValues.SetAllPropertyValues(ifcSpace); //set the internal filtered IfcPropertySingleValues List in allPropertyValues space.Name = ifcSpace.Name; string createBy = allPropertyValues.GetPropertySingleValueValue("COBieCreatedBy", false); //support for COBie Toolkit for Autodesk Revit space.CreatedBy = ValidateString(createBy) ? createBy : GetTelecomEmailAddress(ifcSpace.OwnerHistory); string createdOn = allPropertyValues.GetPropertySingleValueValue("COBieCreatedOn", false); //support for COBie Toolkit for Autodesk Revit space.CreatedOn = ValidateString(createdOn) ? createdOn : GetCreatedOnDateAsFmtString(ifcSpace.OwnerHistory); space.Category = GetCategory(ifcSpace); space.FloorName = ((ifcSpace.SpatialStructuralElementParent != null) && (!string.IsNullOrEmpty(ifcSpace.SpatialStructuralElementParent.Name))) ? ifcSpace.SpatialStructuralElementParent.Name.ToString() : DEFAULT_STRING; string description = allPropertyValues.GetPropertySingleValueValue("COBieDescription", false); //support for COBie Toolkit for Autodesk Revit space.Description = ValidateString(description) ? description : GetSpaceDescription(ifcSpace); string extSystem = allPropertyValues.GetPropertySingleValueValue("COBieExtSystem", false); //support for COBie Toolkit for Autodesk Revit space.ExtSystem = ValidateString(extSystem) ? extSystem : GetExternalSystem(ifcSpace); space.ExtObject = ifcSpace.GetType().Name; space.ExtIdentifier = ifcSpace.GlobalId; space.RoomTag = GetRoomTag(ifcSpace, allPropertyValues); //Do Unit Values space.UsableHeight = GetUsableHeight(ifcSpace, allPropertyValues); space.GrossArea = GetGrossFloorArea(ifcSpace, allPropertyValues); space.NetArea = GetNetArea(ifcSpace, allPropertyValues); spaces.AddRow(space); //----------fill in the attribute information for spaces----------- //fill in the attribute information attributeBuilder.RowParameters["Name"] = space.Name; attributeBuilder.RowParameters["CreatedBy"] = space.CreatedBy; attributeBuilder.RowParameters["CreatedOn"] = space.CreatedOn; attributeBuilder.RowParameters["ExtSystem"] = space.ExtSystem; attributeBuilder.PopulateAttributesRows(ifcSpace); //fill attribute sheet rows//pass data from this sheet info as Dictionary } spaces.OrderBy(s => s.Name); ProgressIndicator.Finalise(); #if DEBUG timer.Stop(); Console.WriteLine(String.Format("Time to generate Spaces data = {0} seconds", timer.Elapsed.TotalSeconds.ToString("F3"))); #endif return(spaces); }
/// <summary> /// Fill sheet rows for Facility sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieFacilityRow> Fill() { ProgressIndicator.ReportMessage("Starting Facilities..."); //Create new sheet var facilities = new COBieSheet <COBieFacilityRow>(Constants.WORKSHEET_FACILITY); var ifcProject = Model.FederatedInstances.OfType <IfcProject>().FirstOrDefault(); var ifcSite = Model.FederatedInstances.OfType <IfcSite>().FirstOrDefault(); var ifcBuilding = Model.FederatedInstances.OfType <IfcBuilding>().FirstOrDefault(); //get Element Quantity holding area values as used for AreaMeasurement below var ifcElementQuantityAreas = Model.FederatedInstances.OfType <IfcElementQuantity>().FirstOrDefault(eq => eq.Quantities.OfType <IfcQuantityArea>().Any()); var ifcObjectList = new List <IfcObject>(); if (ifcProject != null) { ifcObjectList.Add(ifcProject); } if (ifcSite != null) { ifcObjectList.Add(ifcSite); } if (ifcBuilding != null) { ifcObjectList.Add(ifcBuilding); } var ifcObjects = ifcObjectList.AsEnumerable(); if (ifcObjects.Any()) { COBieDataPropertySetValues allPropertyValues = new COBieDataPropertySetValues(); //properties helper class COBieDataAttributeBuilder attributeBuilder = new COBieDataAttributeBuilder(Context, allPropertyValues); attributeBuilder.InitialiseAttributes(ref _attributes); //list of attributes to exclude form attribute sheet //set up filters on COBieDataPropertySetValues for the SetAttributes only attributeBuilder.ExcludeAttributePropertyNames.AddRange(Context.Exclude.Facility.AttributesEqualTo); attributeBuilder.ExcludeAttributePropertyNamesWildcard.AddRange(Context.Exclude.Facility.AttributesContain); attributeBuilder.RowParameters["Sheet"] = "Facility"; COBieFacilityRow facility = new COBieFacilityRow(facilities); string name = ""; if ((ifcBuilding != null) && (!string.IsNullOrEmpty(ifcBuilding.Name))) { name = ifcBuilding.Name; } else if ((ifcSite != null) && (!string.IsNullOrEmpty(ifcSite.Name))) { name = ifcSite.Name; } else if ((ifcProject != null) && (!string.IsNullOrEmpty(ifcProject.Name))) { name = ifcProject.Name; } else { name = DEFAULT_STRING; } facility.Name = (string.IsNullOrEmpty(name)) ? "The Facility Name Here" : name; var createBy = ifcBuilding.GetPropertySingleNominalValue("Other", "COBieCreatedBy"); //support for COBie Toolkit for Autodesk Revit facility.CreatedBy = ((createBy != null) && ValidateString(createBy.ToString())) ? createBy.ToString() : GetTelecomEmailAddress(ifcBuilding.OwnerHistory); var createdOn = ifcBuilding.GetPropertySingleNominalValue("Other", "COBieCreatedOn"); //support for COBie Toolkit for Autodesk Revit facility.CreatedOn = ((createdOn != null) && ValidateString(createdOn.ToString())) ? createdOn.ToString() : GetCreatedOnDateAsFmtString(ifcBuilding.OwnerHistory); facility.Category = GetCategory(ifcBuilding); facility.ProjectName = GetFacilityProjectName(ifcProject); facility.SiteName = GetFacilitySiteName(ifcSite); facility.LinearUnits = Context.WorkBookUnits.LengthUnit; facility.AreaUnits = Context.WorkBookUnits.AreaUnit; facility.VolumeUnits = Context.WorkBookUnits.VolumeUnit; facility.CurrencyUnit = Context.WorkBookUnits.MoneyUnit; string areaMeasurement = (ifcElementQuantityAreas == null) ? DEFAULT_STRING : ifcElementQuantityAreas.MethodOfMeasurement.ToString(); facility.AreaMeasurement = ((areaMeasurement == DEFAULT_STRING) || (areaMeasurement.ToLower().Contains("bim area"))) ? areaMeasurement : areaMeasurement + " BIM Area"; facility.ExternalSystem = GetExternalSystem(ifcBuilding); facility.ExternalProjectObject = "IfcProject"; facility.ExternalProjectIdentifier = ifcProject.GlobalId; facility.ExternalSiteObject = "IfcSite"; facility.ExternalSiteIdentifier = (ifcSite != null) ? ifcSite.GlobalId.ToString() : DEFAULT_STRING; facility.ExternalFacilityObject = "IfcBuilding"; facility.ExternalFacilityIdentifier = ifcBuilding.GlobalId; facility.Description = GetFacilityDescription(ifcBuilding); facility.ProjectDescription = GetFacilityProjectDescription(ifcProject); facility.SiteDescription = GetFacilitySiteDescription(ifcSite); facility.Phase = (string.IsNullOrEmpty(ifcProject.Phase.ToString())) ? DEFAULT_STRING : ifcProject.Phase.ToString(); facilities.AddRow(facility); //fill in the attribute information foreach (var ifcObject in ifcObjects) { attributeBuilder.RowParameters["Name"] = facility.Name; attributeBuilder.RowParameters["CreatedBy"] = facility.CreatedBy; attributeBuilder.RowParameters["CreatedOn"] = facility.CreatedOn; attributeBuilder.RowParameters["ExtSystem"] = facility.ExternalSystem; attributeBuilder.PopulateAttributesRows(ifcObject); //fill attribute sheet rows//pass data from this sheet info as Dictionary } } facilities.OrderBy(s => s.Name); ProgressIndicator.Finalise(); return(facilities); }
/// <summary> /// Fill sheet rows for Document sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieDocumentRow> Fill() { ProgressIndicator.ReportMessage("Starting Documents..."); //create new sheet COBieSheet <COBieDocumentRow> documents = new COBieSheet <COBieDocumentRow>(Constants.WORKSHEET_DOCUMENT); // get all IfcBuildingStory objects from IFC file IEnumerable <IfcDocumentInformation> docInfos = Model.Instances.OfType <IfcDocumentInformation>(); ProgressIndicator.Initialise("Creating Documents", docInfos.Count()); foreach (IfcDocumentInformation di in docInfos) { ProgressIndicator.IncrementAndUpdate(); COBieDocumentRow doc = new COBieDocumentRow(documents); doc.Name = (di == null) ? "" : di.Name.ToString(); //get the first associated document to extract the objects the document refers to IfcRelAssociatesDocument ifcRelAssociatesDocument = DocumentInformationForObjects(di).FirstOrDefault(); if ((ifcRelAssociatesDocument != null) && (ifcRelAssociatesDocument.OwnerHistory != null)) { doc.CreatedBy = GetTelecomEmailAddress(ifcRelAssociatesDocument.OwnerHistory); } else if (di.DocumentOwner != null) { if (di.DocumentOwner is IfcPersonAndOrganization) { doc.CreatedBy = GetTelecomEmailAddress(di.DocumentOwner as IfcPersonAndOrganization); } else if (di.DocumentOwner is IfcPerson) { doc.CreatedBy = GetEmail(null, di.DocumentOwner as IfcPerson); } else if (di.DocumentOwner is IfcOrganization) { doc.CreatedBy = GetEmail(di.DocumentOwner as IfcOrganization, null); } } else if ((Model.IfcProject as IfcRoot).OwnerHistory != null) { doc.CreatedBy = GetTelecomEmailAddress((Model.IfcProject as IfcRoot).OwnerHistory); } if ((ifcRelAssociatesDocument != null) && (ifcRelAssociatesDocument.OwnerHistory != null)) { doc.CreatedOn = GetCreatedOnDateAsFmtString(ifcRelAssociatesDocument.OwnerHistory); } else if (di.CreationTime != null) { doc.CreatedOn = di.CreationTime.ToString(); } else if ((Model.IfcProject as IfcRoot).OwnerHistory != null) { doc.CreatedOn = Context.RunDateTime; } doc.Category = (string.IsNullOrEmpty(di.Purpose.ToString())) ? DEFAULT_STRING :di.Purpose.ToString(); doc.ApprovalBy = (string.IsNullOrEmpty(di.IntendedUse.ToString())) ? DEFAULT_STRING : di.IntendedUse.ToString(); doc.Stage = (string.IsNullOrEmpty(di.Scope.ToString())) ? DEFAULT_STRING : di.Scope.ToString(); RelatedObjectInformation relatedObjectInfo = GetRelatedObjectInformation(ifcRelAssociatesDocument); doc.SheetName = relatedObjectInfo.SheetName; doc.RowName = relatedObjectInfo.Name; doc.ExtObject = relatedObjectInfo.ExtObject; doc.ExtIdentifier = relatedObjectInfo.ExtIdentifier; doc.ExtSystem = relatedObjectInfo.ExtSystem; FileInformation fileInfo = GetFileInformation(ifcRelAssociatesDocument); doc.File = fileInfo.Name; doc.Directory = GetDirectory(!string.IsNullOrWhiteSpace(fileInfo.Location) ? fileInfo.Location : fileInfo.Name); doc.Description = (string.IsNullOrEmpty(di.Description)) ? DEFAULT_STRING : di.Description.ToString(); doc.Reference = (string.IsNullOrEmpty(di.DocumentId.Value.ToString())) ? DEFAULT_STRING : di.DocumentId.Value.ToString(); documents.AddRow(doc); } documents.OrderBy(s => s.Name); ProgressIndicator.Finalise(); return(documents); }
/// <summary> /// Fill sheet rows for Zone sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieZoneRow> Fill() { ProgressIndicator.ReportMessage("Starting Zones..."); //Create new sheet COBieSheet <COBieZoneRow> zones = new COBieSheet <COBieZoneRow>(Constants.WORKSHEET_ZONE); // get all IfcBuildingStory objects from IFC file IEnumerable <IfcZone> ifcZones = Model.FederatedInstances.OfType <IfcZone>(); COBieDataPropertySetValues allPropertyValues = new COBieDataPropertySetValues(); //properties helper class COBieDataAttributeBuilder attributeBuilder = new COBieDataAttributeBuilder(Context, allPropertyValues); attributeBuilder.InitialiseAttributes(ref _attributes); //list of attributes to exclude form attribute sheet attributeBuilder.ExcludeAttributePropertyNamesWildcard.AddRange(Context.Exclude.Zone.AttributesContain); attributeBuilder.RowParameters["Sheet"] = "Zone"; //Also check to see if we have any zones within the spaces IEnumerable <IfcSpace> ifcSpaces = Model.FederatedInstances.OfType <IfcSpace>();//.OrderBy(ifcSpace => ifcSpace.Name, new CompareIfcLabel()); ProgressIndicator.Initialise("Creating Zones", ifcZones.Count() + ifcSpaces.Count()); foreach (IfcZone zn in ifcZones) { ProgressIndicator.IncrementAndUpdate(); // create zone for each space found Dictionary <String, COBieZoneRow> ExistingZones = new Dictionary <string, COBieZoneRow>(); IEnumerable <IfcSpace> spaces = (zn.IsGroupedBy == null) ? Enumerable.Empty <IfcSpace>() : zn.IsGroupedBy.RelatedObjects.OfType <IfcSpace>(); foreach (IfcSpace sp in spaces) { COBieZoneRow zone; if (ExistingZones.ContainsKey(zn.Name.ToString())) { zone = ExistingZones[zn.Name.ToString()]; zone.SpaceNames += "," + sp.Name.ToString(); } else { zone = new COBieZoneRow(zones); ExistingZones[zn.Name.ToString()] = zone; //set allPropertyValues to this element allPropertyValues.SetAllPropertyValues(zn); //set the internal filtered IfcPropertySingleValues List in allPropertyValues zone.Name = zn.Name.ToString(); string createBy = allPropertyValues.GetPropertySingleValueValue("COBieCreatedBy", false); //support for COBie Toolkit for Autodesk Revit zone.CreatedBy = ValidateString(createBy) ? createBy : GetTelecomEmailAddress(zn.OwnerHistory); string createdOn = allPropertyValues.GetPropertySingleValueValue("COBieCreatedOn", false); //support for COBie Toolkit for Autodesk Revit zone.CreatedOn = ValidateString(createdOn) ? createdOn : GetCreatedOnDateAsFmtString(zn.OwnerHistory); zone.Category = GetCategory(zn); zone.SpaceNames = sp.Name; string extSystem = allPropertyValues.GetPropertySingleValueValue("COBieExtSystem", false);//support for COBie Toolkit for Autodesk Revit zone.ExtSystem = ValidateString(extSystem) ? extSystem : GetExternalSystem(zn); zone.ExtObject = zn.GetType().Name; zone.ExtIdentifier = zn.GlobalId; string description = allPropertyValues.GetPropertySingleValueValue("COBieDescription", false);//support for COBie Toolkit for Autodesk Revit if (ValidateString(extSystem)) { zone.Description = extSystem; } else { zone.Description = (string.IsNullOrEmpty(zn.Description)) ? zn.Name.ToString() : zn.Description.ToString(); //if IsNullOrEmpty on Description then output Name } zones.AddRow(zone); //fill in the attribute information attributeBuilder.RowParameters["Name"] = zone.Name; attributeBuilder.RowParameters["CreatedBy"] = zone.CreatedBy; attributeBuilder.RowParameters["CreatedOn"] = zone.CreatedOn; attributeBuilder.RowParameters["ExtSystem"] = zone.ExtSystem; attributeBuilder.PopulateAttributesRows(zn); //fill attribute sheet rows//pass data from this sheet info as Dictionary } } } COBieDataPropertySetValues allSpacePropertyValues = new COBieDataPropertySetValues(); //get all property sets and associated properties in one go Dictionary <String, COBieZoneRow> myExistingZones = new Dictionary <string, COBieZoneRow>(); foreach (IfcSpace sp in ifcSpaces) { ProgressIndicator.IncrementAndUpdate(); allSpacePropertyValues.SetAllPropertyValues(sp); //set the space as the current object for the properties get glass IEnumerable <IfcPropertySingleValue> spProperties = Enumerable.Empty <IfcPropertySingleValue>(); foreach (KeyValuePair <IfcPropertySet, IEnumerable <IfcSimpleProperty> > item in allSpacePropertyValues.MapPsetToProps) { IfcPropertySet pset = item.Key; spProperties = item.Value.Where(p => p.Name.ToString().Contains("ZoneName")).OfType <IfcPropertySingleValue>(); //if we have no ifcZones or "ZoneName" properties, and the DepartmentsUsedAsZones flag is true then list departments as zones if ((!spProperties.Any()) && (!ifcZones.Any()) && (Context.DepartmentsUsedAsZones == true)) { spProperties = item.Value.Where(p => p.Name == "Department").OfType <IfcPropertySingleValue>(); } foreach (IfcPropertySingleValue spProp in spProperties) { COBieZoneRow zone; if (myExistingZones.ContainsKey(spProp.NominalValue.ToString())) { zone = myExistingZones[spProp.NominalValue.ToString()]; zone.SpaceNames += "," + sp.Name; } else { zone = new COBieZoneRow(zones); zone.Name = spProp.NominalValue.ToString(); myExistingZones[spProp.NominalValue.ToString()] = zone; zone.CreatedBy = GetTelecomEmailAddress(sp.OwnerHistory); zone.CreatedOn = GetCreatedOnDateAsFmtString(sp.OwnerHistory); zone.Category = spProp.Name; zone.SpaceNames = sp.Name; zone.ExtSystem = GetExternalSystem(pset); zone.ExtObject = spProp.GetType().Name; zone.ExtIdentifier = pset.GlobalId.ToString(); //IfcPropertySingleValue has no GlobalId so set to the holding IfcPropertySet zone.Description = (string.IsNullOrEmpty(spProp.NominalValue.ToString())) ? DEFAULT_STRING : spProp.NominalValue.ToString();; zones.AddRow(zone); } } } //spProperties = spProperties.OrderBy(p => p.Name.ToString(), new CompareString()); //consolidate test, Concat as looping spaces then sort then dump to COBieZoneRow foreach } zones.OrderBy(s => s.Name); ProgressIndicator.Finalise(); return(zones); }
/// <summary> /// Fill sheet rows for Impact sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet<COBieImpactRow> Fill() { ProgressIndicator.ReportMessage("Starting Impacts..."); //create new sheet COBieSheet<COBieImpactRow> impacts = new COBieSheet<COBieImpactRow>(Constants.WORKSHEET_IMPACT); // get all IfcPropertySet objects from IFC file IEnumerable<IfcPropertySet> ifcProperties = Model.Instances.OfType<IfcPropertySet>().Where(ps => ps.Name.ToString() == "Pset_EnvironmentalImpactValues"); ProgressIndicator.Initialise("Creating Impacts", ifcProperties.Count()); foreach (IfcPropertySet propSet in ifcProperties) { ProgressIndicator.IncrementAndUpdate(); COBieImpactRow impact = new COBieImpactRow(impacts); List<IfcSimpleProperty> propertyList = propSet.HasProperties.OfType<IfcSimpleProperty>().ToList(); Interval propValues = GetPropertyValue(propertyList, "ImpactName"); impact.Name = (propValues.Value == DEFAULT_STRING) ? propSet.Name.ToString() : propValues.Value.ToString(); impact.CreatedBy = GetTelecomEmailAddress(propSet.OwnerHistory); impact.CreatedOn = GetCreatedOnDateAsFmtString(propSet.OwnerHistory); propValues = GetPropertyValue(propertyList, "ImpactType"); impact.ImpactType = propValues.Value; propValues = GetPropertyValue(propertyList, "ImpactStage"); impact.ImpactStage = propValues.Value; IfcRoot ifcRoot = GetAssociatedObject(propSet); impact.SheetName = GetSheetByObjectType(ifcRoot.GetType()); impact.RowName = (!string.IsNullOrEmpty(ifcRoot.Name.ToString())) ? ifcRoot.Name.ToString() : DEFAULT_STRING; propValues = GetPropertyValue(propertyList, "Value"); impact.Value = propValues.Value; impact.ImpactUnit = propValues.Unit; propValues = GetPropertyValue(propertyList, "LeadInTime"); impact.LeadInTime = propValues.Value; propValues = GetPropertyValue(propertyList, "Duration"); impact.Duration = propValues.Value; propValues = GetPropertyValue(propertyList, "LeadOutTime"); impact.LeadOutTime = propValues.Value; impact.ExtSystem = GetExternalSystem(propSet); impact.ExtObject = propSet.GetType().Name; impact.ExtIdentifier = propSet.GlobalId; impact.Description = (propSet.Description != null) ? propSet.Description.ToString() : DEFAULT_STRING; impacts.AddRow(impact); } impacts.OrderBy(s => s.Name); ProgressIndicator.Finalise(); return impacts; }
/// <summary> /// Fill sheet rows for Component sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieComponentRow> Fill() { #if DEBUG Stopwatch timer = new Stopwatch(); timer.Start(); #endif ProgressIndicator.ReportMessage("Starting Components..."); //Create new sheet COBieSheet <COBieComponentRow> components = new COBieSheet <COBieComponentRow>(Constants.WORKSHEET_COMPONENT); IEnumerable <IfcRelAggregates> relAggregates = Model.FederatedInstances.OfType <IfcRelAggregates>(); IEnumerable <IfcRelContainedInSpatialStructure> relSpatial = Model.FederatedInstances.OfType <IfcRelContainedInSpatialStructure>(); IEnumerable <IfcObject> ifcElements = ((from x in relAggregates from y in x.RelatedObjects where !Context.Exclude.ObjectType.Component.Contains(y.GetType()) select y).Union(from x in relSpatial from y in x.RelatedElements where !Context.Exclude.ObjectType.Component.Contains(y.GetType()) select y)).OfType <IfcObject>(); //.GroupBy(el => el.Name).Select(g => g.First())//.Distinct().ToList(); COBieDataPropertySetValues allPropertyValues = new COBieDataPropertySetValues(); //properties helper class COBieDataAttributeBuilder attributeBuilder = new COBieDataAttributeBuilder(Context, allPropertyValues); attributeBuilder.InitialiseAttributes(ref _attributes); //set up filters on COBieDataPropertySetValues for the SetAttributes only attributeBuilder.ExcludeAttributePropertyNames.AddRange(Context.Exclude.Component.AttributesEqualTo); //we do not want listed properties for the attribute sheet so filter them out attributeBuilder.ExcludeAttributePropertyNamesWildcard.AddRange(Context.Exclude.Component.AttributesContain); //we do not want listed properties for the attribute sheet so filter them out attributeBuilder.RowParameters["Sheet"] = "Component"; ProgressIndicator.Initialise("Creating Components", ifcElements.Count()); foreach (var obj in ifcElements) { ProgressIndicator.IncrementAndUpdate(); COBieComponentRow component = new COBieComponentRow(components); IfcElement el = obj as IfcElement; if (el == null) { continue; } string name = el.Name.ToString(); if (string.IsNullOrEmpty(name)) { name = "Name Unknown " + UnknownCount.ToString(); UnknownCount++; } //set allPropertyValues to this element allPropertyValues.SetAllPropertyValues(el); //set the internal filtered IfcPropertySingleValues List in allPropertyValues component.Name = name; string createBy = allPropertyValues.GetPropertySingleValueValue("COBieCreatedBy", false); //support for COBie Toolkit for Autodesk Revit component.CreatedBy = ValidateString(createBy) ? createBy : GetTelecomEmailAddress(el.OwnerHistory); string createdOn = allPropertyValues.GetPropertySingleValueValue("COBieCreatedOn", false); //support for COBie Toolkit for Autodesk Revit component.CreatedOn = ValidateString(createdOn) ? createdOn : GetCreatedOnDateAsFmtString(el.OwnerHistory); component.TypeName = GetTypeName(el); component.Space = COBieHelpers.GetComponentRelatedSpace(el, Model, SpaceBoundingBoxInfo, Context); string description = allPropertyValues.GetPropertySingleValueValue("COBieDescription", false); //support for COBie Toolkit for Autodesk Revit component.Description = ValidateString(description) ? description : GetComponentDescription(el); string extSystem = allPropertyValues.GetPropertySingleValueValue("COBieExtSystem", false); //support for COBie Toolkit for Autodesk Revit component.ExtSystem = ValidateString(extSystem) ? extSystem : GetExternalSystem(el); component.ExtObject = el.GetType().Name; component.ExtIdentifier = el.GlobalId; //set from PropertySingleValues filtered via candidateProperties //set the internal filtered IfcPropertySingleValues List in allPropertyValues to this element set above component.SerialNumber = allPropertyValues.GetPropertySingleValueValue("SerialNumber", false); component.InstallationDate = GetDateFromProperty(allPropertyValues, "InstallationDate"); component.WarrantyStartDate = GetDateFromProperty(allPropertyValues, "WarrantyStartDate"); component.TagNumber = allPropertyValues.GetPropertySingleValueValue("TagNumber", false); component.BarCode = allPropertyValues.GetPropertySingleValueValue("BarCode", false); component.AssetIdentifier = allPropertyValues.GetPropertySingleValueValue("AssetIdentifier", false); components.AddRow(component); //fill in the attribute information attributeBuilder.RowParameters["Name"] = component.Name; attributeBuilder.RowParameters["CreatedBy"] = component.CreatedBy; attributeBuilder.RowParameters["CreatedOn"] = component.CreatedOn; attributeBuilder.RowParameters["ExtSystem"] = component.ExtSystem; attributeBuilder.PopulateAttributesRows(el); //fill attribute sheet rows } components.OrderBy(s => s.Name); ProgressIndicator.Finalise(); #if DEBUG timer.Stop(); Console.WriteLine("Time to generate Component data = {0} seconds", timer.Elapsed.TotalSeconds.ToString("F3")); #endif return(components); }
/// <summary> /// Fill sheet rows for Issue sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieIssueRow> Fill() { ProgressIndicator.ReportMessage("Starting Issues..."); var ifcProject = Model.Instances.FirstOrDefault <IIfcProject>(); Debug.Assert(ifcProject != null); //create new sheet var issues = new COBieSheet <COBieIssueRow>(Constants.WORKSHEET_ISSUE); //IEnumerable<IfcPropertySet> ifcProperties = Model.FederatedInstances.OfType<IfcPropertySet>().Where(ps => ps.Name.ToString() == "Pset_Risk"); // get all IfcApproval objects from IFC file IEnumerable <IfcApproval> ifcApprovals = Model.FederatedInstances.OfType <IfcApproval>(); ProgressIndicator.Initialise("Creating Issues", ifcApprovals.Count()); List <IfcRelAssociatesApproval> ifcRelAssociatesApprovals = Model.FederatedInstances.OfType <IfcRelAssociatesApproval>().ToList(); foreach (IfcApproval ifcApproval in ifcApprovals) { ProgressIndicator.IncrementAndUpdate(); COBieIssueRow issue = new COBieIssueRow(issues); //get the associated property setIfcPropertySet var ifcPropertySet = ifcRelAssociatesApprovals .Where(ral => ral.RelatingApproval == ifcApproval) .SelectMany(ral => ral.RelatedObjects.OfType <IfcPropertySet>()) .Where(ps => ps.Name == "Pset_Risk") .FirstOrDefault(); List <IfcSimpleProperty> propertyList = new List <IfcSimpleProperty>(); if (ifcPropertySet != null) { propertyList = ifcPropertySet.HasProperties.OfType <IfcSimpleProperty>().ToList(); } issue.Name = (string.IsNullOrEmpty(ifcApproval.Name)) ? DEFAULT_STRING : ifcApproval.Name.ToString(); //lets default the creator to that user who created the project for now, no direct link to OwnerHistory on IfcApproval if (ifcPropertySet != null) { //use "Pset_Risk" Property Set as source for this issue.CreatedBy = GetTelecomEmailAddress(ifcPropertySet.OwnerHistory); issue.CreatedOn = GetCreatedOnDateAsFmtString(ifcPropertySet.OwnerHistory); } else { //if property set is null use project defaults issue.CreatedBy = GetTelecomEmailAddress(ifcProject.OwnerHistory); issue.CreatedOn = GetCreatedOnDateAsFmtString(ifcProject.OwnerHistory); } Interval propValues = GetPropertyEnumValue(propertyList, "RiskType"); issue.Type = propValues.Value; propValues = GetPropertyEnumValue(propertyList, "RiskRating"); issue.Risk = propValues.Value; propValues = GetPropertyEnumValue(propertyList, "AssessmentOfRisk"); issue.Chance = propValues.Value; propValues = GetPropertyEnumValue(propertyList, "RiskConsequence"); issue.Impact = propValues.Value; //GetIt(typeof(IfcApproval)); //Risk assessment has to be on a task so we should have one List <IfcRoot> IfcRoots = GetIfcObjects(ifcApproval); issue.SheetName1 = (IfcRoots.Count > 0) ? GetSheetByObjectType(IfcRoots[0].GetType()) : DEFAULT_STRING; issue.RowName1 = (IfcRoots.Count > 0) ? IfcRoots[0].Name.ToString() : DEFAULT_STRING; //assuming that this row is a person associated with the ifcApproval, but might be a task string email = GetContact(ifcApproval); if (email == DEFAULT_STRING) //if no email, see if we have another ifcobject { issue.SheetName2 = (IfcRoots.Count > 1) ? GetSheetByObjectType(IfcRoots[1].GetType()) : DEFAULT_STRING; issue.RowName2 = (IfcRoots.Count > 1) ? IfcRoots[1].Name.ToString() : DEFAULT_STRING; } else { issue.SheetName2 = (email != DEFAULT_STRING) ? Constants.WORKSHEET_CONTACT : DEFAULT_STRING; issue.RowName2 = (email != DEFAULT_STRING) ? email : DEFAULT_STRING; } issue.Description = (string.IsNullOrEmpty(ifcApproval.Description.ToString())) ? DEFAULT_STRING : ifcApproval.Description.ToString(); propValues = GetPropertyEnumValue(propertyList, "RiskOwner"); issue.Owner = propValues.Value; propValues = GetPropertyValue(propertyList, "PreventiveMeassures"); issue.Mitigation = propValues.Value; issue.ExtSystem = (ifcPropertySet != null) ? GetExternalSystem(ifcPropertySet) : DEFAULT_STRING; issue.ExtObject = ifcApproval.GetType().Name; issue.ExtIdentifier = ifcApproval.Identifier.ToString(); issues.AddRow(issue); } issues.OrderBy(s => s.Name); ProgressIndicator.Finalise(); return(issues); }