Does anyone know if fzkviewer and/or checking tool lite tools from KIT are avaliable in some command line form? Or if it is possible to contribute to them. It’d be absolutely amazing to have checking tool as a cli program. Run automated tests during development, CI scenarios, you name it.
IfcOpenShell contains CLI tools that:
- BIMTester - runs automated tests to IFC files from test scenarios written in Gherkin - we currently use this on commercial projects to test hundreds of thousands of IFC elements and check exchange requirements
- IfcClash - does clash detection in IFC
- IfcDiff - compares two IFC files
- IfcCSV - exports and imports data to and from IFC and CSV
- IfcOpenShell-python - allows you to query IFCs in Python, and therefore in an interactive interpreter
- IfcConvert - conversion to many formats (obj, dae, svg, xml)
- IfcCOBie - validates and exports COBie data in an IFC
- IfcPatch - allows running predefined data manipulation tasks in an IFC file
All are command line and cross platform. All are free and open source software. I use about half of them in a automated CI-style workflow. Github is here if you’d like to contribute
Nice! Thank you. Will have a good look at them.
One thing I like about KIT’s ifc checking tool because it points you right into https://technical.buildingsmart.org/ link when you make a mistake.
I should clarify that BIMTester runs unit tests - it does not check for legal IFC files. IfcOpenShell does, however, have some functions to check for IFC legality, accessible within IfcOpenShell-python, but they are not wrapped into a CLI app as far as I know.
some functions to check for IFC legality, accessible within IfcOpenShell-python, but they are not wrapped into a CLI app as far as I know.
validate.py
checks basic attribute types and cardinalities. You can call it from the command line with python -m ifcopenshell.validate <ifcfile>
https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.6.0/src/ifcopenshell-python/ifcopenshell/validate.py
There is also the mvd
submodule there https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.6.0/src/ifcopenshell-python/ifcopenshell that is probably be able to be ran from the command line. I’m not really sure what entry points for command line usage it defines, but that should be easy to adapt.
@Moult we’ve been toying around with IfcDiff tool. It doesn’t seem that it can handle property & quantity sets. What am I missing here?
@claimred - very happy to hear you’re testing it By default, it only checks direct attributes for changes. This is due to speed. It is expensive to check for differences, as IFC elements can be, well, very, very detailed!
I have now added a new option which allows you to test for inverse relationships. Keep in mind, this comes with a execution time penalty. Note that some checks are already excluded (e.g. owner history, because all BIM authoring tools implement it in a broken way) See below:
$ ifcdiff a.ifc b.ifc
...
- 0 item(s) were changed either geometrically or with data
# Diff finished in 0.33 seconds
$ ifcdiff a.ifc b.ifc -r "IfcRelDefinesByProperties"
...
- 2 item(s) were changed either geometrically or with data
# Diff finished in 0.50 seconds
$ ifcdiff a.ifc b.ifc -r "all"
- 2 item(s) were changed either geometrically or with data
# Diff finished in 7.21 seconds
$ ifcdiffy -h
...
usage: ifcdiff.py [-h] [-o OUTPUT] [-r RELATIONSHIPS] old new
Show the difference between two IFC files
positional arguments:
old The old IFC file
new The new IFC file
optional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
The JSON diff file to output. Defaults to diff.json
-r RELATIONSHIPS, --relationships RELATIONSHIPS
A list of IFC classes to check in inverse
relationships, like "IfcRelDefinesByProperties", or
"all".
See sample output:
{
"added": [],
"deleted": [],
"changed": {
"1JFme5YJz1n8a0ghlOBs_G": {
"values_changed": {
"root[1].RelatingPropertyDefinition.HasProperties[0].NominalValue.wrappedValue": {
"new_value": "Corridorasdf",
"old_value": "Corridor"
}
}
},
"1JFme5YJz1n8a0ghlOBs_V": {
"values_changed": {
"root[1].RelatingPropertyDefinition.HasProperties[0].NominalValue.wrappedValue": {
"new_value": 954.4,
"old_value": 914.4
}
}
}
}
}
There are a few more features I believe would be useful, such as the ability to filter what you are diffing (e.g. in IFCCSV you can specify filter queries with complex AND and OR statements like .IfcWall[Name="foo"]&.IfcElement
. That way you don’t need to diff the entire file if you don’t want to.
Another useful feature would be multicore processing, which can speed up the diff by a significant time factor. If it is useful for you, I can prioritise implementing it.
Wow, that was fast, thanks! We will try to test some more. As for OwnerHistory, it’s ok, we’ve removed it from IFC4 export altogether.
e.g. owner history, because all BIM authoring tools implement it in a broken way
Yeah, exactly.
Another useful feature would be multicore processing, which can speed up the diff by a significant time factor. If it is useful for you, I can prioritise implementing it.
We are still in the early stages of setting up CI pipeline for ifc files, so I don’t know yet.
Hey @Moult! Just a heads up. Everything went smoothly with your improvements about inverse relationships, thanks! Although, it is not exactly practical to compare every possible relationships i.e. -all for a medium sized project, but it is possible to reasonably restrict relationship set on a case-by-case basis (in this case we care about IfcRelDefinesByProperties, in another we care about IfcRelContainedInSpatialStructure, etc.)
Another thing I was wondering about is math precision. As we know there is a precision attribute in IfcGeometricRepresentationContext, and I think it’s correct to use it for comparison by default as authoring software intended. What do you think?
@claimred Correct - it is unfeasible to check all inverse relationships unless you have a very powerful computer or a cloud.
You are correct that using the precision attribute is a good idea.
This feature to detect precision has now been added: https://github.com/IfcOpenShell/IfcOpenShell/commit/048966bda274bdaa66203aeddd3f1e4a304ac2f7
@claimred - just an update, I know this is usually about CLI tools, but the same tool is now accessible within the Blender interface via the BlenderBIM Add-on, in case you want to share with users who prefer a graphical UI to run a diff between IFCs