Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ifc to Json Convert issue #60

Open
Abhicode5 opened this issue Feb 17, 2021 · 0 comments
Open

Ifc to Json Convert issue #60

Abhicode5 opened this issue Feb 17, 2021 · 0 comments

Comments

@Abhicode5
Copy link

Abhicode5 commented Feb 17, 2021

@andyward , @martin1cerny i have the wexbim file , now i want the json file to get the complete model data, i am getting the following error

using Microsoft.Extensions.Logging;
using Serilog;
using System.IO;
using Xbim.Common;
using System;
using Xbim.Ifc;
using Xbim.ModelGeometry.Scene;
using System.Diagnostics;

using Xbim.COBieLite;
using System.Collections.Generic;
using System.ComponentModel;

using System.Linq;
using Xbim.Common.Step21;
using Xbim.CobieLiteUk;
using Xbim.CobieLiteUk.FilterHelper;

using Xbim.IO;
using XbimExchanger.COBieLiteUkToIfc;
using XbimExchanger.IfcHelpers;


namespace CreateWexBIM
{

    class Program
    {
        public static void Main()
        {
          
 
   using (var model =   IfcStore.Open("test.ifc"))
{
    
    var cobieFileName = "semantics.json";
    using (var cobieFile = new FileStream(cobieFileName, FileMode.Create))
    {
        var helper = new CoBieLiteHelper(model, "UniClass");
        var facility = helper.GetFacilities().FirstOrDefault();
        if (facility != null)
        {
            using (var writer = new StreamWriter(cobieFile))
            {
                CoBieLiteHelper.WriteJson(writer, facility);
                writer.Close();
            }
        }
    }

    model.Close();
}
            
        }

               
               
                }
            }
        
    

Error

Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Xbim.COBieLite.CoBieLiteHelper.GetClassification(IIfcDefinitionSelect classifiedObject)
   at Xbim.COBieLite.SpaceType..ctor(IIfcSpace ifcSpace, CoBieLiteHelper helper)
   at Xbim.COBieLite.FloorType..ctor(IIfcBuildingStorey ifcBuildingStorey, CoBieLiteHelper helper)        
   at Xbim.COBieLite.FacilityType..ctor(IIfcBuilding ifcBuilding, CoBieLiteHelper helper)
   at Xbim.COBieLite.CoBieLiteHelper.<GetFacilities>d__81.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at CreateWexBIM.Program.Main()
@martin1cerny martin1cerny transferred this issue from xBimTeam/XbimWebUI Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant