xBimTeam / XbimExchange

XbimExchange contains several COBie schemas and serialisation functions as well as the Model Validation library adopted by theNBS digital toolkit.
https://xbimteam.github.io/
Other
46 stars 42 forks source link

Error converting IFC file to WeXBim: item with the same key has already been added #30

Open MarcoGiorgi opened 6 years ago

MarcoGiorgi commented 6 years ago

I'm trying to convert an IFC file produced by Revit. I'm using the example code taken from the website. I get the following parser error:

[ArgumentException: An item with the same key has already been added.]
   System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +52
   System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +12600149
   Xbim.IO.Memory.EntityCollection.InternalAdd(IPersistEntity entity) in C:\BuildAgent\work\77d7b8e93613846d\Xbim.IO\Memory\EntityCollection.cs:216
   Xbim.IO.Memory.<>c__DisplayClass68_0.<LoadStep21>b__0(String name, Nullable`1 label, Boolean header, Int32[]& ints) in C:\BuildAgent\work\77d7b8e93613846d\Xbim.IO\Memory\MemoryModel.cs:519
   Xbim.IO.Step21.XbimP21Parser.SetType(String entityTypeName) in C:\BuildAgent\work\77d7b8e93613846d\Xbim.IO\Step21\XbimP21Parser.cs:196
   Xbim.IO.Parser.P21Parser.DoAction(Int32 action) in C:\BuildAgent\work\77d7b8e93613846d\Xbim.IO\Step21\Parser\StepP21Parser.y:137
   QUT.Gppg.ShiftReduceParser`2.Reduce(Int32 ruleNumber) in C:\BuildAgent\work\77d7b8e93613846d\Xbim.IO\Step21\Parser\ShiftReduceParserCode.cs:330
   QUT.Gppg.ShiftReduceParser`2.Parse() in C:\BuildAgent\work\77d7b8e93613846d\Xbim.IO\Step21\Parser\ShiftReduceParserCode.cs:263
   Xbim.IO.Memory.MemoryModel.LoadStep21(Stream stream, Int64 streamSize, ReportProgressDelegate progDelegate) in C:\BuildAgent\work\77d7b8e93613846d\Xbim.IO\Memory\MemoryModel.cs:535
   Xbim.IO.Memory.MemoryModel.LoadStep21(String file, ReportProgressDelegate progDelegate) in C:\BuildAgent\work\77d7b8e93613846d\Xbim.IO\Memory\MemoryModel.cs:550
   Xbim.Ifc.IfcStore.Open(String path, XbimEditorCredentials editorDetails, Nullable`1 ifcDatabaseSizeThreshHold, ReportProgressDelegate progDelegate, XbimDBAccess accessMode) in C:\BuildAgent\work\77d7b8e93613846d\Xbim.Ifc\IfcStore.cs:362

Inspecting the exception in the source, I found it's raised at line 196 of Xbim.IO/Step21/XbimP21Parser.cs: p21.Entity = EntityCreate(entityTypeName, p21.EntityLabel, InHeader, out reqProps);

The IFC file is correctly open by other IFC viewer. Is there a way to solve this issue? As I'm new to xBIM, please just give a direction on how to solve it, and I'll do my tries.

the IFC file can be found here: http://www.brainsengineering.com/bim/mep2.zip Thanks!