Import/Export IFC - compiling IfcOpenShell/ro: Difference between revisions

From FreeCAD Documentation
(Created page with "== Introducere == It was a such a hard investigation on how to get a working copy of IfcOpenShell-python on OSX/macOS in order to import/export IFC files that I'm sharing this...")
(Updating to match new version of source page)
 
(33 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<div class="mw-translate-fuzzy">
{{TutorialInfo
{{TutorialInfo/ro
|Topic=Arch Workbench
|Topic=Arch Workbench
|Level=Advanced
|Level=Advanced
Line 8: Line 9:
|Files=
|Files=
}}
}}
</div>



== Introducere ==
== Introducere ==
It was a such a hard investigation on how to get a working copy of IfcOpenShell-python on OSX/macOS in order to import/export IFC files that I'm sharing this tutorial in case it helps more people.
A fost o anchetă foarte dificilă până am obținut 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 cu speranța ajută mai mulți oameni.
My system is OSX 10.11.6, 64bits with Python 2.7.11, it might work for you if you have also OSX as they are often 64bits but may differ from mine. The procedure might be very similar if you run Linux or Windows but it probably have some differences.
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.

== Requirements ==

* [[IfcOpenShell]]
* FreeCAD v0.19 or higher


<div class="mw-translate-fuzzy">
== Steps ==
== Pași de urmat ==
1. Download or clone the full GitHub project at https://github.com/IfcOpenShell/IfcOpenShell (it will always be the newest version)
1. Descărcați sau clonați întregul proiect GitHub de la https://github.com/IfcOpenShell/IfcOpenShell (va conține întotdeauna cea mai nouă versiune)
</div>


<div class="mw-translate-fuzzy">
2. From a terminal go to '''/nix/''' folder and launch the script. In OSX it is ran with:
2. De la un terminal mergeți în directorul '''/ nix /''' și lansați scriptul. În OSX este rulat cu:
{{Code|code=
{{Code|code=
./build-all.sh
./build-all.sh
}}
}}
Va dura între 30 și 120 de minute pentru a compila totul. IfcOpenShell nu este modul cel mai inteligent de compilare, dar acest script simplu va compila toate dependențele, versiunile Python și așa mai departe.
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.
</div>


<div class="mw-translate-fuzzy">
3. Once it finishes (I don't remember now but it will be printed something like "Built IfcOpenShell..." and it will return to your prompt) you will have a new folder '''/IfcOpenShell/build/''' full of files and folders. 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...
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:
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:
Line 31: Line 42:
}}
}}
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)
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)
</div>


4. Open FreeCAD and open the [[Python console]] and [[Report view]]. Then write into the Python console the following:
5. So, 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
{{Code|code=
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 {{FileName|/site-packages/}} after a {{FileName|/Python/}} or {{FileName|/python-something/}}. In my case it was {{FileName|/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)


<div class="mw-translate-fuzzy">
6. Open a new file browser window and navigate to your downloaded GitHub project: '''/IfcOpenShell/src/ifcopenshell-python/''' and copy the full '''/ifcopenshell/''' folder
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
</div>


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. Paste it inside '''/site-packages/''' folder. Now you should have something like:

7. Lipiți-l (din copy/paste) în interior '''/site-packages/''' folder. Now you should have something like:
{{Code|code=
{{Code|code=
/site-packages/ifcopenshell/__init__.py
/site-packages/ifcopenshell/__init__.py
Line 48: Line 69:
}}
}}


<div class="mw-translate-fuzzy">
8. Now we have to pick to files inside the /build/ folder, they are:
8. Acum trebuie să alegem fișierele din directorul / build /, acestea sunt:
{{Code|code=
{{Code|code=
_ifcopenshell_wrapper.so
_ifcopenshell_wrapper.so
Line 54: Line 76:
}}
}}
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.
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.
</div>


9. Acum mergeți să copiați fișierele în interiorul locului care corespunde versiunii dumneavoastră Python. În cazul meu, a fost:
9. Now go let's copy the files inside the place it corresponds to your Python version. In my case it was:
{{Code|code=
{{Code|code=
/IfcOpenShell/build/Darwin/x86_64/build/ifcopenshell/[b]python-2.7[/b].10/ifcwrap/
/IfcOpenShell/build/Darwin/x86_64/build/ifcopenshell/[b]python-2.7[/b].10/ifcwrap/
}}
}}


<div class="mw-translate-fuzzy">
10. Paste them inside /site-packages/ifcopenshell/
10. Lipiți-l în inside/site-packages/ifcopenshell/
</div>


11. Verificați totul:
11. Check everything is in place:
{{Code|code=
{{Code|code=
/site-packages/ifcopenshell/__init__.py (1)
/site-packages/ifcopenshell/__init__.py (1)
Line 80: Line 105:




12. Close and reopen FreeCAD
12. Închideți și redeschideți FreeCAD


== Testing ==
== Testarea ==
Acum, că este instalat, să verificăm dacă totul funcționează așa cum era de așteptat:
Now that it is installed, let's check if everything works as expected:


12.1 in the Python console write:
12.1 în consola Python console scriem:
{{Code|code=
{{Code|code=
import ifcopenshell
import ifcopenshell
Line 92: Line 117:
if it doesn't throw any error it means it may be correctly installed
if it doesn't throw any error it means it may be correctly installed


<div class="mw-translate-fuzzy">
12.2 Go to Yorik's FreeCAD manual, navigate to the lower part of the page and download the following files to test:
12.2 Mergeți la manualul FreeCAD a lui Yorik , navigați în partea de jos a paginii și descărcați următoarele fișiere pentru test:
{{Code|code=
{{Code|code=
house.FCStd
house.FCStd
house.ifc
house.ifc
}}
}}
</div>

<div class="mw-translate-fuzzy">
12.3 Deschideți '''house.FCStd''', selectați rădăcina "Building" obiect și exportați-l (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
</div>

<div class="mw-translate-fuzzy">
12.4 Testul final, importați '''house.ifc''' intr-un nou fișier astfel încât deschideți un nou fișier și importați acel fișier... vă va lua ceva timp.
</div>

13. Bucurați-vă de Atelierul Construcții/BIM cu FreeCAD!


== Gânduri de sfârșit ==
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
În opinia mea FreeCAD în sine ar trebui să aibă versiuni precompilate ale IfcOpenShell incluse în distribuție, deoarece construirea de către dvs. este o durere totală și utilizatorul mediu nu o va face (ei nu știu cum să compileze, să gestioneze GitHub, etc), în fine, poate în viitor.


Sper că vă va ajuta.
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.


Noroc!
13. Enjoy BIM with FreeCAD!


<div class="mw-translate-fuzzy">
== Final thoughts ==
==Legături==
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.
Subiectul este pe Forum la [http://forum.freecadweb.org/viewtopic.php?f=23&t=17536 here]
</div>


* Related forum thread [http://forum.freecadweb.org/viewtopic.php?f=23&t=17536 discussion]
I hope it helps you.
* [[IfcOpenShell]]


Cheers


{{Userdocnavi{{#translation:}}}}
==Links==
[[Category:BIM{{#translation:}}]]
Forum thread [http://forum.freecadweb.org/viewtopic.php?f=23&t=17536 here]
[[Category:Arch{{#translation:}}]]
[[Category:3rd Party{{#translation:}}]]
[[Category:File_Formats{{#translation:}}]]

Latest revision as of 11:42, 14 August 2021

Tutorial
Topic
Arch Workbench
Level
Advanced
Time to complete
120 minutes
Authors
Pablo Gil
FreeCAD version
Example files
See also
None

Introducere

A fost o anchetă foarte dificilă până am obținut 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 cu speranța că 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.

Requirements

Pași de urmat

1. Descărcați sau clonați întregul proiect GitHub de la https://github.com/IfcOpenShell/IfcOpenShell (va conține întotdeauna cea mai nouă versiune)

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

./build-all.sh

Va dura între 30 și 120 de minute pentru a compila totul. IfcOpenShell nu este modul cel mai inteligent de compilare, dar acest script simplu va compila toate dependențele, versiunile Python și așa mai departe.

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:

import sys
print sys.path

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)

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

/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. Acum trebuie să alegem fișierele din directorul / build /, acestea sunt:

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

/IfcOpenShell/build/Darwin/x86_64/build/ifcopenshell/[b]python-2.7[/b].10/ifcwrap/

10. Lipiți-l în inside/site-packages/ifcopenshell/

11. Verificați totul:

/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. Închideți și redeschideți FreeCAD

Testarea

Acum, că este instalat, să verificăm dacă totul funcționează așa cum era de așteptat:

12.1 în consola Python console scriem:

import ifcopenshell
from ifcopenshell import geom

if it doesn't throw any error it means it may be correctly installed

12.2 Mergeți la manualul FreeCAD a lui Yorik , navigați în partea de jos a paginii și descărcați următoarele fișiere pentru test:

house.FCStd
house.ifc

12.3 Deschideți house.FCStd, selectați rădăcina "Building" obiect și exportați-l (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 Testul final, importați house.ifc intr-un nou fișier astfel încât deschideți un nou fișier și importați acel fișier... vă va lua ceva timp.

13. Bucurați-vă de Atelierul Construcții/BIM cu FreeCAD!

Gânduri de sfârșit

În opinia mea FreeCAD în sine ar trebui să aibă versiuni precompilate ale IfcOpenShell incluse în distribuție, deoarece construirea de către dvs. este o durere totală și utilizatorul mediu nu o va face (ei nu știu cum să compileze, să gestioneze GitHub, etc), în fine, poate în viitor.

Sper că vă va ajuta.

Noroc!

Legături

Subiectul este pe Forum la here