Autodesk / revit-ifc

IFC for Revit and Navisworks (2019+)
473 stars 193 forks source link

Systematic(!) RevitIFCUnitBug! #576

Open krabauinf opened 1 year ago

krabauinf commented 1 year ago
For reference and further communication: This issue was published on LinkedIn by Martin Krammer on Jan 7th 2023 at (https://www.linkedin.com/posts/martin-krammer_ifc-files-will-become-illegible-in-the-future-activity-7017530659803926528-WivK) after being made aware of the problem in a discussion about practical IFC with Rene Holzer.

THE BUG in short: It seems to be the case that many (arbitrary?) parameter/property units inRevit are not exported to IFC as a suitable unit from IfcMeasureResource, but the Units are just transformed into the IFC as plain IFCReal.

My test scenario: A wall in Revit 2023 with a few properties in a separate PropertySet with the latest IFC-Advanced Exporter IFC.for.Revit.2023.2.3.0.msi from Github https://lnkd.in/dtHgm8nN exported to IFC4 ReferenceViewV1.2

I provide my RVT23+IFC4 test files and some screenshots for verification here so that those responsible can take care of them as quickly as possible: Download https://lnkd.in/dTsAdtac

This affects the daily work of today's real BIM projects and future meaningful, extensive, multi-level software links.

FINDINGS in detail:

THE POSITIVE FIRST: Custom project parameters defined in Revit such as "test_length" with unit [m1] are put correctly into IFC as IFCLENGHTHMEASURE.

Project parameters created from the official IFC Shared-Parameters-File (RevitIFCBuiltIn_ALL.txt) parameters like IfcGeneralMaterialProperties.MassDensity with unit [kg/m3] also deliver correctly as IFCMASSDENSITYMEASURE.

So it doesn't seem to make any difference whether it's "custom" or "shared" (or "official IFC-shared") parameters to let it sometimes work correctly (That is the reason why not many realize this in their daily work).

BUT: A custom velocity parameter "test_velocity" with the unit in Revit set to [km/h] is only written out as IFCREAL into the IFC, not witht he appropriate IFCLINEARVELOCITYMEASURE. Funnily in the IFC however, a fitting IFCUnit for that velocity as IFCDERIVEDUNIT((#41,#45),.LINEARVELOCITYUNIT.,$) is present within that IFC-File, but "unluckily" not referenced by this velocity-property. [m/s] (the programmer might have been too lazy to convert it here... but also switching velocities to [m/s] in the Revit project did not change the export output for velocities to come out other than IFCReal)

A velocity parameter from the IFC shared-parameter-file Pset_MarkerGeneral.ApproachSpeed ​​is also wrongly written out to the IFC as IFCREAL too, not with IFCLINEARVELOCITYMEASURE. Here it is interesting, however, that in the IFC-shared-Parameter-File the unit is already correctly specified there as IfcLinearVelocityMeasure, but after the creation of the corresponding project parameter the unit in Revit only shows "Number" and not [m/s] or [km/h] as to would be expected... and it is therefore not surprising that this parameter is written out to IFC with IFCREAL if Revit itself only works with "Number" as the unit.

Now you might suspect that Revit just can't handle IFCDERIVEDUNITS "yet"... (but before making such easy finish speak, please also remember Revit is proudly certified for IFC4 import and export)

...BUT: A separate parameter "test_lambda" with unit "thermal conductivity" and [W/(mK)] goes correctly into the IFC with unit IFCTHERMALCONDUCTIVITYMEASURE.

Likewise as already mentioned, the IFC shared parameter IfcGeneralMaterialProperties.MassDensity is also correctly defined in the IFC shared-param-file with IfcMassDensityMeasure as well as later in Revit as a project parameter with the unit "mass density and [kg/m3] - correspondingly, the IFC export also leads to the correct IFCMASSDENSITYMEASURE.

CONCLUSION: Obviously, Revit simply CAN'T really export SOME units of IFC "yet", no matter if coming from shared or custom revit parameters. In the exporter code you can see some methods that are supposed to handle this, e.g. IFCData CreateAsLinearVelocityMeasure(double), but they obviously don't work. For some other units, the methods are not there either, which is probably why it only works with IfcReal as a fallback (because IfcMolecularWeightMeasure, for example, does not work either and also has no special handling method, but it is also not available in the Revit unit GUI.

How many(?) other units don't work either... please sort this out. It's scary that such basic things do not work.

AngelVelezSosa commented 1 year ago

Thanks for your feedback. I'm sorry for any frustration you've felt around units we don't yet support.

On the positive note: there is an active project going on to find all of these "missing" units and convert them. Unfortunately, there is currently no good method of taking an arbitrary Revit unit and automatically converting it to an IFC unit, so the original work was for units that were (1) commonly used or (2) included in some certification. We've expanded over time as people have brought up other units, or as Revit has added support (for a long time, e.g., Revit did not have a mass unit. we therefore didn't support it). We will download your project and ensure that at the very least the units you found are covered. We appreciate you helping us help your projects be successful.

krabauinf commented 1 year ago

Hello @AngelVelezSosa, thank you for your response.

Well, I say it is not enough that you just react to people demanding for "certain" units just needed! Revit is IFC4ReferenceView certified and this demands to support ALL units defined in IFC4RV! See the ReferenceView requirements "... Default units are defined as either:

  • SI Units with SI unit name and prefix
  • Conversion based units with a conversion factor to its SI unit
  • Derived units, consisting of one-to-many unit elements, being SI units or conversion based units
  • Monetary unit as a special case of a unit to hold the currency name
>"
here https://standards.buildingsmart.org/MVD/RELEASE/IFC4/ADD2_TC1/RV1_2/HTML/annex/annex-a/reference-view/ReferenceView_V1-2.mvdxml. Here would be the starting point to know what to implement for IFC4RV "units" and the associated "measures": https://standards.buildingsmart.org/MVD/RELEASE/IFC4/ADD2_TC1/RV1_2/HTML/link/ifcmeasureresource.htm https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2_TC1/HTML/link/ifcunit.htm

Revit allows already a lot of units within its parameter definition system: https://www.revitapidocs.com/2017/4155880c-f243-3456-fbb8-542c8f8ad692.htm And IFC does too for a long time for its properties.

From a software developer standpoint, I understand that the export does not produce the right IFC unit, if that specific unit type is not available/needed in native Revit usage at all, clear. But I can not accept, that units that are there in the native Revit environment are not written or converted correctly to IFC - what is the difficulty there? Every practicing construction engineer has to convert between units on a daily basis to do his (calculation)work with building information coming from product specs, paper-notes from colleagues or - surprise - nowadays from BIM-property information. But also the best engineer needs to know what the unit of a delivered value is to be able to convert that - so plain "IFCReal" in IFCs data-properties is not enough, only because Revit software development did not accept the relevance. A value without a unit is worth nothing!

Revit is already quite strict on what datatype (not computer-storagetype) for a parameter is possible - this then corresponds to an underlying unit. For such a datatype users can only choose some fixed user-visible units and some kind of representation. A trivial development-approach to get IFC-values out would be that for every revit parameter datatype someone finds the corresponding IFC unit or IFC measure "word" and maps them together in revit-code. And if you have to calculate something from revit to ifc unit, well then do it. If it is not possible then maybe something is wrong with revit's internal datatype definition which has to be refactored or your software engineers have to get their "unit-study books from middleschool" out (but I don't want to dictate to you what YOUR job is. Handling units is not always easy, but certainly not rocket science). Just not doing it systematically is not acceptable. People are paying money for your software every year!

And don't say that nobody asks for all units. Nobody asks such basic things, because the IFC certification label suggests that nobody has to ask...

And please note: My testfiles are not extensive, so it is definitely not enough to just add my stated cliffhanger-unit "LinearVelocity". Revit failed after 4 parameters and I just wanted to proof that Revit does not behave like certified. The starting discussion with a colleague on LinkedIn and my research about revit-ifc sourcecode with developer-comments implied to me that this is is a systematic problem. The colleague has a Revit-testfile with a wall with more than 100 parameters and only 30% came out into IFC as expected, which I maybe could collect. But in fact it is your/Autdoesk's job to build the basic functionality. Users should only have to report on edge-case bugs. Revit developers ignored the base-case here (which is kind of embarrassing for the softwaredevelopment field), i.e. IFC4RV unit/measures-requirements. And yes, it seems that buildingSMART's certification testing is not complete enough to capture this failure - this has to be addressed too, but it is not a Revit matter (yet), but a buildingSMART discussion "over there".)

Please don't make it that easy for BIM/Revit-critics to find "reasons" why it is "all" bad with BIM/Revit - because it is clearly not all bad. Revit helped a lot driving the BIM action and interests over years. Keep up the leading role by delivering leading quality and features.

Moult commented 1 year ago

A consultant approached me today with attempting to get ReinforcementVolumeRatio (of type IfcMassDensityMeasure) working in Revit 2021. It turns out that in Revit 2021, even though we're a metric project, units get converted to imperial. So we see 100kg/m3 in Revit, but in IFC it shows as 2.83kg/m3 (yes, the unit is still kg/m3, but the value is mangled as if it were feet instead of meters). That problem seems to have been fixed in Revit 2022, but the project is not allowed to upgrade. Is it too much to support 2021? It's only a couple years ago and lagging 2 versions behind is very normal in our industry.

In addition, the documentation in the comment here https://github.com/Autodesk/revit-ifc/blob/master/Install/Program%20Files%20to%20Install/DefaultUserDefinedParameterSets.txt does not mention how to specify mass density. It seems as though "MassDensity" is recognised as a data type, but the consultant wouldn't know that because it isn't documented. Is it possible to update this documentation?

Is there something I can do for now? Or is it another case of "sorry, Revit doesn't work, use this parameter instead and then run this patch".