Giter Club home page Giter Club logo

xbimcobieexpress's Introduction

Branch Build Status MyGet NuGet
Master Build Status master
Develop Build Status -

Xbim COBie Express

Part of Xbim; the eXtensible Building Information Modelling (BIM) Toolkit

This code was originally part of xBIM Essentials but was moved out to make Essentials smaller and more focussed.

COBie Express is our attempt to support COBie in a way that is a lot easier to maintain compared to spreadsheets.

This library enables you to both read and write spreadsheets adhering to the COBie Schema (MVD), while also providing the power of the XBIM toolkit to query, interrogate and build data transactionally.

COBie Express is modeled using EXPRESS modelling language (the same as IFC) and the implementation is generated using the same tooling as we use for IFC. As a result you can use all advanced data processing features of xBIM to work with the data.

Code Examples

1 Reading from an Excel COBie spreadsheet

If you're familiar with LINQ or have ever queried IFC models with XBIM, you'll be right at home querying COBie data sources.

    using (IModel model = CobieModel.ImportFromTable("MyCobieSpreadsheet.xlsx", out string report))
    {
        // Get all the contacts
        var contacts = model.Instances.OfType<CobieContact>().ToList();
        
        // Query the spaces but filter by a Uniclass2015 category. And then my the room area
        var largeCommercialSpaces = model.Instances.OfType<CobieSpace>()
            .Where(space => space.Categories.Any(cat => cat.Classification.Name.StartsWith("SL_20_50")))
            .Where(space => space.GrossArea > 1000);
        
        // We can then drill across to other parts of the model
        var occupancyRatingOfFirstSpaces = largeCommercialSpaces.FirstOrDefault().Attributes
            .Where(attr => attr.Name.StartsWith("Occupancy"));
    }

2. Converting IFCs to COBIe spreadheets

This is a more sophisticated example where we convert an IFC to COBie. Here we're using some built-in mappings, but these can all be over-ridden in the IfcToCoBieExpressExchanger constructor. See OutputFilters and CobieAttributes.config

    const string input = @"SampleHouse4.ifc";

    var ifc = MemoryModel.OpenReadStep21(input);

    var cobie = new CobieModel();
    using (var txn = cobie.BeginTransaction("Sample house conversion"))
    {
        var exchanger = new IfcToCoBieExpressExchanger(ifc, cobie
            /*,     // More advanced configuration options available
            reportProgress: reportProgressDelegate,
            filter: outputFilters,
            configFile: pathToAttributeMappingConfigFile,
            extId: EntityIdentifierMode.GloballyUniqueIds,
            sysMode: SystemExtractionMode.System,
            classify: true*/
            );
        exchanger.Convert();
        txn.Commit();
    }

    // We can persists our model to disk for faster access in future
    var output = Path.ChangeExtension(input, ".cobie");
    cobie.SaveAsEsent(output);

    // We can fix up the data to make it valid - e.g. Deduplicate some names
    using (var txn = cobie.BeginTransaction("Make some changes"))
    {
        MakeUniqueNames<CobieSpace>(cobie);
        MakeUniqueNames<CobieType>(cobie);
        txn.Commit();
    }

    // Finally export as a COBie spreadsheet
    output = Path.ChangeExtension(input, ".xlsx");
    cobie.ExportToTable(output, out string report);

Using the library

To get started, the simplest approach is to add the Xbim.COBieExpress.Exchanger and Xbim.COBieExpress.IO nuget packages to your Visual Studio Project from Nuget or get the latest versions from our MyGet feeds

Alternatively you can add the packages using Nuget's Package Manager Console and issuing the following command:

PM> Install-Package Xbim.COBieExpress.Exchanger
PM> Install-Package Xbim.COBieExpress.IO

Building yourself

You will need Visual Studio 2017 or newer to compile the Solution. The free VS 2019 Community Edition should work fine. All projects target .NET Framework net47, as well as netstandard2.0, which should permit limited trials of XBIM with .NET Core / Mono etc.

Licence

The XBIM library is made available under the CDDL Open Source licence. See the licences folder for a full text.

All licences should support the commercial usage of the XBIM system within a 'Larger Work', as long as you honour the licence agreements.

xbimcobieexpress's People

Contributors

andyward avatar cbenghi avatar gcoulby avatar kayrogage avatar laurenceskoropinski avatar lloydpickering avatar martin1cerny avatar stevelockley avatar xbimci avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.