Skip to main content

IFC Data Checker

IFC Data Checker is a tool to validate rules on IFC models. To do so, the IFC Data Checker needs a rules file and an IFC model. The rules file has to match the rules specification in the report of the bachelor thesis of the IFC Data Checker. The IFC model need to be of version 2x3 or version 4.

Installation:

pip install ifc-data-checker

Or clone this repository and install the dependencies

pip install -r requirements.txt

Add IfcOpenShell Python

To run the IFC Data Checker, you need to install the python package IfcOpenShell. IT need to fit your machine environment regarding:

  • the Python version
  • the os (Windows, Linux , Mac)
  • the os flavor (32bit or 64bit)

To install IfcOpenShell, you need to do the following steps:

  1. Go to ifcopenshell.org/python and download the matching IfcOpenShell. Use the latest IfcOpenShell version.
  2. Extract the downloaded file and paste the ifcopenshell folder to the directory site-packages of the python installation. The folder need to be called ifcopenshell.
    • On Linux e.g. /usr/local/lib/python3.8/site-packages/
    • On Windows e.g. in the python installation folder and then \Lib\site-packages\

If IfcOpenShell not matching your machine environment, then it will trow an exception like:

ImportError: IfcOpenShell not built for 'windows\64bit\python3.8'

Run the IFC Data Checker

python ifc_data_checker ./path/to/rules-file.yml ./path/to/ifc-model.ifc

GitHub Repository example:

python ifc_data_checker "./rulesfiles/PredefinedType for IfcWall.yml" "./ifcfiles/Duplex-A.ifc"

Usage:

usage: ifc_data_checker [-h] [--report-file] [--no-rulesfile-validation] rules ifc

positional arguments:
  rules                 The path to the rules file.
  ifc                   The path to the ifc file.

optional arguments:
  -h, --help            show this help message and exit
  --report-file         Create a validation report file, instead of showing the validation report on the console.
  --no-rulesfile-validation
                        Disable validation of the rules file.

Contribute

You are invited to participate on the IFC Data Checker.

Python Style Guide

The IFC Data Checker follows the Python Style Guide from Google

The source code documentation follows the Google Style. This example helps to follow the Google Style.

Extend Constraint Component

The following 4 steps are to extend the IFC Data Checker for a new Constraint Component.

  1. Step

    Add a new class in the Python module ifc_data_checker/constraints.py. Use the following template and consider the comments.

    class NewConstraint(ConstraintComponent):
        """Class description"""
        yaml_keys = tuple(["new"])
        """Set the yaml keys for the new constraint"""
    
        def __init__(self, definition: dict, ifc_instance):
            """Constructor"""
            super().__init__(definition, ifc_instance)
            self.potentially_new_attribute = None
    
        def validate(self):
            """Validates. The attribute self.validation_information need to be set."""
    
        def report(self) -> List[str]:
            """Reports. Return a list of valiation results messages"""
            return [str(self.validation_information)]
    
        def __eq__(self, other):
            """Equals all the attributes"""
            if not isinstance(other, NewConstraint):
                return False
            return (self.definition == other.definition and
                    self.ifc_instance == other.ifc_instance and
                    self.validation_information == other.validation_information and
                    self.potentially_new_attribute == other.potentially_new_attribute)
    
  2. Step

    Add the Name of the class in the yaml file ifc_data_checker/config.yml.

    constraints:
    - Constraint
    - SetGroup
    - AndGroup
    - OrGroup
    - NewConstraint
    
  3. Step

    Write unit and integration tests for the new constraint component. To do so, add a new Python module under tests/constraints. This new test class should inherit from tests.constraints.constraint_component_test.TestConstraintComponent.TestParameterValidation. After that, set the attribute constraint_component_class and default_constraint_component on the new test class.

    Now you are ready to implement the test cases. You can have a look at the existing test cases and write the test cases analogously.

    The new Python test module should be in the test report. For that, add the Python test module in the Python module tests/suite.py analogously as the others.

  4. Step

    The new constraint component need to add to the rules.schema.json, to be an accepted constraint component. To do so add the JSON schema of the new constraint component in the JSON schema file rules.schema.json under definitions -> constraint -> oneOf. Read the JSON schema specification to create an JSON Schema. Here is an example.

    "definitions": {
    "constraint": {
      "oneOf": [
        …
        {
          "type": "object",
          "properties": {
            "new": {
              "type": "string"
            }
          },
          "required": [
            "new"
          ],
          "additionalItems": false
        },
        …
    

To extend an new path operator or an new constraint check, the steps are analogously to the steps of the constraint component.

Release files for ifc-data-checker 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ifc-data-checker 1.0.1
File Size Uploaded
ifc-data-checker-1.0.1.tar.gz 26.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ifc-data-checker 1.0.1
File Interpreter ABI Platform
ifc_data_checker-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 68.6 kB

Release files / ifc-data-checker-1.0.1.tar.gz

Download URL ifc-data-checker-1.0.1.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
de6c4927ac8ef0c7d07b3ae87ed94afee658c05a39833ee53f94ecf5ad4eaf1f
BLAKE2b-256 checksum
How to use checksums
2a76abf8e23aa4def55d6d0b35639a75743327f3638a3cc0d726f608dcf76d11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release files / ifc_data_checker-1.0.1-py3-none-any.whl

Download URL ifc_data_checker-1.0.1-py3-none-any.whl
Size 42.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8150a30f65f0665020b34c3c527667f770897594ab8a18e175b514075066d51
BLAKE2b-256 checksum
How to use checksums
100fdd652974893e1767790ae77bfd1b88364b98400bd519d2968c884748f49f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page