Import/Export IFC - compiling IfcOpenShell/fr: Difference between revisions
(Created page with "2. Depuis un terminal, accédez au dossier {{FileName|/nix/}} et lancez le script. Sous OSX, il est exécuté avec: {{Code|code= cd nix/ ./build-all.sh }} Il faudra entre 30 e...") |
(Created page with "3. Une fois terminé (je ne me souviens pas maintenant mais il sera imprimé quelque chose comme "Built IfcOpenShell..." et il reviendra à votre invite), vous aurez un nouvea...") |
||
Line 24: | Line 24: | ||
Il faudra entre 30 et 120 minutes pour tout compiler. Ce n'est pas la façon la plus intelligente de compiler IfcOpenShell mais ce simple script compilera toutes les dépendances, les versions de Python, etc. |
Il faudra entre 30 et 120 minutes pour tout compiler. Ce n'est pas la façon la plus intelligente de compiler IfcOpenShell mais ce simple script compilera toutes les dépendances, les versions de Python, etc. |
||
3. |
3. Une fois terminé (je ne me souviens pas maintenant mais il sera imprimé quelque chose comme "Built IfcOpenShell..." et il reviendra à votre invite), vous aurez un nouveau dossier {{FileName|/IfcOpenShell/build/}} plein de fichiers et de dossiers. D'après mon expérience personnelle, il y a deux semaines, le script nix "build-all.sh" ne s'est pas terminé avec succès, mais après l'avoir essayé hier avec les dernières mises à jour, cela a bien fonctionné, donc je suppose que vous pourriez rencontrer quelque chose de similaire au cas où le développement irait plus loin... |
||
Alors maintenant, vous avez tout ce dont vous avez besoin, mais vous devez faire un travail manuel pour le faire fonctionner: |
|||
So now you have everything you need but you have to do some manual work in order to get it working: |
|||
4. Open FreeCAD and open the [[Python console]] and [[Report view]]. Then write into the Python console the following: |
4. Open FreeCAD and open the [[Python console]] and [[Report view]]. Then write into the Python console the following: |
Revision as of 13:42, 6 September 2020
Tutoriel |
Thème |
---|
Arch Workbench |
Niveau |
Advanced |
Temps d'exécution estimé |
120 minutes |
Auteurs |
Pablo Gil |
Version de FreeCAD |
Fichiers exemples |
Voir aussi |
None |
Introduction
La recherche d'une copie de travail d'IfcOpenShell-python sous OSX/macOS pour importer/exporter des fichiers IFC a été si difficile que je partage ce tutoriel au cas où cela aiderait plus de gens. Mon système est OSX 10.11.6, 64 bits avec Python 2.7.11, cela pourrait fonctionner pour vous si vous avez également OSX car ils sont souvent 64 bits mais peuvent différer du mien. La procédure peut être très similaire si vous exécutez Linux ou Windows, mais elle présente probablement quelques différences.
Étapes
1. Téléchargez ou clonez le projet GitHub complet sur https://github.com/IfcOpenShell/IfcOpenShell (ce sera toujours la version la plus récente)
2. Depuis un terminal, accédez au dossier /nix/ et lancez le script. Sous OSX, il est exécuté avec:
cd nix/
./build-all.sh
Il faudra entre 30 et 120 minutes pour tout compiler. Ce n'est pas la façon la plus intelligente de compiler IfcOpenShell mais ce simple script compilera toutes les dépendances, les versions de Python, etc.
3. Une fois terminé (je ne me souviens pas maintenant mais il sera imprimé quelque chose comme "Built IfcOpenShell..." et il reviendra à votre invite), vous aurez un nouveau dossier /IfcOpenShell/build/ plein de fichiers et de dossiers. D'après mon expérience personnelle, il y a deux semaines, le script nix "build-all.sh" ne s'est pas terminé avec succès, mais après l'avoir essayé hier avec les dernières mises à jour, cela a bien fonctionné, donc je suppose que vous pourriez rencontrer quelque chose de similaire au cas où le développement irait plus loin... Alors maintenant, vous avez tout ce dont vous avez besoin, mais vous devez faire un travail manuel pour le faire fonctionner:
4. Open FreeCAD and open the Python console and Report view. Then write into the Python console the following:
import sys
print sys.path
You will get a looooong line with all the paths that FreeCAD reads. You may be able to install IfcOpenShell in any of them but I suggest you to place it inside one where you find a /site-packages/ after a /Python/ or /python-something/. In my case it was /Library/Python/2.7/site-packages. (Note: you will find paths inside your app directory but I suggest you to not use them because then IfcOpenShell will only be available for this app)
5. Once located where you want/have to install it, go there with your file browser (Finder in OSX). That is, go inside /site-packages/ folder
cd site-packages/
6. Open a new file browser window and navigate to your downloaded GitHub project: /IfcOpenShell/src/ifcopenshell-python/ and copy the full /ifcopenshell/ folder
7. Paste it inside /site-packages/ folder. Now you should have something like:
/site-packages/ifcopenshell/__init__.py
/site-packages/ifcopenshell/entity_instance.py
/site-packages/ifcopenshell/file.py
/site-packages/ifcopenshell/geom/app.py
/site-packages/ifcopenshell/geom/main.py
/site-packages/ifcopenshell/geom/occ_utils.py
/site-packages/ifcopenshell/geom/__init__.py
/site-packages/ifcopenshell/guid.py
8. Now we have to pick to files inside the /build/ folder, they are:
_ifcopenshell_wrapper.so
ifcopenshell_wrapper.py
but as we have compiled everything you will have to pick the one that matches with your FreeCAD Python version. Check it easily reading the first line inside your FreeCAD Python console view. In my case it was Python 2.7.11.
9. Now go let's copy the files inside the place it corresponds to your Python version. In my case it was:
/IfcOpenShell/build/Darwin/x86_64/build/ifcopenshell/[b]python-2.7[/b].10/ifcwrap/
10. Paste them inside /site-packages/ifcopenshell/
11. Check everything is in place:
/site-packages/ifcopenshell/__init__.py (1)
/site-packages/ifcopenshell/entity_instance.py (1)
/site-packages/ifcopenshell/_ifcopenshell_wrapper.so (2)
/site-packages/ifcopenshell/file.py (1)
/site-packages/ifcopenshell/geom/__init__.py (1)
/site-packages/ifcopenshell/geom/app.py (1)
/site-packages/ifcopenshell/geom/main.py (1)
/site-packages/ifcopenshell/geom/occ_utils.py (1)
/site-packages/ifcopenshell/guid.py (1)
/site-packages/ifcopenshell/ifcopenshell_wrapper.py (2)
(1) from GitHub project
(2) from /build/ folder
12. Close and reopen FreeCAD
Testing
Now that it is installed, let's check if everything works as expected:
12.1 in the Python console write:
import ifcopenshell
from ifcopenshell import geom
if it doesn't throw any error it means it may be correctly installed
12.2 Go to Yorik's FreeCAD manual, navigate to the lower part of the page and download the following files to test:
house.FCStd
house.ifc
12.3 Open house.FCStd, select the root "Building" object and export it (File → Export) setting the File type to "Industry Foundation Classes (*.ifc)". Press Save and if it works and it doesn't throw an error in the Report view then it's working.
12.4 Final test, import house.ifc into a new file so open a new file and import that file... it will take a while.
13. Enjoy BIM with FreeCAD!
Final thoughts
My opinion is that FreeCAD itself should have precompiled versions of IfcOpenShell bundled with the distribution because building it by yourself is a total pain and average user won't do it (they don't know how to compile, manage GitHub, etc), but well, maybe in the future.
I hope it helps you.
Cheers
Links
- Related forum thread discussion
- Démarrer avec FreeCAD
- Installation : Téléchargements, Windows, Linux, Mac, Logiciels supplémentaires, Docker, AppImage, Ubuntu Snap
- Bases : À propos de FreeCAD, Interface, Navigation par la souris, Méthodes de sélection, Objet name, Préférences, Ateliers, Structure du document, Propriétés, Contribuer à FreeCAD, Faire un don
- Aide : Tutoriels, Tutoriels vidéo
- Ateliers : Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Start, Surface, TechDraw, Test, Web