Import/Export IFC - compiling IfcOpenShell/ro

Introducere
A fost o anchetă atât de dificilă de a obține o copie de lucru a IfcOpenShell-python pe OSX / macOS pentru a importa / exporta fișierele IFC pe care le partajăm în acest tutorial în cazul în care ajută mai mulți oameni. Sistemul nostru de operare OSX 10.11.6, 64bits cu Python 2.7.11, ar putea funcționa pentru dvs. dacă aveți OSX, de asemenea, deoarece acestea sunt adesea 64bits dar pot diferi de a mea. Procedura ar putea fi foarte asemănătoare dacă rulați sub Linux sau Windows, dar probabil există unele diferențe.

Pași de urmat
1. Descărcați sau clonați întregul proiect GitHub de la https://github.com/IfcOpenShell/IfcOpenShell (it will always be the newest version)

2. De la un terminal mergeți în directorul / nix / și lansați scriptul. În OSX este rulat cu:

It will take from 30 up to 120 minutes to compile everything. It's not the smarter way of compiling IfcOpenShell but this simple script will compile all dependencies, Python versions, etc.

3. După ce termină (nu-mi amintesc acum, dar va fi tipărit ceva de genul "Built IfcOpenShell ..." și se va întoarce la promptul dvs.) veți avea un nou dosar /IfcOpenShell/build/ plin de fișiere și foldere. From my personal experience, two weeks ago the nix "build-all.sh" script didn't finished successfully but after trying it yesterday with the newest updates it worked fine so I guess you might experience something similar in case the development goes further... 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:

You will get a looong 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. (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. Deci, odată localizat unde doriți / trebuie să-l instalați, mergeți acolo cu browser-ul de fișiere (Finder în OSX). That is, go inside /site-packages/ folder

6. Deschideți o nouă fereastră de browser de fișiere și navigați la proiectul GitHub descărcat: /IfcOpenShell/src/ifcopenshell-python/ and copy the full /ifcopenshell/ folder

7. Lipiți-l (din copy/paste) în interior /site-packages/ folder. Now you should have something like:

8. Acum trebuie să alegem fișierele din directorul / build /, acestea sunt:

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. Acum mergeți să copiați fișierele în interiorul locului care corespunde versiunii dumneavoastră Python. În cazul meu, a fost:

10. Paste them inside /site-packages/ifcopenshell/

11. Check everything is in place:

(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:

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:

12.3 Open house.FCStd, select the root "Building" object and export it (menu 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
Forum thread here