-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using IfcOpenShell and pythonOCC to construct new geometry | IfcOpenShell Academy #1
Comments
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 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-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:
|
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 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 |
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
File "C:\ProgramData\Anaconda3\envs\EnvPy36\lib\site-packages\ifcopenshell\geom\occ_utils.py", line 78, in initialize_display
File "C:\ProgramData\Anaconda3\envs\EnvPy36\lib\site-packages\ifcopenshell\geom\occ_utils.py", line 57, in setup
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? IfcOpenShell/IfcOpenShell@e2784fb 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)
|
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:
|
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 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/
The text was updated successfully, but these errors were encountered: