xBIM 多个IFC文件合并
Posted 在水一方
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xBIM 多个IFC文件合并相关的知识,希望对你有一定的参考价值。
目录
多个模型联合:统一访问数据,就好像是一个单一的模型,IFC 联合可以存储为IFC文件(在IfcStore中)
using System; using Xbim.Common.Step21; using Xbim.Ifc; using Xbim.Ifc4.Interfaces; namespace BasicExamples { public class FederationExample { public void CreateFederation() { var editor = new XbimEditorCredentials { ApplicationDevelopersName = "You", ApplicationFullName = "Your app", ApplicationIdentifier = "Your app ID", ApplicationVersion = "4.0", //your user EditorsFamilyName = "Santini Aichel", EditorsGivenName = "Johann Blasius", EditorsOrganisationName = "Independent Architecture" }; using (var federation = IfcStore.Create(editor, IfcSchemaVersion.Ifc4, XbimStoreType.InMemoryModel)) { federation.AddModelReference("SampleHouse.ifc", "Bob The Builder", "Original Constructor"); //IFC4 文件 federation.AddModelReference("SampleHouseExtension.ifc", "Tyna", "Extensions Builder"); //IFC2x3 文件 Console.WriteLine($"Model is federation: {federation.IsFederation}"); Console.WriteLine($"Number of overall entities: {federation.FederatedInstances.Count}"); Console.WriteLine($"Number of walls: {federation.FederatedInstances.CountOf<IIfcWall>()}"); foreach (var refModel in federation.ReferencedModels) { Console.WriteLine(); Console.WriteLine($" Referenced model: {refModel.Name}"); Console.WriteLine($" Referenced model organization: {refModel.OwningOrganisation}"); Console.WriteLine($" Number of walls: {refModel.Model.Instances.CountOf<IIfcWall>()}"); } //保存IFC文件 federation.SaveAs("federation.ifc"); } } } }
控制台输出
Model is federation: True Number of overall entities: 50303 Number of walls: 8 Referenced model: SampleHouse.ifc Referenced model organization: Bob The Builder Number of walls: 5 Referenced model: SampleHouseExtension.ifc Referenced model organization: Tyna Number of walls: 3
保存为IFC文件的联合设置如下所示。这个惯例是xBIM 发明的。所以不能与其他的工具操作。
ISO-10303-21; HEADER; FILE_DESCRIPTION ((\'\'), \'2;1\'); FILE_NAME (\'\', \'2016-10-27T13:14:43\', (\'\'), (\'\'), \'Xbim File Processor version 3.2.0.0\', \'Xbim version 3.2.0.0\', \'\'); FILE_SCHEMA ((\'IFC4\')); ENDSEC; DATA; #1=IFCACTORROLE(.USERDEFINED.,\'Original Constructor\',$); #2=IFCORGANIZATION($,\'Bob The Builder\',$,(#1),$); #3=IFCDOCUMENTINFORMATION(\'1\',\'SampleHouse.ifc\',$,$,$,\'XbimReferencedModel\',$,$,#2,$,$,$,$,$,$,$,$); #4=IFCACTORROLE(.USERDEFINED.,\'Extensions Builder\',$); #5=IFCORGANIZATION($,\'Tyna\',$,(#4),$); #6=IFCDOCUMENTINFORMATION(\'2\',\'SampleHouseExtension.ifc\',$,$,$,\'XbimReferencedModel\',$,$,#5,$,$,$,$,$,$,$,$); ENDSEC; END-ISO-10303-21;
以上是关于xBIM 多个IFC文件合并的主要内容,如果未能解决你的问题,请参考以下文章