Skip to content

Instantly share code, notes, and snippets.

@GeorgDangl
Last active January 16, 2019 20:20
Show Gist options
  • Save GeorgDangl/9b528cf08a2ca3977166115081a48b4e to your computer and use it in GitHub Desktop.
Save GeorgDangl/9b528cf08a2ca3977166115081a48b4e to your computer and use it in GitHub Desktop.
Integrating BIM and IFC references in GAEB data
<Ctlg>
<CtlgID>ccf2cb97-1a00-43e5-bd3e-06248e384273</CtlgID>
<CtlgType>miscellaneous</CtlgType>
<CtlgName>Building.ifc</CtlgName>
</Ctlg>
<Item ID="ID_be97206f-3020-411a-bd30-b38c9bb8bc88">
<Qty>100</Qty>
<QtySplit>
<Qty>10</Qty>
<CtlgAssign>
<CtlgID>ccf2cb97-1a00-43e5-bd3e-06248e384273</CtlgID>
<CtlgCode>04BUoi9FT31BWlyfND2MS2</CtlgCode>
</CtlgAssign>
</QtySplit>
<QU>m³</QU>
<Description>
<span>Concrete</span>
</Description>
</Item>
<?xml version="1.0" encoding="utf-8"?>
<!--Created with Dangl GAEB Tool, Copyright 2013 - 2019 Dangl IT GmbH, www.dangl-it.com, Version 1.6.2 (Built: 15.01.2019 19:00)-->
<GAEB xmlns="http://www.gaeb.de/GAEB_DA_XML/DA83/3.2">
<GAEBInfo>
<Version>3.2</Version>
<VersDate>2013-10</VersDate>
<Date>2019-01-16</Date>
<Time>21:18:22</Time>
<ProgSystem>Dangl GAEB Tool - www.dangl-it.com - Version 1.6.2</ProgSystem>
<ProgName>Dangl.AVA.Converter www.dangl-it.com V2.0.2 ©2019</ProgName>
</GAEBInfo>
<Award>
<DP>83</DP>
<AwardInfo>
<BoQID>2b8df9a7-e9c8-4d0f-af23-2a6f98d51e8f</BoQID>
</AwardInfo>
<BoQ ID="ID_8269b1bf-637a-4d59-b97d-08a04e1fbdfd">
<BoQInfo>
<Date>2019-01-16</Date>
<OutlCompl>OutTxt</OutlCompl>
<Ctlg>
<CtlgID>9ba431d0-c9f8-4fa5-a947-22719e6e3d7c</CtlgID>
<CtlgType>miscellaneous</CtlgType>
<CtlgName>Building.ifc</CtlgName>
</Ctlg>
</BoQInfo>
<BoQBody>
<Itemlist>
<Item ID="ID_cc65c998-6e30-4161-a584-063199e62a4e">
<Qty>100</Qty>
<QtySplit>
<Qty>10</Qty>
<CtlgAssign>
<CtlgID>9ba431d0-c9f8-4fa5-a947-22719e6e3d7c</CtlgID>
<CtlgCode>04BUoi9FT31BWlyfND2MS2</CtlgCode>
</CtlgAssign>
</QtySplit>
<QU>m³</QU>
<Description>
<OutlineText>
<OutlTSA>No</OutlTSA>
<OutlTxt>
<TextOutlTxt>
<span>Concrete</span>
</TextOutlTxt>
</OutlTxt>
</OutlineText>
</Description>
</Item>
<Item ID="ID_8b80d50b-9673-4757-981a-4618009281a5">
<Qty>800</Qty>
<QtySplit>
<Qty>80</Qty>
<CtlgAssign>
<CtlgID>9ba431d0-c9f8-4fa5-a947-22719e6e3d7c</CtlgID>
<CtlgCode>04BUoi9FT31BWlyfND2MS2</CtlgCode>
</CtlgAssign>
</QtySplit>
<QU>m²</QU>
<Description>
<OutlineText>
<OutlTSA>No</OutlTSA>
<OutlTxt>
<TextOutlTxt>
<span>Casing</span>
</TextOutlTxt>
</OutlTxt>
</OutlineText>
</Description>
</Item>
<Item ID="ID_353eb002-ffe2-4506-805a-9f06ec850639">
<Qty>6000</Qty>
<QtySplit>
<Qty>600</Qty>
<CtlgAssign>
<CtlgID>9ba431d0-c9f8-4fa5-a947-22719e6e3d7c</CtlgID>
<CtlgCode>04BUoi9FT31BWlyfND2MS2</CtlgCode>
</CtlgAssign>
</QtySplit>
<QU>kg</QU>
<Description>
<OutlineText>
<OutlTSA>No</OutlTSA>
<OutlTxt>
<TextOutlTxt>
<span>Reinforcement Steel</span>
</TextOutlTxt>
</OutlTxt>
</OutlineText>
</Description>
</Item>
</Itemlist>
</BoQBody>
</BoQ>
</Award>
</GAEB>
using Dangl.AVA.Contents;
using Dangl.AVA.Contents.ServiceSpecificationContents;
using System;
using System.IO;
using Xunit;
namespace Dangl.AVA.Converter.Tests.Utilities
{
public class GaebWithBimConnectionFileGenerator
{
[Fact]
public void GenerateTutorialFiles()
{
WriteFileToDisk("C:\\Output");
}
private void WriteFileToDisk(string outputPath)
{
var project = GetProject();
var gaebXmlPath = Path.Combine(outputPath, "GAEBXML.X86");
using (var fs = File.Create(gaebXmlPath))
{
var gaebFile = Converter.ConvertToGaeb(project, destinationType: DestinationGAEBType.GAEBXML_V3_2);
using (var gaebXmlStream = GAEB.Writer.GAEBWriter.GetStream(gaebFile))
{
gaebXmlStream.CopyTo(fs);
}
}
}
private Project GetProject()
{
var project = new Project();
var servSpec = new ServiceSpecification();
servSpec.ExchangePhase = ExchangePhase.OfferRequest;
project.ServiceSpecifications.Add(servSpec);
var ifcCatalogReferenceId = Guid.NewGuid();
servSpec.ProjectCatalogues.Add(new Catalogue
{
CatalogueType = CatalogueType.Unknown,
Description = "IFC BIM Model",
Name = "Building.ifc",
Id = ifcCatalogReferenceId
});
var concretePosition = new Position();
concretePosition.ShortText = "Concrete";
concretePosition.SetQuantity(100);
concretePosition.UnitTag = "m³";
var concreteQuantityForWall = new QuantityAssignment();
concreteQuantityForWall.Quantity = 10m; // 10.0 of the total 100.0
concreteQuantityForWall.CatalogueReferences.Add(new CatalogueReference
{
CatalogueReferenceId = ifcCatalogReferenceId,
// The is the reference to the IFC Guid in the building model
CatalogueReferenceKey = "04BUoi9FT31BWlyfND2MS2"
});
concretePosition.QuantityAssignments.Add(concreteQuantityForWall);
servSpec.Elements.Add(concretePosition);
var casingPosition = new Position();
casingPosition.ShortText = "Casing";
casingPosition.SetQuantity(800);
casingPosition.UnitTag = "m²";
var casingQuantityForWall = new QuantityAssignment();
casingQuantityForWall.Quantity = 80m; // 80.0 of the total 800.0
casingQuantityForWall.CatalogueReferences.Add(new CatalogueReference
{
CatalogueReferenceId = ifcCatalogReferenceId,
// The is the reference to the IFC Guid in the building model
CatalogueReferenceKey = "04BUoi9FT31BWlyfND2MS2"
});
casingPosition.QuantityAssignments.Add(casingQuantityForWall);
servSpec.Elements.Add(casingPosition);
var reinforcementPosition = new Position();
reinforcementPosition.ShortText = "Reinforcement Steel";
reinforcementPosition.SetQuantity(6000);
reinforcementPosition.UnitTag = "kg";
var reinforcementQuantityForWall = new QuantityAssignment();
reinforcementQuantityForWall.Quantity = 600m; // 600.0 of the total 6000.0
reinforcementQuantityForWall.CatalogueReferences.Add(new CatalogueReference
{
CatalogueReferenceId = ifcCatalogReferenceId,
// The is the reference to the IFC Guid in the building model
CatalogueReferenceKey = "04BUoi9FT31BWlyfND2MS2"
});
reinforcementPosition.QuantityAssignments.Add(reinforcementQuantityForWall);
servSpec.Elements.Add(reinforcementPosition);
return project;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment