public SystemType(IfcSystem ifcSystem, CoBieLiteHelper helper) : this() { externalEntityName = helper.ExternalEntityName(ifcSystem); externalID = helper.ExternalEntityIdentity(ifcSystem); externalSystemName = helper.ExternalSystemName(ifcSystem); SystemName = ifcSystem.Name; SystemDescription = ifcSystem.Description; SystemCategory = helper.GetClassification(ifcSystem); //Attributes var ifcAttributes = helper.GetAttributes(ifcSystem); if (ifcAttributes != null && ifcAttributes.Any()) { SystemAttributes = new AttributeCollectionType { Attribute = ifcAttributes } } ; //TODO: //System Issues //System Documents }
/// <summary> /// Create an instance of an group object via a string name /// </summary> /// <param name="groupTypeName">String holding object type name we want to create</param> /// <returns></returns> public IfcSystem GetGroupInstance(string groupTypeName) { groupTypeName = groupTypeName.Trim().ToUpper(); ExpressType ifcType; IfcSystem ifcSystem = null; if ((Model.Metadata.TryGetExpressType(groupTypeName, out ifcType)) && (typeof(IfcSystem).IsAssignableFrom(ifcType.Type)) //check it is a system class name ) { MethodInfo method = typeof(IEntityCollection).GetMethod("New", Type.EmptyTypes); MethodInfo generic = method.MakeGenericMethod(ifcType.Type); var eleObj = generic.Invoke(Model.Instances, null); var obj = eleObj as IfcSystem; if (obj != null) { ifcSystem = obj; } } if (ifcSystem == null) { ifcSystem = Model.Instances.New <IfcSystem>(); } return(ifcSystem); }
public bool isApplicable(IfcFlowSegment flowSegment) { // Doubled up Ifc Classification and Uniclass to be confirmed.... IfcPropertySingleValue propertySingleValue = null; IfcSystem system = flowSegment.HasAssignments.OfType <IfcRelAssignsToGroup>().Select(x => x.RelatingGroup).OfType <IfcSystem>().FirstOrDefault(); if (system != null) { propertySingleValue = system.FindProperty("TfNSW_Uniclass_AssetCode") as IfcPropertySingleValue; if (propertySingleValue != null) { if (!propertySingleValue.ValueStringStartsWith("Ss_50_30")) //Drainage collection and distribution systems { return(false); } } IfcDistributionSystem distributionSystem = system as IfcDistributionSystem; if (distributionSystem != null) //IFC4 concept { if (distributionSystem.PredefinedType != IfcDistributionSystemEnum.DRAINAGE) { return(false); } } } propertySingleValue = flowSegment.FindProperty("TfNSW_Uniclass_AssetCode") as IfcPropertySingleValue; if (propertySingleValue != null) { if (propertySingleValue.ValueStringStartsWith("Pr_65_52_63")) // Pipes and fittings { return(true); } } if (flowSegment is IfcDuctSegment) { return(false); } if (flowSegment is IfcCableCarrierSegment) { return(false); } IfcTypeObject typeObject = flowSegment.RelatingType(); if (typeObject is IfcDuctSegmentType) { return(false); } if (typeObject is IfcCableCarrierSegmentType) { return(false); } return(true); }
protected override Xbim.COBieLiteUK.System Mapping(IfcSystem ifcSystem, Xbim.COBieLiteUK.System target) { var helper = ((IfcToCOBieLiteUkExchanger)Exchanger).Helper; target.ExternalEntity = helper.ExternalEntityName(ifcSystem); target.ExternalId = helper.ExternalEntityIdentity(ifcSystem); target.AltExternalId = ifcSystem.GlobalId; target.ExternalSystem = helper.ExternalSystemName(ifcSystem); target.Name = ifcSystem.Name; target.Description = ifcSystem.Description; target.CreatedBy = helper.GetCreatedBy(ifcSystem); target.CreatedOn = helper.GetCreatedOn(ifcSystem); target.Categories = helper.GetCategories(ifcSystem); //Add Assets var systemAssignments = helper.GetSystemAssignments(ifcSystem); var ifcObjectDefinitions = systemAssignments as IList <IfcObjectDefinition> ?? systemAssignments.ToList(); if (ifcObjectDefinitions.Any()) { target.Components = new List <AssetKey>(); foreach (var ifcObjectDefinition in ifcObjectDefinitions) { var assetKey = new AssetKey { Name = ifcObjectDefinition.Name }; target.Components.Add(assetKey); } } //Attributes target.Attributes = helper.GetAttributes(ifcSystem); //Documents var docsMappings = Exchanger.GetOrCreateMappings <MappingIfcDocumentSelectToDocument>(); helper.AddDocuments(docsMappings, target, ifcSystem); //TODO: //System Issues return(target); }
private IfcSystem GetOrCreateSystem(string name, string description = null) { if (name == null) { return(null); } IfcSystem system = _model.Instances.Where <IfcSystem>(s => s.Name == name).FirstOrDefault(); if (system == null) { system = _model.Instances.New <IfcSystem>(s => { s.Name = name; }); } if (description != null) { system.Description = description; } return(system); }
public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: case 1: case 2: case 3: base.Parse(propIndex, value, nestedIndex); return; case 4: _relatingSystem = (IfcSystem)(value.EntityVal); return; case 5: _relatedBuildings.InternalAdd((IfcSpatialElement)value.EntityVal); return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
private void ParseCSV(string data, CsvLineParser parser, IfcClassification source) { TextReader csvReader = new StringReader(data); //header line string line = csvReader.ReadLine(); CsvLineParser lineParser = parser; lineParser.ParseHeader(line); //get first line of data line = csvReader.ReadLine(); while (line != null) { //parse line Line parsedLine = lineParser.ParseLine(line); //create IFC object IfcSystem system = GetOrCreateSystem(parsedLine.Code, parsedLine.Description); var classification = GetOrCreateClassificationReference(parsedLine.Code, parsedLine.Description, source); //set up hierarchy if (system == null) { continue; } IfcSystem parentSystem = GetOrCreateSystem(parsedLine.ParentCode); if (parentSystem != null) { parentSystem.AddObjectToGroup(system); } //read new line to be processed in the next step line = csvReader.ReadLine(); } }
static void Main(string[] args) { DatabaseIfc db = new DatabaseIfc(ReleaseVersion.IFC4X3); IfcRailway sydneyLightRail = new IfcRailway(db); sydneyLightRail.Name = "Sydney Light Rail"; sydneyLightRail.ObjectType = "Light Rail Complexes"; IfcProject project = new IfcProject(sydneyLightRail, "", IfcUnitAssignment.Length.Metre); IfcClassification uniclass2015 = new IfcClassification(db, "Uniclass2015"); IfcClassificationReference lightRailComplexes = new IfcClassificationReference(uniclass2015); lightRailComplexes.Identification = "Co_80_50_45"; lightRailComplexes.Name = "Light Rail Complexes"; lightRailComplexes.Associate(sydneyLightRail); IfcFacilityPartTypeSelect facilityPartTypeSelect = new IfcFacilityPartTypeSelect(IfcRailwayPartTypeEnum.USERDEFINED); IfcFacilityPart cbdCorridor = new IfcFacilityPart(sydneyLightRail, "CBD and SE Light Rail", facilityPartTypeSelect, IfcFacilityUsageEnum.LONGITUDINAL); new IfcClassificationReference(uniclass2015) { Identification = "En_80_50_71", Name = "Railway Corridors" }.Associate(cbdCorridor); IfcSpace deStop = new IfcSpace(cbdCorridor, "DE Stop"); deStop.PredefinedType = IfcSpaceTypeEnum.USERDEFINED; deStop.ObjectType = "Light Rail Stops"; new IfcClassificationReference(uniclass2015) { Identification = "SL_80_50_47", Name = "Light Rail Stops" }.Associate(deStop); IfcSpace platform1_2 = new IfcSpace(deStop, "Platform 1/2"); IfcClassificationReference classificationTicketSystem = new IfcClassificationReference(uniclass2015) { Identification = "Ss_75_90_80", Name = "Ticketing Systems" }; IfcSystem opal = new IfcSystem(sydneyLightRail, "Opal system"); classificationTicketSystem.Associate(opal); IfcDistributionSystem platform1_2TicketSystem = new IfcDistributionSystem(platform1_2, "DE Stop Platform 1/2 Ticket System", IfcDistributionSystemEnum.USERDEFINED); opal.AddAggregated(platform1_2TicketSystem); classificationTicketSystem.Associate(platform1_2TicketSystem); IfcCommunicationsApplianceType opalTicketMachineType = new IfcCommunicationsApplianceType(db, "Opal Ticket Machine", IfcCommunicationsApplianceTypeEnum.USERDEFINED); new IfcClassificationReference(uniclass2015) { Identification = "Pr_75_75_27_80", Name = "Smart card readers and writers" }.Associate(opalTicketMachineType); project.AddDeclared(opalTicketMachineType); IfcLocalPlacement ticketMachineLocalPlacement = null; IfcProductDefinitionShape ticketMachineShape = null; IfcCommunicationsAppliance ticketMachine = new IfcCommunicationsAppliance(platform1_2, ticketMachineLocalPlacement, ticketMachineShape, platform1_2TicketSystem); IfcPropertySingleValue dateCommissioned = new IfcPropertySingleValue(db, "Date Commissioned", new IfcDate(DateTime.Now)); new IfcPropertySet("TfNSW_Asset", dateCommissioned); System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog(); saveFileDialog.Filter = "IFC BIM Data (*.ifc,*.ifcxml,*.ifcjson,*.ifczip)|*.ifc;*.ifcxml;*.ifcjson;*.ifczip";; if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { db.WriteFile(saveFileDialog.FileName); } }
public T AddNewSystem(Ifc4.IfcObjectDefinition relatingObject) { EventType enabledEventTypes = BaseObject.EventsEnabled; BaseObject.EventsEnabled = EventType.None; try { T facility = (T)AddNew(); var ifcSystem = new IfcSystem(); // ifcSystem.Parent = this; ifcSystem.Parent = facility; ifcSystem.ParentIBaseObject = facility; facility.IfcSystem = ifcSystem; var document = this.GetParent <Ifc4.Document>(); if (document != null) { Entity entity = ifcSystem as Entity; if (entity != null) { entity.Id = document.GetNextSid(); document.IfcXmlDocument.Items.Add(entity); } } // ------------------------------------------------------------------------------ string Ref = String.Empty; if (relatingObject == null) { Ref = document.Project.Id; } else { Ref = relatingObject.Id; } //<IfcRelAggregates id="i84" GlobalId="3SVa7UPpXAux$wEdBKgcDI"> // <RelatingObject xsi:type="IfcProject" xsi:nil="true" ref="i100"/> // <RelatedObjects> // <IfcSite ref="i83" xsi:nil="true"/> // <IfcSystem ref="i2501" xsi:nil="true"/> <!-- 431 Lüftungsanlagen --> // <IfcSystem ref="i2508" xsi:nil="true"/> <!-- 461 Aufzugsanlagen --> // </RelatedObjects> //</IfcRelAggregates> if (relatingObject != null) { IEnumerable <IfcRelAggregates> ifcRelAggregatesCollection = this.Document.IfcXmlDocument.Items.OfType <IfcRelAggregates>().Where(item => item.RelatingObject != null && item.RelatingObject.Ref == Ref).ToList(); if (ifcRelAggregatesCollection.Any()) { foreach (var ifcRelAggregates in ifcRelAggregatesCollection) { var relatedObject = ifcRelAggregates.RelatedObjects.Items.FirstOrDefault(item => item.Ref == ifcSystem.Id); if (relatedObject == null) { ifcRelAggregates.RelatedObjects.Items.Add(ifcSystem.RefInstance()); // add only to one IfcRelAggregates - RelatedObjects List - RelatingObject xsi:type="IfcProject" break; } } } else { var relAggregatesProject = new IfcRelAggregates() { GlobalId = Document.GetNewGlobalId(), RelatingObject = new Ifc4.IfcProject() { Ref = Ref } }; relAggregatesProject.RelatedObjects = new IfcRelAggregatesRelatedObjects(); relAggregatesProject.RelatedObjects.Items.Add(ifcSystem.RefInstance()); this.Document.IfcXmlDocument.Items.Add(relAggregatesProject); } } return(facility); } catch (Exception exc) { return(default(T)); } finally { BaseObject.EventsEnabled = enabledEventTypes; } }
public SystemKeyType(IfcSystem ifcSystem, CoBieLiteHelper helper) { SystemCategory = helper.GetClassification(ifcSystem); SystemName = ifcSystem.Name; externalIDReference = helper.ExternalEntityIdentity(ifcSystem); }