Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null reference with GetAttributeValue - IIfcPropertyBoundedValue #64

Open
dumitrugrl opened this issue Jan 20, 2022 · 1 comment
Open

Comments

@dumitrugrl
Copy link

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!

@dumitrugrl
Copy link
Author

dumitrugrl commented Jan 25, 2022

The offending ifc entry: #106=IFCPROPERTYBOUNDEDVALUE('RentalRatesInCategoryNow',$,$,$,$);
Not sure if just testing for null like in the image is enough to handle this case.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant