IndustryFoundationClasses / Questions

Have a question about IFCs? Ask here. Use Github Issues.
20 stars 4 forks source link

How to determine if a wall instance is exterior or interior type? #9

Open aahoo opened 7 years ago

aahoo commented 7 years ago

I am looking for a straightforward way to determine whether a wall instance is interior or exterior. I couldn't find anything in the IFC spec that could help with this. Since I am analysing many many IFC files, manual identification is not feasible. I would prefer not to go into analyzing object geometries unless I am left with no other choice. Any clue on how to achieve this?

aothms commented 7 years ago

There is an IsExternal property [1] that is defined fairly often. Alternatively, if available, you could look into the space boundary relationships, if a wall bounds spaces on only one side of the wall you could assume it is part of the exterior boundary. In both cases you rely on the existing semantic data in the model to be complete and accurate, which is not always the case. Even if you do this purely based on geometry, which might be most robust, you'll likely encounter ambiguities (e.g exterior walls extending into the building, ...)

[1] http://www.buildingsmart-tech.org/ifc/IFC2x3/TC1/html/psd/IfcSharedBldgElements/Pset_WallCommon.xml

aahoo commented 7 years ago

Thank you so much @aothms, it was very helpful :)

aahoo commented 7 years ago

@aothms

Here is my WIP implementation using IfcOpenShell. I used DefinesOccurrence inverse relation for tracing from IfcPropertySingleValues (with IsExternal set to True) to wall instances. I am not sure if that was the correct way since DefinesOccurrence seems to be non-existent in IFC 2x3. I will complete the example later on. Feel free to reference it in IfcOpenShell academy :)

aahoo commented 7 years ago

For the curious, I could not figure out an easy way to check whether a "wall bounds spaces on only one side" using IfcRelSpaceBoundary as suggested by @aothms. Instead, I found InternalOrExternalBoundary attribute which determines if a wall (or any building element) is separating internal space from open space. It does not work if spaces are not defined in the model. Even if they are defined, InternalOrExternalBoundary attribute should have been assigned a correct value.

Space boundary addon view seem a relevant thing here, but I haven't looked into it yet.

aothms commented 7 years ago

@aahoo thanks for sharing this.

IFC4 indeed introduces some novel useful inverse relationships. IfcOpenShell also allows to just obtain "generic inverses" i.e. all instances pointing to this instance with the ifcopenshell.file.get_inverse() function.

>>> import ifcopenshell
>>> f = ifcopenshell.open("IfcCircleProfileDef.ifc")
>>> c = f.by_type("IfcCartesianPoint")[0]
>>> c
#9=IfcCartesianPoint((0.,0.,0.))
>>> f.get_inverse(c)
[#10=IfcAxis2Placement3D(#9,#8,#7)]

For the space boundaries geometry you might be able to test whether all are on the same side of the wall center line (i.e. in the image below <W_0> <W_1> <B_i_j> are all counter clock-wise). So it's an external wall. It's essentially a 2d problem, so relatively manageable. But yeah, only do this in case the IsExternal stuff doesn't prove to be reliable for the files you operate on.

spaceboundaries

aahoo commented 7 years ago

ifcopenshell.file.get_inverse()

It seems that I need to learn more about ifcopenshell. This is a very handy feature. If I understand it correctly, it does not replace the inverse attributes in IFC because inverse attributes are specific while ifcopenshell.file.get_inverse() is generic.

Thank you for your elaborate explanation. I haven't delved into geometry yet, but I know that eventually I will have to.

aothms commented 7 years ago

while ifcopenshell.file.get_inverse() is generic

Indeed. It whatever the type of the instance a, all instances B will be returned that have a somewhere in their attribute values (or in a list/set/etc.). Under the hood the lookup for the inverse relationships on the schema level is implemented on top of this function.

I-Sokolov commented 7 years ago

IsExternal property is the simplest and I think only possibly (without geometry analysis) if space boundaries missed (for example Coordination View) If you have space boundaries you can check if EXSIST one IfcRelSpaceBoundary pointed this wall and is external or (when notdefiled) points to no space or external space. Checking "wall bounds spaces on only one side" is not so easy really because we have no wall side identification (or did I miss something?)

aothms commented 7 years ago

IsExternal property is the simplest

True, but of course there are also cases where this information is incorrect, e.g. see below. And although that'd be a consideration for all methods, geometrical flaws in a model might be noticed more easily.

Checking "wall bounds spaces on only one side" is not so easy really because we have no wall side identification (or did I miss something?)

Well, if you have a center-line for the wall (based on the Axis representation perhaps) it is essentially a 2d problem where (for linear walls) you can see if all space boundary points are either clockwise or counter-clockwise from the two center-line end-points.

duplex-external-wall

wenrouce commented 3 years ago

IsExternal property is the simplest

True, but of course there are also cases where this information is incorrect, e.g. see below. And although that'd be a consideration for all methods, geometrical flaws in a model might be noticed more easily.

Checking "wall bounds spaces on only one side" is not so easy really because we have no wall side identification (or did I miss something?)

Well, if you have a center-line for the wall (based on the Axis representation perhaps) it is essentially a 2d problem where (for linear walls) you can see if all space boundary points are either clockwise or counter-clockwise from the two center-line end-points.

duplex-external-wall

Hi aothms,

I am interested in the ifc viewer in the quoted photo. I searched ifcopenshell ifc viewer but did not find the same viewer. It would be really nice if you would like to share where to download the same viewer.

aothms commented 3 years ago

@wenrouce it's the IfcOpenShell python app https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.6.0/src/ifcopenshell-python/ifcopenshell/geom/app.py#L480

from ifcopenshell.geom.app import application
application().start()
MariosKoni commented 2 years ago

@aothms When I try to import the application, I get the following error.

Traceback (most recent call last):
  File "C:\Users\Marios\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ifcopenshell\geom\app.py", line 31, in <module>
    from OCC.Core import AIS
ModuleNotFoundError: No module named 'OCC'

Any idea?

aothms commented 2 years ago

@MariosKoni that is Python OpenCASCADE https://github.com/tpaviot/pythonocc-core/