"Query" IFC along a line

Hi fellow IFCers,
I’ve searched on the wide wide web for any tool that could perform a “querying operation” along a line and I couldn’t find anything that would be obviously useful to me. Since a “querying operation” is not really descriptive, I’ll provide a more detailed description of our problem and what are the results we would like to obtain.

Let’s say we have three walls with different widths, materials and distances in between them. A line is passing through these walls like this:
Wall%20example_3D
Wall%20example_2D

We then export these walls as IFC and we get the line in a seperate IFC file as a IfcCurve.(IfcLine, IfcPolyline or IfcBSplineCurve, etc.).

Next we need to perform a query along this line through the IFC 3D geometry to get sections of the line that pass through a particular 3D objects. We then would need to get some properties on these sections that are pulled from 3D objects (the material in this simple case). Our end result would be a table (XML, CSV, etc.) carrying data like this:

Wall%20example_Table

Mind you that the these could be any 3D objects (proxy included).

I hope I was able to explain the problem properly.

I’ve already checked tools like IfcOpenShell and IFC++, but the documentation on these tools is sparse and my programming skills aren’t as good as I’d wish, so there might be an obvious solution using these two or some other tools and I just can’t find it. If you have any suggestions on how this could be done and how we could use a tool to code the solution, don’t hesitate to speak out.

Any and all help would be much appreciated.

Thanks,
Jure

I’ve already checked tools like IfcOpenShell and IFC++, but the documentation on these tools is sparse and my programming skills aren’t as good as I’d wish

In the end what most of these tools offer is a “mapping” from the IFC definitions to another geometry kernel: e.g. Open CASCADE, carve, CGAL, … This being more of a geometrical task, it’d be better to focus on the documentation of that.

Using IfcOpenShell and for example pythonOCC it shouldn’t be an overly complex task to accomplish this, but I agree that also in the Open CASCADE documentation it’s hard to discover the building blocks you’ll need for a task like this.

OK, we’ll look more into it. If we figure out anything I’ll report here.

Thank you.

@aothms is right that is is a geometric operation - specifically the operation you are referring to is called “ray-casting”. For OpenCascade (which IfcOpenShell exposes through PythonOCC) take a look at IntCurvesFace_ShapeIntersector (and optionally BRepIntCurveSurface_Inter).

For getting around IfcOpenShell, this article might help: https://thinkmoult.com/using-ifcopenshell-parse-ifc-files-python.html

1 Like

Thanks for the articles @Moult

In Open CASCADE there are usually multiple ways to accomplish the same. Algorithms that operate on Geometry or Topology (or based on Adapters), and high and low level interfaces, the latter with more control or performance but less validation of invariants. There is also the (BRep)Extrema packages, e.g. https://dev.opencascade.org/doc/refman/html/class_b_rep_extrema___dist_shape_shape.html

You can also use https://github.com/IfcOpenShell/IfcOpenShell/pull/130 or https://www.opencascade.com/doc/occt-7.3.0/refman/html/class_n_collection___u_b_tree.html to build a spatial acceleration structure to perform bounding box intersections in logarithmic time to generate candidates for the actual edge-shape intersections.

2 Likes