Open utterances-bot opened 3 years ago
test comment
Original comment by Johannes Römpp on 2017-08-25 04:33:35
Hi Thomas
I was wondering, if there is already a way to bring this newly constructed geometry (space) in to an ifc-file, as ifcspace (ifcclosedshell) in this case.
I tried the helloWall example and it works fine. But is there a way, to translate the box or any TopoDSShape to an ifc-entity directly?
Regards
Johannes
Original comment by Johannes Römpp on 2017-08-25 04:33:35
Hi Thomas
I was wondering, if there is already a way to bring this newly constructed geometry (space) in to an ifc-file, as ifcspace (ifcclosedshell) in this case.
I tried the helloWall example and it works fine. But is there a way, to translate the box or any TopoDSShape to an ifc-entity directly?
Regards
Johannes
Original comment by thomas on 2017-10-04 09:04:40
Hi Johannes,
Great question, an academy article on this is long overdue (feel free to step in case you feel like it). In recent IfcOpenShell versions there is ifcopenshell.geom.tesselate() and ifcopenshell.geom.serialize(). tesselate() will always work irrespective of shape and IFC schema, it just meshes the geometry, serialize() will fail for curved surfaces in 2x3 since they are not supported (and even in 4 a lot of viewers will not support them). Both return an IfcProductDefinitionShape that you can assign to a IfcProduct.Representation directly.
Kind regards,
Thomas
Original comment by Franke on 2018-04-12 13:45:06
Hello Thomas,
I have tried to run the code of part "Geting started" after completing all installation steps hopefully, the display window just crashed.
I have also tried to add "raw_input()", and then I could see the display window but it was always running. On chance to manipulate the ifc model there.
I have installed Qt4 and pyqt5. Would that be the prolem? I appreciate it, if you could give me some suggestions.
Original comment by Franke on 2018-04-12 13:45:06
Hello Thomas,
I have tried to run the code of part "Geting started" after completing all installation steps hopefully, the display window just crashed.
I have also tried to add "raw_input()", and then I could see the display window but it was always running. On chance to manipulate the ifc model there.
I have installed Qt4 and pyqt5. Would that be the prolem? I appreciate it, if you could give me some suggestions.
Original comment by Franke on 2018-04-13 15:52:01
It is a little wird to anser own question, but I hope my experience could help anyone who wanna try something on this.
the setup steps could be simpler:
download Anaconda
build an environment in Anaconda, the python version is not a problem, but you must make sure other packages matching the version of python.
just run the code from http://www.pythonocc.org/download/ in the terminal of the environment.
download the IfcOpenShell package, extract it into the Lib\site-packages\ directory of the Python installation folder. (just following the original instruction)
If you want to try the example of the IfcOpenHouse, remember to add raw_input() , which exists in the source code file, beneath the code in part "getting started". Otherwise, the viewer window will crash!
Original comment by Franke on 2018-04-12 13:45:06
Hello Thomas,
I have tried to run the code of part "Geting started" after completing all installation steps hopefully, the display window just crashed.
I have also tried to add "raw_input()", and then I could see the display window but it was always running. On chance to manipulate the ifc model there.
I have installed Qt4 and pyqt5. Would that be the prolem? I appreciate it, if you could give me some suggestions.
Original comment by Franke on 2018-04-13 15:52:01
It is a little wird to anser own question, but I hope my experience could help anyone who wanna try something on this.
the setup steps could be simpler:
download Anaconda
build an environment in Anaconda, the python version is not a problem, but you must make sure other packages matching the version of python.
just run the code from http://www.pythonocc.org/download/ in the terminal of the environment.
download the IfcOpenShell package, extract it into the Lib\site-packages\ directory of the Python installation folder. (just following the original instruction)
If you want to try the example of the IfcOpenHouse, remember to add raw_input() , which exists in the source code file, beneath the code in part "getting started". Otherwise, the viewer window will crash!
Original comment by thomas on 2018-05-29 15:11:14
Thanks for those suggestions. If you're using Anaconda, you can also install ifcopenshell using conda
conda install -c conda-forge -c oce -c dlr-sc -c ifcopenshell ifcopenshell
Indeed, a python script is executed from top to bottom and ends at the last line. You can add a raw_input() [input() in python3] or time.sleep() or ifcopenshell.geom.utils.main_loop() should also work.
Original comment by Franke on 2018-04-12 13:45:06
Hello Thomas,
I have tried to run the code of part "Geting started" after completing all installation steps hopefully, the display window just crashed.
I have also tried to add "raw_input()", and then I could see the display window but it was always running. On chance to manipulate the ifc model there.
I have installed Qt4 and pyqt5. Would that be the prolem? I appreciate it, if you could give me some suggestions.
Original comment by Franke on 2018-04-13 15:52:01
It is a little wird to anser own question, but I hope my experience could help anyone who wanna try something on this.
the setup steps could be simpler:
download Anaconda
build an environment in Anaconda, the python version is not a problem, but you must make sure other packages matching the version of python.
just run the code from http://www.pythonocc.org/download/ in the terminal of the environment.
download the IfcOpenShell package, extract it into the Lib\site-packages\ directory of the Python installation folder. (just following the original instruction)
If you want to try the example of the IfcOpenHouse, remember to add raw_input() , which exists in the source code file, beneath the code in part "getting started". Otherwise, the viewer window will crash!
Original comment by Thi Nguyen on 2020-06-03 14:40:49
Hello Frank and Thomas.
Thank you for your instructions. I tried to follow the instructions of Frank to install pythonocc-core==0.18.1 for python 2.7. At the third step, when i ran the command below in anaconda prompt:
conda install -c conda-forge -c dlr-sc -c pythonocc -c oce pythonocc-core==0.18.1
Anaconda prompt ran during 8 hours without results (I can not import OCC in my python script).
Could you please tell me how did you build the environment in Anaconda at your second step?
Thank you in advance for your help!
Original comment by Franke on 2018-04-12 13:45:06
Hello Thomas,
I have tried to run the code of part "Geting started" after completing all installation steps hopefully, the display window just crashed.
I have also tried to add "raw_input()", and then I could see the display window but it was always running. On chance to manipulate the ifc model there.
I have installed Qt4 and pyqt5. Would that be the prolem? I appreciate it, if you could give me some suggestions.
Original comment by Franke on 2018-04-13 15:52:01
It is a little wird to anser own question, but I hope my experience could help anyone who wanna try something on this.
the setup steps could be simpler:
download Anaconda
build an environment in Anaconda, the python version is not a problem, but you must make sure other packages matching the version of python.
just run the code from http://www.pythonocc.org/download/ in the terminal of the environment.
download the IfcOpenShell package, extract it into the Lib\site-packages\ directory of the Python installation folder. (just following the original instruction)
If you want to try the example of the IfcOpenHouse, remember to add raw_input() , which exists in the source code file, beneath the code in part "getting started". Otherwise, the viewer window will crash!
Original comment by Thi Nguyen on 2020-06-03 14:40:49
Hello Frank and Thomas.
Thank you for your instructions. I tried to follow the instructions of Frank to install pythonocc-core==0.18.1 for python 2.7. At the third step, when i ran the command below in anaconda prompt:
conda install -c conda-forge -c dlr-sc -c pythonocc -c oce pythonocc-core==0.18.1
Anaconda prompt ran during 8 hours without results (I can not import OCC in my python script).
Could you please tell me how did you build the environment in Anaconda at your second step?
Thank you in advance for your help!
Original comment by thomas on 2020-08-24 12:29:20
Perhaps try without the -c conda-forge
for pythonocc version 0.18 all the modules should be available on the other channels. You can also try to install just pythonocc-core without a version number (you'll get a newer version) from the conda-forge or pythonocc channel.
Original comment by Omar Zerhouni on 2020-08-27 14:38:42
It seems there is an incompatibility with the new version of pythonOCC-core.
Running this code, I get this message as an error :
Traceback (most recent call last):
File "C:/Users/TOSHIBA/AppData/Roaming/JetBrains/PyCharmCE2020.1/scratches/scratch_22.py", line 27, in
occ_display = ifcopenshell.geom.utils.initialize_display()
File "C:\ProgramData\Anaconda3\envs\EnvPy36\lib\site-packages\ifcopenshell\geom\occ_utils.py", line 78, in initialize_display
setup()
File "C:\ProgramData\Anaconda3\envs\EnvPy36\lib\site-packages\ifcopenshell\geom\occ_utils.py", line 57, in setup
viewer = viewer_handle.GetObject()
AttributeError: 'V3d_Viewer' object has no attribute 'GetObject'
TKOpenGl.WinSystem | Type: Error | ID: 6 | Severity: High | Message:
wglMakeCurrent() has failed. Descripteur non valide
Original comment by Omar Zerhouni on 2020-08-27 14:38:42
It seems there is an incompatibility with the new version of pythonOCC-core.
Running this code, I get this message as an error :
Traceback (most recent call last):
File "C:/Users/TOSHIBA/AppData/Roaming/JetBrains/PyCharmCE2020.1/scratches/scratch_22.py", line 27, in
occ_display = ifcopenshell.geom.utils.initialize_display()
File "C:\ProgramData\Anaconda3\envs\EnvPy36\lib\site-packages\ifcopenshell\geom\occ_utils.py", line 78, in initialize_display
setup()
File "C:\ProgramData\Anaconda3\envs\EnvPy36\lib\site-packages\ifcopenshell\geom\occ_utils.py", line 57, in setup
viewer = viewer_handle.GetObject()
AttributeError: 'V3d_Viewer' object has no attribute 'GetObject'
TKOpenGl.WinSystem | Type: Error | ID: 6 | Severity: High | Message:
wglMakeCurrent() has failed. Descripteur non valide
Original comment by thomas on 2020-09-22 11:50:23
There have been various fixes for compatibility with OCC versions. Can you try a more recent file from the github repo? https://github.com/IfcOpenShell/IfcOpenShell/commit/e2784fb69b8e657eba3fe0625a4ce460cd0a60f6 Just substitute the occ_utils.py file you have locally.
Original comment by Hamid Kiavarz on 2020-12-03 07:25:16
What is the equal syntax for the below statements:
topo = OCC.Utils.Topo(shape)
for face in topo.faces():
surf = OCC.BRep.BRep_Tool.Surface(face)
I need to extract the faces of a wall
Thanks,
Hamid
Original comment by Darija on 2021-06-15 13:32:36
I tried to run the code but this error came in, any suggestions?
Thank you in advanced
TypeError: Wrong number or type of arguments for overloaded function 'new_V3d_DirectionalLight'.
Possible C/C++ prototypes are:
V3d_DirectionalLight::V3d_DirectionalLight(V3d_TypeOfOrientation const,Quantity_Color const &,Standard_Boolean const)
V3d_DirectionalLight::V3d_DirectionalLight(gp_Dir const &,Quantity_Color const &,Standard_Boolean const)
Original comment by Darija on 2021-06-15 13:32:36
I tried to run the code but this error came in, any suggestions?
Thank you in advanced
TypeError: Wrong number or type of arguments for overloaded function 'new_V3d_DirectionalLight'.
Possible C/C++ prototypes are:
V3d_DirectionalLight::V3d_DirectionalLight(V3d_TypeOfOrientation const,Quantity_Color const &,Standard_Boolean const) V3d_DirectionalLight::V3d_DirectionalLight(gp_Dir const &,Quantity_Color const &,Standard_Boolean const)
Original comment by thomas on 2021-08-07 12:51:22
Yes, the PythonOCC version in this example is rather dated. Have a look here for more recent usage https://github.com/IfcOpenShell/IfcOpenShell/blob/dab2d5ce04ee6c4f8e37637184a1b0f083a7e2ee/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py#L93
Original comment by Hamid Kiavarz on 2020-12-03 07:25:16
What is the equal syntax for the below statements:
topo = OCC.Utils.Topo(shape)
for face in topo.faces():
surf = OCC.BRep.BRep_Tool.Surface(face)
I need to extract the faces of a wall Thanks, Hamid
Original comment by thomas on 2021-08-07 12:56:27
Use TopExp_Explorer to iterate over the faces
Using IfcOpenShell and pythonOCC to construct new geometry | IfcOpenShell Academy
https://academy2.ifcopenshell.org/posts/using-ifcopenshell-and-pythonocc-to-construct-new-geometry/