BCF 文件创建
BCF file creation
我想使用 Xbim 工具包创建一个 BIM 协作文件。由于缺乏编程经验,我在实施 xbimBCF 时遇到了困难。我想知道是否有任何示例可以帮助我实现 xbimBCF?谢谢。
最好的开始是查看 this. BFC is very simple schema. You can find documentation, examples and additional information on the official buildingSMART website.
等测试
完整的工作示例:
using System;
using System.Collections.Generic;
using System.IO;
using Xbim.BCF;
using Xbim.BCF.XMLNodes;
namespace CreateBCF
{
class Program
{
static void Main()
{
var bcf = new BCF {
Project = new ProjectXMLFile {
Project = new BCFProject {
Name = "Sample Project",
ProjectId = "0HE7wY7irAE9b6u8RhVcUT"
}
},
Version = new VersionXMLFile("1.0"),
Topics = new List<Topic> {
new Topic {
Markup = new MarkupXMLFile {
Header = new BCFHeader {
Files = new List<BCFFile> {
new BCFFile {
Date = DateTime.Now,
Filename = "Sample.ifc",
IfcProject = "0HE7wY7irAE9b6u8RhVcUT",
IfcSpatialStructureElement = "3sYjbGNsP7hQb8RP1A$gnO"
}
}
},
Comments = new List<BCFComment> {
new BCFComment(
Guid.NewGuid(),
Guid.NewGuid(),
"open",
DateTime.Now,
"Blaseius Aichel",
"This needs to be replaced completely!") {
Topic = new AttrIDNode(new Guid("9B981279-4B63-46A0-ABF0-432E27B5ADC0"))
}
},
Topic = new BCFTopic(new Guid("9B981279-4B63-46A0-ABF0-432E27B5ADC0"), "Sample Topic"),
Viewpoints = new List<BCFViewpoint> {
new BCFViewpoint(Guid.NewGuid()) { Snapshot = "snapshot01.png", Viewpoint = "Base Viewpoint"}
}
},
Snapshots = new List<KeyValuePair<string, byte[]>> {
new KeyValuePair<string, byte[]>( "snapshot01.png", File.ReadAllBytes("snapshot01.png"))
},
Visualization = new VisualizationXMLFile {
}
}
}
};
using (var output = File.Create("sample.bcf"))
{
var data = bcf.Serialize();
data.CopyTo(output);
output.Close();
}
}
}
}
我想使用 Xbim 工具包创建一个 BIM 协作文件。由于缺乏编程经验,我在实施 xbimBCF 时遇到了困难。我想知道是否有任何示例可以帮助我实现 xbimBCF?谢谢。
最好的开始是查看 this. BFC is very simple schema. You can find documentation, examples and additional information on the official buildingSMART website.
等测试完整的工作示例:
using System;
using System.Collections.Generic;
using System.IO;
using Xbim.BCF;
using Xbim.BCF.XMLNodes;
namespace CreateBCF
{
class Program
{
static void Main()
{
var bcf = new BCF {
Project = new ProjectXMLFile {
Project = new BCFProject {
Name = "Sample Project",
ProjectId = "0HE7wY7irAE9b6u8RhVcUT"
}
},
Version = new VersionXMLFile("1.0"),
Topics = new List<Topic> {
new Topic {
Markup = new MarkupXMLFile {
Header = new BCFHeader {
Files = new List<BCFFile> {
new BCFFile {
Date = DateTime.Now,
Filename = "Sample.ifc",
IfcProject = "0HE7wY7irAE9b6u8RhVcUT",
IfcSpatialStructureElement = "3sYjbGNsP7hQb8RP1A$gnO"
}
}
},
Comments = new List<BCFComment> {
new BCFComment(
Guid.NewGuid(),
Guid.NewGuid(),
"open",
DateTime.Now,
"Blaseius Aichel",
"This needs to be replaced completely!") {
Topic = new AttrIDNode(new Guid("9B981279-4B63-46A0-ABF0-432E27B5ADC0"))
}
},
Topic = new BCFTopic(new Guid("9B981279-4B63-46A0-ABF0-432E27B5ADC0"), "Sample Topic"),
Viewpoints = new List<BCFViewpoint> {
new BCFViewpoint(Guid.NewGuid()) { Snapshot = "snapshot01.png", Viewpoint = "Base Viewpoint"}
}
},
Snapshots = new List<KeyValuePair<string, byte[]>> {
new KeyValuePair<string, byte[]>( "snapshot01.png", File.ReadAllBytes("snapshot01.png"))
},
Visualization = new VisualizationXMLFile {
}
}
}
};
using (var output = File.Create("sample.bcf"))
{
var data = bcf.Serialize();
data.CopyTo(output);
output.Close();
}
}
}
}