• 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;
  • 相关阅读:
    怎样理解 C++ 11中的move语义
    面试---计算机网络
    TCP报头中的选项字段
    协程的实现之调度器
    CPU缓存
    TLS---线程局部存储
    微信libco协程设计及实现---总结
    libco源码解析---协程运行与基本结构
    2014年第五届蓝桥杯B组(C/C++)预赛题目及个人答案(欢迎指正)
    并查集(模板&典型例题整理)
  • 原文地址:https://www.cnblogs.com/w2011/p/8424414.html
Copyright © 2020-2023  润新知