xBimTeam / Xbim.IDS.Validator

Library to validate IFC and COBie models using IDS1.0 and xbim Toolkit
https://xbim.net
GNU Affero General Public License v3.0
7 stars 4 forks source link
bim buildingsmart ids ifc qa

Xbim.IDS.Validator

Xbim.IDS.Validator is a .net (core & framework) library tht verifies IFC models against the official BuildingSMART Information Delivery Specification (IDS) standard.

Powered by xbim Tookit, this library can be used to translate IDS files into an executable specification, which can be run against any IFC2x3, IFC4 or IFC4.3 model and provide a detailed breakdown of the the test outcomes. It supports the latest full IDS1.0 specification and should fully support cloud and desktop applications across platforms.

An experimental extension adds support for validating COBie using IDS. See the Readme in Xbim.IDS.Validator.Extensions.COBie for more info.

How do I install it?

dotnet add package Xbim.IDS.Validator.Core

How do I use it?

Building the solution is easy, which includes a fully functional Console application in the Xbim.IDS.Validator.Console project.

XBIM IDS Console example

To integrate in your own application is also simple. Given an IDS file such as BasicRequirements.ids and an input IFC such as SampleHouse4.ifc, a basic C# implementation might look like:


// during application startup/bootstrap:

IServiceCollection serviceCollection = new ServiceCollection();

serviceCollection.AddIdsValidation();

// Build service provider if not using DI 
var provider = serviceCollection.BuildServiceProvider();

// Get IdsModelValidator from an IServiceProvider / or inject to your service
var idsValidator = provider.GetRequiredService<IIdsModelValidator>();

// Open a model

IModel model = IfcStore.Open("SampleFile.ifc"); // Or any other IModel implementation in place of IfcStore (including optionally a COBieModel)

// optionally you can over-ride some behaviours
var options = new VerificationOptions
{
    OutputFullEntity = true,            // Returns the full IFC entity in results, not just key
    PerformInPlaceSchemaUpgrade = true, // Update old IDS schemas to latest version
    PermittedIdsAuditStatuses = VerificationOptions.Relaxed,    // Silently ignore some IDS schema errors - just log the fault

    // IncludeSubtypes = true           // Include derived IFC Entity types in Selection
    // AllowDerivedAttributes = true,   // Allow Derived attributes to be tested.
};

// Invoke the validation checking asynchronously. Also supports cancellation and async progress updating.
ValidationOutcome outcome = await idsValidator.ValidateAgainstIdsAsync(model, "BasicRequirements1-0.ids", logger, verificationOptions: options);

// Present the results
foreach (ValidationRequirement requirement in outcome.ExecutedRequirements)
{
    // ApplicableResults contains details of the applicable IFC entities tested
    var entitiesTested = requirement.ApplicableResults.Count();
    var entitiesPassed = requirement.ApplicableResults.Count(e => e.ValidationStatus == ValidationStatus.Pass);
    Console.WriteLine("[{0,-8}] : [{1}/{2}] met {3} specification '{4}' ",
        requirement.Status,
        entitiesPassed, entitiesTested,
        requirement.Specification.Cardinality.Description,
        requirement.Specification.Name
        );

    // Detail the failure reasons against applicable entities.

    foreach(var entity in requirement.ApplicableResults.Where(e => e.ValidationStatus != ValidationStatus.Pass))
    {
        Console.WriteLine(" Failed Entity: {0}", entity.FullEntity);
        foreach(var failure in entity.Messages)
        {
            // Reasons for failure
            Console.WriteLine("   {0}", failure);
        }
    }
}

Example IDS Console output

How much of the IDS spec does this support?

This is a comprehensive implementation of the latest IDS v1.0 standard, with 100% pass rate all current IDS TestCases

This library has been tested at scale with real-world models. It also supports some useful extensions that can be enabled through runtime options.

It currently supports:

The library has been tested against the IDS test suite

Currently only one minor test-case is unsupported. (See PropertySet skipped unit-test).

To-do list

License

This library is made available by xbim Ltd under the GNU Affero General Public License v3. Please note this is different to the Open Source license used by other libraries in the xbim Toolkit (CDDL), and means that, while you are free to use this software for evaluation, personal, and non-commercial use, it is not compatible for use use in 'proprietary' (closed-source) commercial software.

If you are a developer wishing to use this library in commercial software please contact sales@xbim.net to discuss a commercial license, or contact @andyward on github.