BIMserver icon indicating copy to clipboard operation
BIMserver copied to clipboard

Getting effectivly ahold of IFC data with json API: Download +Query Vs ObjectData Looping

Open Mertovski opened this issue 3 years ago • 2 comments

My question is: What would be the correct way to acquire data of a certain IFC model based on a revision through the JSON api? I'm using a c# client to get ahold of the datamodel and transform it into a graphical representation.

The information I want to get is basically the same way formatted in the BIMview.vs. which is in a tree, but I also want properties from some of the building elements while doing so (ie. name, size, length, width etc). So the result should be: an array of buildings and it's storeys and child building elements w/ properties.

I've came to the conclusion there's two ways to do this:

  1. Use the download method and create an extraordinary query which will result in the exact stuff I need.

Seems like this is plausible, and most likely the prefered way to handle this kind of problem. But I've got trouble to execute the query of BIMview.vs inside the Console application.

The query used by BIMview:

query "{"queries":[{"type":"IfcProduct"},{"type":"IfcAnnotation"},{"type":"IfcElement"},{"type":"IfcBuildingElement"},{"type":"IfcBeam"},{"type":"IfcBeamStandardCase"},{"type":"IfcBuildingElementProxy"},{"type":"IfcChimney"},{"type":"IfcColumn"},{"type":"IfcColumnStandardCase"},{"type":"IfcDoorStandardCase"},{"type":"IfcFooting"},{"type":"IfcMemberStandardCase"},{"type":"IfcPile"},{"type":"IfcPlateStandardCase"},{"type":"IfcRailing"},{"type":"If…"},{"type":"IfcStructuralPointReaction"},{"type":"IfcStructuralSurfaceReaction"},{"type":"IfcStructuralItem"},{"type":"IfcStructuralConnection"},{"type":"IfcStructuralCurveConnection"},{"type":"IfcStructuralPointConnection"},{"type":"IfcStructuralSurfaceConnection"},{"type":"IfcStructuralMember"},{"type":"IfcStructuralCurveMember"},{"type":"IfcStructuralCurveMemberVarying"},{"type":"IfcStructuralSurfaceMember"},{"type":"IfcStructuralSurfaceMemberVarying"}]}"
  1. Loop through the whole IFC model with getObjectData calls to get the objects, and their relations and continue digging deeper untill I have what I want.

The labor is certainly a lot heavier, but the calls will be individual so there will be no "download" involved and getting a hold of data will be more specific.

Interested in what you guys think. I've come across a few solutions with similar problems which make me lean towards the query method.

Mertovski avatar May 20 '21 08:05 Mertovski

Yes, prefer the query over the low level call. With this method you can still split your query to get the structure first and then details for specific objects in separate calls.

hlg avatar Sep 24 '21 05:09 hlg

What kind of problem do you have with executing the query inside Console app? The query in JSON body of console should look like this: "query":"{\"type": {\"name\": \"IfcProduct\",\"includeAllSubTypes\": true}}", (You should use "\" before " " " to make it work right).

Did you managed to get information from the model in "tree" format, without postprocessing it?

maks2199 avatar Jul 26 '22 10:07 maks2199