예제 #1
0
        /// <summary>
        /// Gets the Gross Floor Area, if the element base quantity GrossFloorArea is defined this has precedence
        /// If no property is defined the GFA is returned as the sume of the building storeys GFA
        /// </summary>
        /// <param name="building"></param>
        /// <returns></returns>
        public static IfcAreaMeasure?GetGrossFloorArea(this IfcBuilding building)
        {
            IfcQuantityArea qArea = building.GetQuantity <IfcQuantityArea>("BaseQuantities", "GrossFloorArea");

            if (qArea == null)
            {
                qArea = building.GetQuantity <IfcQuantityArea>("GrossFloorArea");               //just look for any area
            }
            if (qArea != null)
            {
                return(qArea.AreaValue);
            }
            IfcAreaMeasure area = 0;

            foreach (IfcBuildingStorey buildingStorey in building.GetBuildingStoreys())
            {
                IfcAreaMeasure?bsArea = buildingStorey.GetGrossFloorArea();
                if (bsArea.HasValue)
                {
                    area += bsArea;
                }
            }
            if (area != 0)
            {
                return(area);
            }
            return(null);
        }
예제 #2
0
        private IEnumerable <IfcSpace> GetAllSpaces(IfcBuilding ifcBuilding)
        {
            var spaces = new HashSet <IfcSpace>();

            foreach (var space in ifcBuilding.GetSpaces().ToList())
            {
                spaces.Add(space);
            }
            foreach (var storey in ifcBuilding.GetBuildingStoreys().ToList())
            {
                foreach (var storeySpace in storey.GetSpaces().ToList())
                {
                    spaces.Add(storeySpace);
                    foreach (var spaceSpace in storeySpace.GetSpaces().ToList())
                    {
                        spaces.Add(spaceSpace); //get sub spaces
                    }
                }
            }
            return(spaces);
        }
예제 #3
0
        protected override Facility Mapping(IfcBuilding ifcBuilding, Facility facility)
        {
            var helper = ((IfcToCOBieLiteUkExchanger)Exchanger).Helper;
            var model  = ifcBuilding.ModelOf;

            facility.ExternalEntity = helper.ExternalEntityName(ifcBuilding);
            facility.ExternalId     = helper.ExternalEntityIdentity(ifcBuilding);
            facility.ExternalSystem = helper.ExternalSystemName(ifcBuilding);
            facility.Name           = helper.GetFacilityName(ifcBuilding);
            facility.Description    = ifcBuilding.Description;
            facility.CreatedBy      = helper.GetCreatedBy(ifcBuilding);
            facility.CreatedOn      = helper.GetCreatedOn(ifcBuilding);
            facility.Categories     = helper.GetCategories(ifcBuilding);
            var ifcProject = model.Instances.OfType <IfcProject>().FirstOrDefault();

            if (ifcProject != null)
            {
                if (facility.Categories == null) //use the project Categories instead
                {
                    facility.Categories = helper.GetCategories(ifcProject);
                }
                facility.Project = new Project();
                var projectMapping = Exchanger.GetOrCreateMappings <MappingIfcProjectToProject>();
                projectMapping.AddMapping(ifcProject, facility.Project);
                var ifcSite     = ifcProject.GetSpatialStructuralElements().FirstOrDefault(p => p is IfcSite) as IfcSite;
                var siteMapping = Exchanger.GetOrCreateMappings <MappingIfcSiteToSite>();
                if (ifcSite != null)
                {
                    facility.Site = new Site();
                    siteMapping.AddMapping(ifcSite, facility.Site);
                }
                else //create a default "External area"
                {
                    facility.Site = new Site
                    {
                        Description = "Default  area if no site has been defined in the model",
                        Name        = "Default"
                    };
                }
                facility.AreaUnits    = helper.ModelAreaUnit ?? AreaUnit.notdefined;
                facility.LinearUnits  = helper.ModelLinearUnit ?? LinearUnit.notdefined;
                facility.VolumeUnits  = helper.ModelVolumeUnit ?? VolumeUnit.notdefined;
                facility.CurrencyUnit = helper.ModelCurrencyUnit ?? CurrencyUnit.notdefined;

                var storeys     = ifcBuilding.GetBuildingStoreys(true);
                var cobieFloors = storeys.Cast <IfcSpatialStructureElement>().ToList();
                cobieFloors.Add(ifcSite);
                cobieFloors.Add(ifcBuilding);

                facility.Floors = new List <Floor>(cobieFloors.Count);
                var floorMappings = Exchanger.GetOrCreateMappings <MappingIfcSpatialStructureElementToFloor>();
                for (int i = 0; i < cobieFloors.Count; i++)
                {
                    var floor = new Floor();
                    floor = floorMappings.AddMapping(cobieFloors[i], floor);
                    facility.Floors.Add(floor);
                }
            }
            //Attributes
            facility.Attributes = helper.GetAttributes(ifcBuilding);

            //Zones

            var allSpaces = GetAllSpaces(ifcBuilding);
            var allZones  = GetAllZones(allSpaces, helper);
            var ifcZones  = allZones.ToArray();

            if (ifcZones.Any())
            {
                facility.Zones = new List <Zone>(ifcZones.Length);
                var zoneMappings = Exchanger.GetOrCreateMappings <MappingIfcZoneToZone>();
                for (int i = 0; i < ifcZones.Length; i++)
                {
                    var zone = new Zone();
                    zone = zoneMappings.AddMapping(ifcZones[i], zone);
                    facility.Zones.Add(zone);
                }
            }

            //Assets
            //  var allIfcElementsinThisFacility = new HashSet<IfcElement>(helper.GetAllAssets(ifcBuilding));

            //AssetTypes
            //Get all assets that are in this facility/building
            //Asset Types are groups of assets that share a common typology
            //Some types are defined explicitly in the ifc file some have to be inferred

            var allIfcTypes = helper.DefiningTypeObjectMap.OrderBy(t => t.Key.Name);

            if (allIfcTypes.Any())
            {
                facility.AssetTypes = new List <AssetType>();
                var assetTypeMappings = Exchanger.GetOrCreateMappings <MappingXbimIfcProxyTypeObjectToAssetType>();
                foreach (var elementsByType in allIfcTypes)
                {
                    if (elementsByType.Value.Any())
                    {
                        var assetType = new AssetType();
                        assetType = assetTypeMappings.AddMapping(elementsByType.Key, assetType);
                        facility.AssetTypes.Add(assetType);
                    }
                }
            }

            //Systems

            var ifcSystems = helper.SystemAssignment;

            if (ifcSystems.Any())
            {
                facility.Systems = new List <Xbim.COBieLiteUK.System>(ifcSystems.Count);
                var systemMappings = Exchanger.GetOrCreateMappings <MappingIfcSystemToSystem>();
                foreach (var ifcSystem in ifcSystems.Keys)
                {
                    var system = new Xbim.COBieLiteUK.System();
                    system = systemMappings.AddMapping(ifcSystem, system);
                    facility.Systems.Add(system);
                }
            }

            //Contacts
            var ifcActorSelects = helper.Contacts;

            if (ifcActorSelects != null && ifcActorSelects.Any())
            {
                var cobieContacts   = new List <Contact>(ifcActorSelects.Count());
                var contactMappings = Exchanger.GetOrCreateMappings <MappingIfcActorToContact>();
                foreach (var actor in ifcActorSelects)
                {
                    var contact = new Contact();
                    contact = contactMappings.AddMapping(actor, contact);
                    cobieContacts.Add(contact);
                }
                facility.Contacts = cobieContacts.Distinct(new ContactComparer()).ToList();
            }

            //assign all unallocated spaces to a zone
            var spaces      = facility.Get <Space>().ToList();
            var zones       = facility.Zones ?? new List <Zone>();
            var defaultZone = helper.CreateXbimDefaultZone();

            foreach (
                var space in
                spaces.Where(
                    space => !zones.Any(z => z.Spaces != null && z.Spaces.Select(s => s.Name).Contains(space.Name)))
                )
            {
                if (facility.Zones == null)
                {
                    facility.Zones = new List <Zone>();
                }

                defaultZone.Spaces.Add(new SpaceKey {
                    Name = space.Name
                });
            }
            if (facility.Zones != null)
            {
                facility.Zones.Add(defaultZone);
            }
            //assign all assets that are not in a system to the default
            var assetTypes             = facility.Get <AssetType>().ToList();
            var systemsWritten         = facility.Get <Xbim.COBieLiteUK.System>();
            var assetsAssignedToSystem = new HashSet <string>(systemsWritten.SelectMany(s => s.Components).Select(a => a.Name));
            var systems       = facility.Systems ?? new List <Xbim.COBieLiteUK.System>();
            var defaultSystem = helper.CreateUndefinedSystem();

            //go over all unasigned assets
            foreach (var assetType in assetTypes)
            {
                Xbim.COBieLiteUK.System assetTypeSystem = null;
                foreach (var asset in assetType.Assets.Where(a => !assetsAssignedToSystem.Contains(a.Name)))
                {
                    if (assetTypeSystem == null)
                    {
                        assetTypeSystem      = helper.CreateUndefinedSystem();
                        assetTypeSystem.Name = string.Format("System {0} ", assetType.Name);
                    }
                    assetTypeSystem.Components.Add(new AssetKey {
                        Name = asset.Name
                    });
                }
                if (facility.Systems == null)
                {
                    facility.Systems = new List <Xbim.COBieLiteUK.System>();
                }
                facility.Systems.Add(assetTypeSystem);
            }


            //write out contacts created in the process
            if (helper.SundryContacts.Any())
            {
                if (facility.Contacts == null)
                {
                    facility.Contacts = new List <Contact>();
                }
                facility.Contacts.AddRange(helper.SundryContacts.Values);
            }

            helper.SundryContacts.Clear(); //clear ready for processing next facility
            return(facility);
        }
예제 #4
0
        protected override Facility Mapping(IfcBuilding ifcBuilding, Facility facility)
        {
            //Helper should do 10% of progress
            Exchanger.ReportProgress.NextStage(4, 42, string.Format("Creating Facility {0}", ifcBuilding.Name != null ? ifcBuilding.Name.ToString() : string.Empty));//finish progress at 42%
            var helper = ((IfcToCOBieLiteUkExchanger)Exchanger).Helper;
            var model  = ifcBuilding.ModelOf;

            facility.ExternalEntity = helper.ExternalEntityName(ifcBuilding);
            facility.ExternalId     = helper.ExternalEntityIdentity(ifcBuilding);
            facility.AltExternalId  = ifcBuilding.GlobalId;
            facility.ExternalSystem = helper.ExternalSystemName(ifcBuilding);
            facility.Name           = helper.GetFacilityName(ifcBuilding);
            facility.Description    = ifcBuilding.Description;
            facility.CreatedBy      = helper.GetCreatedBy(ifcBuilding);
            facility.CreatedOn      = helper.GetCreatedOn(ifcBuilding);
            facility.Categories     = helper.GetCategories(ifcBuilding);
            var ifcProject = model.Instances.OfType <IfcProject>().FirstOrDefault();

            if (ifcProject != null)
            {
                if (facility.Categories == null) //use the project Categories instead
                {
                    facility.Categories = helper.GetCategories(ifcProject);
                }
                facility.Project = new Project();
                var projectMapping = Exchanger.GetOrCreateMappings <MappingIfcProjectToProject>();
                projectMapping.AddMapping(ifcProject, facility.Project);
                Exchanger.ReportProgress.IncrementAndUpdate();
                var ifcSite     = ifcProject.GetSpatialStructuralElements().FirstOrDefault(p => p is IfcSite) as IfcSite;
                var siteMapping = Exchanger.GetOrCreateMappings <MappingIfcSiteToSite>();

                //Facility Attributes
                facility.Attributes = helper.GetAttributes(ifcBuilding);

                if (ifcSite != null)
                {
                    facility.Site = new Site();
                    siteMapping.AddMapping(ifcSite, facility.Site);

                    if (ifcSite.RefLatitude.HasValue && ifcSite.RefLongitude.HasValue)
                    {
                        facility.Attributes.Add(helper.MakeAttribute(ifcSite, "RefLatitude", ifcSite.RefLatitude.Value.ToDouble()));
                        facility.Attributes.Add(helper.MakeAttribute(ifcSite, "RefLongtitude", ifcSite.RefLongitude.Value.ToDouble()));
                    }
                }
                else //create a default "External area"
                {
                    facility.Site = new Site
                    {
                        Description = "Default area if no site has been defined in the model",
                        Name        = "Default"
                    };
                }
                Exchanger.ReportProgress.IncrementAndUpdate();
                facility.AreaUnits    = helper.ModelAreaUnit ?? AreaUnit.notdefined;
                facility.LinearUnits  = helper.ModelLinearUnit ?? LinearUnit.notdefined;
                facility.VolumeUnits  = helper.ModelVolumeUnit ?? VolumeUnit.notdefined;
                facility.CurrencyUnit = helper.ModelCurrencyUnit ?? CurrencyUnit.notdefined;

                var storeys     = ifcBuilding.GetBuildingStoreys(true);
                var cobieFloors = storeys.Cast <IfcSpatialStructureElement>().ToList();
                if (ifcSite != null)
                {
                    cobieFloors.Add(ifcSite);
                }
                Exchanger.ReportProgress.IncrementAndUpdate();
                if (ifcBuilding != null)
                {
                    cobieFloors.Add(ifcBuilding);
                }
                Exchanger.ReportProgress.IncrementAndUpdate();
                facility.Floors = new List <Floor>(cobieFloors.Count);
                Exchanger.ReportProgress.NextStage(cobieFloors.Count, 50); //finish progress at 50%
                var floorMappings = Exchanger.GetOrCreateMappings <MappingIfcSpatialStructureElementToFloor>();
                for (int i = 0; i < cobieFloors.Count; i++)
                {
                    var floor = new Floor();
                    floor = floorMappings.AddMapping(cobieFloors[i], floor);
                    facility.Floors.Add(floor);
                    Exchanger.ReportProgress.IncrementAndUpdate();
                }
            }


            //Documents
            var docsMappings = Exchanger.GetOrCreateMappings <MappingIfcDocumentSelectToDocument>();

            helper.AddDocuments(docsMappings, facility, ifcBuilding);
            if (helper.OrphanDocs.Any())
            {
                foreach (var docSel in helper.OrphanDocs)
                {
                    List <Document> docs = docsMappings.MappingMulti(docSel);
                    facility.Documents.AddRange(docs);
                }
            }

            //Zones

            var allSpaces = GetAllSpaces(ifcBuilding);
            var allZones  = GetAllZones(allSpaces, helper);
            var ifcZones  = allZones.ToArray();

            if (ifcZones.Any())
            {
                Exchanger.ReportProgress.NextStage(ifcZones.Count(), 65); //finish progress at 65%
                facility.Zones = new List <Zone>(ifcZones.Length);
                var zoneMappings = Exchanger.GetOrCreateMappings <MappingIfcZoneToZone>();
                for (int i = 0; i < ifcZones.Length; i++)
                {
                    var zone = new Zone();
                    zone = zoneMappings.AddMapping(ifcZones[i], zone);
                    facility.Zones.Add(zone);
                    Exchanger.ReportProgress.IncrementAndUpdate();
                }
            }

            //Assets
            //  var allIfcElementsinThisFacility = new HashSet<IfcElement>(helper.GetAllAssets(ifcBuilding));

            //AssetTypes
            //Get all assets that are in this facility/building
            //Asset Types are groups of assets that share a common typology
            //Some types are defined explicitly in the ifc file some have to be inferred

            var allIfcTypes = helper.DefiningTypeObjectMap.OrderBy(t => t.Key.Name);

            if (allIfcTypes.Any())
            {
                Exchanger.ReportProgress.NextStage(allIfcTypes.Count(), 90); //finish progress at 90%
                facility.AssetTypes = new List <AssetType>();
                var assetTypeMappings = Exchanger.GetOrCreateMappings <MappingXbimIfcProxyTypeObjectToAssetType>();
                foreach (var elementsByType in allIfcTypes)
                {
                    if (elementsByType.Value.Any())
                    {
                        var assetType = new AssetType();
                        assetType = assetTypeMappings.AddMapping(elementsByType.Key, assetType);
                        facility.AssetTypes.Add(assetType);
                        Exchanger.ReportProgress.IncrementAndUpdate();
                    }
                }
            }

            //Systems

            facility.Systems = new List <Xbim.COBieLiteUK.System>();

            if (helper.SystemMode.HasFlag(SystemExtractionMode.System) && helper.SystemAssignment.Any())
            {
                var systemMappings = Exchanger.GetOrCreateMappings <MappingIfcSystemToSystem>();
                Exchanger.ReportProgress.NextStage(helper.SystemAssignment.Keys.Count(), 95); //finish progress at 95%
                foreach (var ifcSystem in helper.SystemAssignment.Keys)
                {
                    var system = new Xbim.COBieLiteUK.System();
                    system = systemMappings.AddMapping(ifcSystem, system);
                    facility.Systems.Add(system);
                    Exchanger.ReportProgress.IncrementAndUpdate();
                }
            }

            //Get systems via propertySets
            if (helper.SystemMode.HasFlag(SystemExtractionMode.PropertyMaps) && helper.SystemViaPropAssignment.Any())
            {
                var systemMappings = Exchanger.GetOrCreateMappings <MappingSystemViaIfcPropertyToSystem>();
                Exchanger.ReportProgress.NextStage(helper.SystemAssignment.Keys.Count(), 96); //finish progress at 95%
                foreach (var ifcPropSet in helper.SystemViaPropAssignment.Keys)
                {
                    var system = new Xbim.COBieLiteUK.System();
                    system = systemMappings.AddMapping(ifcPropSet, system);
                    var init = facility.Systems.Where(sys => sys.Name.Equals(system.Name, netSystem.StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault();
                    if (init != null)
                    {
                        var idx = facility.Systems.IndexOf(init);
                        facility.Systems[idx].Components = facility.Systems[idx].Components.Concat(system.Components).Distinct(new AssetKeyCompare()).ToList();
                    }
                    else
                    {
                        facility.Systems.Add(system);
                    }
                    Exchanger.ReportProgress.IncrementAndUpdate();
                }
            }


            //Contacts
            var ifcActorSelects = helper.Contacts;

            if (ifcActorSelects != null && ifcActorSelects.Any())
            {
                Exchanger.ReportProgress.NextStage(ifcActorSelects.Count(), 97); //finish progress at 97%
                var cobieContacts   = new List <Contact>(ifcActorSelects.Count());
                var contactMappings = Exchanger.GetOrCreateMappings <MappingIfcActorToContact>();
                foreach (var actor in ifcActorSelects)
                {
                    var contact = new Contact();
                    contact = contactMappings.AddMapping(actor, contact);
                    cobieContacts.Add(contact);
                    Exchanger.ReportProgress.IncrementAndUpdate();
                }
                facility.Contacts = cobieContacts.Distinct(new ContactComparer()).ToList();
            }

            //assign all unallocated spaces to a zone
            var spaces            = facility.Get <Space>().ToList();
            var zones             = facility.Zones ?? new List <Zone>();
            var unAllocatedSpaces = spaces.Where(space => !zones.Any(z => z.Spaces != null && z.Spaces.Select(s => s.Name).Contains(space.Name)));

            Exchanger.ReportProgress.NextStage(unAllocatedSpaces.Count(), 98); //finish progress at 98%
            var defaultZone = helper.CreateXbimDefaultZone();

            foreach (var space in unAllocatedSpaces)
            {
                if (facility.Zones == null)
                {
                    facility.Zones = new List <Zone>();
                }

                defaultZone.Spaces.Add(new SpaceKey {
                    Name = space.Name
                });
                Exchanger.ReportProgress.IncrementAndUpdate();
            }
            if (facility.Zones != null)
            {
                facility.Zones.Add(defaultZone);
            }

            //assign all assets that are not in a system to the default
            if (helper.SystemMode.HasFlag(SystemExtractionMode.Types))
            {
                var assetTypes             = facility.Get <AssetType>().ToList();
                var systemsWritten         = facility.Get <Xbim.COBieLiteUK.System>();
                var assetsAssignedToSystem = new HashSet <string>(systemsWritten.SelectMany(s => s.Components).Select(a => a.Name));
                var systems       = facility.Systems ?? new List <Xbim.COBieLiteUK.System>();
                var defaultSystem = helper.CreateUndefinedSystem();
                Exchanger.ReportProgress.NextStage(assetTypes.Count(), 100); //finish progress at 100%
                //go over all unasigned assets
                foreach (var assetType in assetTypes)
                {
                    Xbim.COBieLiteUK.System assetTypeSystem = null;
                    foreach (var asset in assetType.Assets.Where(a => !assetsAssignedToSystem.Contains(a.Name)))
                    {
                        if (assetTypeSystem == null)
                        {
                            assetTypeSystem      = helper.CreateUndefinedSystem();
                            assetTypeSystem.Name = string.Format("Type System {0} ", assetType.Name);
                        }
                        assetTypeSystem.Components.Add(new AssetKey {
                            Name = asset.Name
                        });
                    }

                    //add to tle list only if it is not null
                    if (assetTypeSystem == null)
                    {
                        continue;
                    }
                    if (facility.Systems == null)
                    {
                        facility.Systems = new List <Xbim.COBieLiteUK.System>();
                    }
                    facility.Systems.Add(assetTypeSystem);
                    Exchanger.ReportProgress.IncrementAndUpdate();
                }
            }


            //write out contacts created in the process
            if (helper.SundryContacts.Any())
            {
                if (facility.Contacts == null)
                {
                    facility.Contacts = new List <Contact>();
                }
                facility.Contacts.AddRange(helper.SundryContacts.Values);
            }

            helper.SundryContacts.Clear();          //clear ready for processing next facility

            Exchanger.ReportProgress.Finalise(500); //finish with 500 millisecond delay

            return(facility);
        }
예제 #5
0
        public FacilityType(IfcBuilding ifcBuilding, CoBieLiteHelper helper)
            : this()
        {
            //   _ifcBuilding = ifcBuilding;
            var model = ifcBuilding.ModelOf;

            externalEntityName  = helper.ExternalEntityName(ifcBuilding);
            externalID          = helper.ExternalEntityIdentity(ifcBuilding);
            externalSystemName  = helper.ExternalSystemName(ifcBuilding);
            FacilityName        = ifcBuilding.Name;
            FacilityDescription = ifcBuilding.Description;
            FacilityCategory    = helper.GetClassification(ifcBuilding);
            var ifcProject = model.Instances.OfType <IfcProject>().FirstOrDefault();

            if (ifcProject != null)
            {
                ProjectAssignment = new ProjectType(ifcProject, helper);
                var ifcSite = ifcProject.GetSpatialStructuralElements().FirstOrDefault(p => p is IfcSite) as IfcSite;
                if (ifcSite != null)
                {
                    SiteAssignment = new SiteType(ifcSite, helper);
                }
                SetDefaultUnits(helper);
                FacilityDeliverablePhaseName = ifcProject.Phase;
                var storeys            = ifcBuilding.GetBuildingStoreys(true);
                var ifcBuildingStories = storeys as IList <IfcBuildingStorey> ?? storeys.ToList();
                if (ifcBuildingStories.Any())
                {
                    Floors = new FloorCollectionType {
                        Floor = new FloorType[ifcBuildingStories.Count]
                    };
                    for (int i = 0; i < ifcBuildingStories.Count; i++)
                    {
                        Floors.Floor[i] = new FloorType(ifcBuildingStories[i], helper);
                    }
                }
            }
            //Attributes
            AttributeType[] ifcAttributes = helper.GetAttributes(ifcBuilding);
            if (ifcAttributes != null && ifcAttributes.Length > 0)
            {
                FacilityAttributes = new AttributeCollectionType {
                    Attribute = ifcAttributes
                }
            }
            ;

            //Zones

            var allSpaces = GetAllSpaces(ifcBuilding);
            var allZones  = GetAllZones(allSpaces, helper);
            var ifcZones  = allZones.ToArray();

            if (ifcZones.Any())
            {
                Zones = new ZoneCollectionType {
                    Zone = new ZoneTypeBase[ifcZones.Length]
                };
                for (int i = 0; i < ifcZones.Length; i++)
                {
                    Zones.Zone[i] = new ZoneType(ifcZones[i], helper);
                }
            }

            //Assets
            var allAssetsinThisFacility = new HashSet <IfcElement>(helper.GetAllAssets(ifcBuilding));

            //AssetTypes
            //Get all assets that are in this facility/building
            var allAssetTypesInThisFacility = AllAssetTypesInThisFacility(ifcBuilding, allAssetsinThisFacility, helper);

            if (allAssetTypesInThisFacility.Any())
            {
                AssetTypes = new AssetTypeCollectionType
                {
                    AssetType = new AssetTypeInfoType[allAssetTypesInThisFacility.Count]
                };
                for (int i = 0; i < allAssetTypesInThisFacility.Count; i++)
                {
                    AssetTypes.AssetType[i] = new AssetTypeInfoType(allAssetTypesInThisFacility[i], helper);
                }
            }

            //Systems
            var allSystemsInThisFacility = helper.SystemAssignment
                                           .Where(v => v.Value.Any(allAssetsinThisFacility.Contains))
                                           .Select(k => k.Key).ToArray();

            if (allSystemsInThisFacility.Any())
            {
                Systems = new SystemCollectionType
                {
                    System = new SystemTypeBase[allSystemsInThisFacility.Length]
                };

                for (int i = 0; i < allSystemsInThisFacility.Length; i++)
                {
                    Systems.System[i] = new SystemType(allSystemsInThisFacility[i], helper);
                }
            }

            //Contacts
            var contacts  = helper.GetContacts();
            var ifcActors = contacts as IfcActorSelect[] ?? contacts.ToArray();

            if (ifcActors.Any())
            {
                Contacts = new ContactCollectionType
                {
                    Contact = new ContactTypeBase[ifcActors.Length]
                };

                for (int i = 0; i < ifcActors.Length; i++)
                {
                    Contacts.Contact[i] = new ContactType(ifcActors[i], helper);
                }
            }
        }