XbimExchange
XbimExchange copied to clipboard
null reference with GetAttributeValue - IIfcPropertyBoundedValue
Hi, I am trying to generate json from an IFC file and still getting this exception:
Message "Object reference not set to an instance of an object." string
SerializationStackTraceString " at XbimExchanger.IfcToCOBieLiteUK.XbimAttributedObject.GetAttributeValue(IIfcPropertyBoundedValue ifcPropertyBoundedValue)" string
StackTrace " at XbimExchanger.IfcToCOBieLiteUK.XbimAttributedObject.GetAttributeValue(IIfcPropertyBoundedValue ifcPropertyBoundedValue)" string
TargetSite {Xbim.CobieLiteUk.AttributeValue GetAttributeValue(Xbim.Ifc4.Interfaces.IIfcPropertyBoundedValue)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
I am guessing that it has to do with these lines in the IFC:
#100= IFCPROPERTYBOUNDEDVALUE('RentalRatesInCategoryNow',$,$,$,$);
#101= IFCPROPERTYSINGLEVALUE('VacancyRateInCategoryFuture',$,IFCPOSITIVERATIOMEASURE(0.),$);
#102= IFCPROPERTYBOUNDEDVALUE('RentalRatesInCategoryFuture',$,$,$,$);
The line that throws the exception:
exchanger.Convert();
The code I am using is the ones in the samples:
string folder = Path.GetDirectoryName(sFilePath);
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(sFilePath);
var facilities = new List<Facility>();
var exchanger = new IfcToCOBieLiteUkExchanger(model2, facilities);
facilities = exchanger.Convert();
var facilityType = facilities.FirstOrDefault();
if (facilityType == null)
return;
facilityType.WriteJson(Path.Combine(folder, $"{fileNameWithoutExtension}.json"), true);
Is there something I am missing?
Thank you!
The offending ifc entry: #106=IFCPROPERTYBOUNDEDVALUE('RentalRatesInCategoryNow',$,$,$,$);
Not sure if just testing for null like in the image is enough to handle this case.