-
Notifications
You must be signed in to change notification settings - Fork 41
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
How to extract JSON with quantities #46
Comments
Can you share what you expect? What 'quantity data' did you want to see. (There's lots of ways of conveying quantities in a model) |
Hello @andyward , I would like to know if there's a way to extract the JSON with the exchanger including more data on each element, like material, properties and quantities. I would like to get the same data that is shown in the Xbim Xplorer, but in JSON. Thanks, |
How are you extracting the JSON? Are you using COBieLiteUK Exchanger or something else? If you are, it should be outputting quantities. i.e. this code
If it's not can you provide a repo with:
Worth noting that as a simpler schema, the JSON representation is always going to be a lossy version of the IFC, so not everything will make it through the exchange. I can't remember off hand if materials make the cut, but quantities should. |
I was using this code:
But in the converted JSON there was no quantity information on many elements. Even opening on a text editor and manually searching, there wasn't a single element with Volume, which is a quantity that is shown when I open the IFC on the Xbim Xplorer. |
Can you provide a model? |
The code above is throwing an exception when trying to generate the JSON for the attached IFC file. The exception is: Exception: Object reference not set to an instance of an object., at XbimExchanger.IfcToCOBieLiteUK.XbimAttributedObject.GetAttributeValue(IIfcPropertyBoundedValue ifcPropertyBoundedValue)
at XbimExchanger.IfcToCOBieLiteUK.XbimAttributedObject.ConvertToAttributeType(IIfcProperty ifcProperty)
at XbimExchanger.IfcToCOBieLiteUK.CoBieLiteUkHelper.GetAttributes(IIfcObjectDefinition ifcObjectDefinition)
at XbimExchanger.IfcToCOBieLiteUK.MappingIfcBuildingToFacility.Mapping(IIfcBuilding ifcBuilding, Facility facility)
at XbimExchanger.IfcToCOBieLiteUK.IfcToCOBieLiteUkExchanger.Convert() The code is: using (var model = IfcStore.Open(sFilePathName))
{
var facilities = new List<Facility>();
var exchanger = new IfcToCOBieLiteUkExchanger(model, facilities);
facilities = exchanger.Convert();
var jsonFilename = Path.ChangeExtension(sFilePathName, "json");
for (var i = 0; i < facilities.Count; i++)
{
var facility = facilities[i];
var file = $"{sFilePathName}_{i}.json";
if (facilities.Count == 1)
file = $"{sFilePathName}.json";
facility.WriteJson(file);
}
} There are only two Line 58: #163= IFCPROPERTYBOUNDEDVALUE('RentalRatesInCategoryNow',$,$,$,$);
Line 60: #171= IFCPROPERTYBOUNDEDVALUE('RentalRatesInCategoryFuture',$,$,$,$); I gues it has to do with the lines below in the private static AttributeValue GetAttributeValue(IIfcPropertyBoundedValue ifcPropertyBoundedValue)
{
var ifcValue = (IExpressValueType) ifcPropertyBoundedValue.LowerBoundValue ; Can you, please, have a look at the attached file? Is there something wrong with it? |
After checking for null inside the There is a line inside the IFC file that holds a value that is too big for an Int32: This throws exception @ return new IntegerAttributeValue { Value = Convert.ToInt32(ifcValue.Value) }; |
Hello there,
After researching for the pastcouple days, I've figure it out it would be better if I seek for your help here...
I've got to the point where I've implemented a solution similar to this one.
xBimTeam/XbimEssentials#94 (comment)
But then, after creating the JSON, it seems there's no quantity data at all on this file.
Is there any way I could create this JSON with more data on the elements? If yes, how could I do that, please?
Thanks,
Bruno.
The text was updated successfully, but these errors were encountered: