I have gone through a research paper "Applying novelty detection to identify model element to IFC class misclassifications on architectural and infrastructure Building Information Models", published in Journal of Computational Design and Engineering (2018), which extracts data from IFC file for the analysis. I am able to extract area, volume and gyradius using IfcOpenShell and pythonOCC. How do I extract orientation from top and bottom of an Ifc element mentioned in this paper?
I used the example given here to extract orientation of Ifc entity.
As mentioned here, if density is not provided then Mass() method returns
- total area of the faces for surface properties and
- total volume of the solids for volume properties
Thanks Sabih, for the case of the related walls to a space which is a continiuse wall. which means, each part of wall is shared with different spaces. Is it possible to calculate the area of wall which is belong to a specific space ? sample in the attachment
Thanks Sabih. Finally, I could get the area and volume. IS it possible to have access to each face of a wall entity ? for example a wall has 6 faces and I need to access to each face along with its vertices separately.
Indeed, TopoDS_Shape.Orientation is something very specific. I think you're interested in the distance to other geometries?
Have a look at the code here: https://github.com/IfcOpenShell/IfcOpenShell/pull/130 to find elements in the surroundings and use BRepExtrema_DistShapeShape to find distances. You also get a pair of points that you can use to see if the shapes are connected top to bottom.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the quick response. I checked BRepExtrema_DistShapeShape which needs two TopoDS_Shape but as per the paper orientation is calculated for each individual element.
The paper didn't mention how orientation is calculated but it seems to be an angle that Ifc elements make with True North.
Short answer: You can look at the ObjectPlacement, it defines the orientation of the element relative to the parent element.
Long answer: I'm confused, your question title states something about Top and Bottom? To me it seems rotation relative to True north is not a very useful feature to identify element types. After all, a wall could be oriented in every direction. I can imagine if you determine something like proportions of an element you can easily segment walls from slabs, but that should already be covered by the more general geometry properties anyway.
But we're just speculating about some paper's intentions now. If you have specific questions I can be of better help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am using python 3.8 and try to get the geometry from Ifcopenshell. I am getting below error when I used settings.set(settings.use_python_opencascade, True) :
AttributeError: 'settings' object has no attribute 'use_python_opencascade'
please direct me how I can solve the issue
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thanks Thomas. I have already installed pythonocc but still getting the error of "'settings' object has no attribute 'use_python_opencascade'". Any clue ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unzip and save ifcopenshell folder in site-packages of the conda environment:
For windows: C:\Users\user\anaconda3\envs\pythonocc-core\Lib\site-packages
For Linux: /home/user/anaconda3/envs/pythonocc-core/lib/python3.8/site-packages
I tested the above steps. It works fine without any error.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Nothing
No module named 'OCC.BRep'; 'OCC' is not a package
No module named 'OCC.Core'; 'OCC' is not a package
module 'ifcopenshell' has no attribute 'geom'
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What's the contents of the OCC folder? Are you sure you're using the correct env and python interpreter when importing? I.e what does the following say:
Hi,
I have gone through a research paper "Applying novelty detection to identify model element to IFC class misclassifications on architectural and infrastructure Building Information Models", published in Journal of Computational Design and Engineering (2018), which extracts data from IFC file for the analysis. I am able to extract area, volume and gyradius using IfcOpenShell and pythonOCC. How do I extract orientation from top and bottom of an Ifc element mentioned in this paper?
I used the example given here to extract orientation of Ifc entity.
I am getting "0" for all Ifc entities. It seems I am calling wrong function to get the Orientation.
Hi Sabih,
Can you guide me to get the area (surface area) and volume of a wall from ifc ?
Hi Hamid,
After creating the BREP representation of the wall
you can use brepgprop_SurfaceProperties to find the surface area and brepgprop_VolumeProperties to find the volume of wall.
Import the required modules:
then
As mentioned here, if density is not provided then Mass() method returns
- total area of the faces for surface properties and
- total volume of the solids for volume properties
Thanks Sabih, for the case of the related walls to a space which is a continiuse wall. which means, each part of wall is shared with different spaces. Is it possible to calculate the area of wall which is belong to a specific space ? sample in the attachment
Last edit: Hamid Kiavarz 2020-11-29
Thanks Sabih. Finally, I could get the area and volume. IS it possible to have access to each face of a wall entity ? for example a wall has 6 faces and I need to access to each face along with its vertices separately.
http://academy.ifcopenshell.org/using-ifcopenshell-and-pythonocc-to-construct-new-geometry/
But OCC.Utils.Topo does not exist anymore. Use OCC.Core.TopExp.TopExp_Explorer
OCC.Core.TopExp.TopExp_Explorer also is not available
OCC.TopExp.TopExp_Explorer depending on version of pythonocc
Indeed,
TopoDS_Shape.Orientation
is something very specific. I think you're interested in the distance to other geometries?Have a look at the code here: https://github.com/IfcOpenShell/IfcOpenShell/pull/130 to find elements in the surroundings and use
BRepExtrema_DistShapeShape
to find distances. You also get a pair of points that you can use to see if the shapes are connected top to bottom.Hi Thomas,
Thanks for the quick response. I checked BRepExtrema_DistShapeShape which needs two
TopoDS_Shape
but as per the paper orientation is calculated for each individual element.The paper didn't mention how orientation is calculated but it seems to be an angle that Ifc elements make with True North.
Reference: About the Geo-referencing of BIM models.
Short answer: You can look at the ObjectPlacement, it defines the orientation of the element relative to the parent element.
Long answer: I'm confused, your question title states something about Top and Bottom? To me it seems rotation relative to True north is not a very useful feature to identify element types. After all, a wall could be oriented in every direction. I can imagine if you determine something like proportions of an element you can easily segment walls from slabs, but that should already be covered by the more general geometry properties anyway.
But we're just speculating about some paper's intentions now. If you have specific questions I can be of better help.
Dear team,
I am using python 3.8 and try to get the geometry from Ifcopenshell. I am getting below error when I used settings.set(settings.use_python_opencascade, True) :
AttributeError: 'settings' object has no attribute 'use_python_opencascade'
please direct me how I can solve the issue
use_python_opencascade should be UPPERCASE. In addition make sure you have the pythonocc-core python module installed for the setting to be available.
thanks Thomas. I have already installed pythonocc but still getting the error of "'settings' object has no attribute 'use_python_opencascade'". Any clue ?
Hi Hamid,
It seems you are using
As mentioned by Thomas, please change this to
Hi Sabih.
I tried both but still getting same error.
Hi Hamid,
There might be installation issue with your packages. Please try with new installation:
Create a new environment:
Activate the environment:
Install pythonocc-core 7.4.0:
Download the appropriate version of IfcOpenShell-python from url under 0.6.0 latest:
For windows (64bit): IfcOpenShell-python for python 3.8 64bit Windows
For Linux (64bit): IfcOpenShell-python for python 3.8 64bit Linux
Unzip and save ifcopenshell folder in site-packages of the conda environment:
For windows:
C:\Users\user\anaconda3\envs\pythonocc-core\Lib\site-packages
For Linux:
/home/user/anaconda3/envs/pythonocc-core/lib/python3.8/site-packages
I tested the above steps. It works fine without any error.
Hi Sabih,
Thanks for your advice, I have tried the capital letters as well but still
getting the same error.
On Tue, Nov 24, 2020 at 11:11 AM Sabih Ahmad Khan sabihahmadkhan@users.sourceforge.net wrote:
--
Hamid Kiavarz Moghaddam
Email: hkiavarz@gmail.com
Email: hkiavarz@yorku.ca
+1 647-807-8909
What's the output of the following as individual commands, so run each of them separately:
import OCC
import OCC.BRep
import OCC.Core.BRep
print(dir(settings))
Nothing
No module named 'OCC.BRep'; 'OCC' is not a package
No module named 'OCC.Core'; 'OCC' is not a package
module 'ifcopenshell' has no attribute 'geom'
Then are you sure you have pythonocc installed? How did you install it?
I do. I followed the steps that Sabih mentioned in the upper comments :
onda create --name=pythonocc-core python=3.8
Activate the environment:
conda activate pythonocc-core
Install pythonocc-core 7.4.0:
conda install -c conda-forge pythonocc-core=7.4.0.
here is the folders I have in site-package
But then I can't explain:
What's the contents of the OCC folder? Are you sure you're using the correct env and python interpreter when importing? I.e what does the following say:
here is teh result and find the content of OCC in the atatchment:
C:\Users\Malavan-PC\AppData\Local\Programs\Python\Python38-32\python.exe
['C:\Users\Malavan-PC\AppData\Local\Programs\Python\Python38-32', 'C:\Users\Malavan-PC\AppData\Local\Programs\Python\Python38-32\lib\site-packages']
C:\Users\Malavan-PC\AppData\Roaming\Python\Python38\site-packages
PS C:\Users\Malavan-PC\OneDrive - York University\Coding>