多模型合并可以实现以下功能:
- 覆盖多个模型以表现得像一个模型
- 统一访问数据,就像它是单个模型一样
- 只读。要修改模型的内容,您必须使用特定模型
- 不限于单个模式(联合IFC2x3 + IFC4→将其作为IFC4接口查询)
- 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", 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>()}"); } // 保存为单一文件,工其他场景下使用 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文件的联合设置如下所示。这个惯例纯粹是我们的发明,所以它不适用于其他工具。但它允许您在系统中创建联合,并在需要时再次重新打开它们。
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;
参考:http://docs.xbim.net/examples/federating-models.html
2019-06-05
原文地址:https://www.cnblogs.com/SavionZhang/p/10981136.html
时间: 2024-10-30 08:54:55