PythonOCC/it: Difference between revisions

From FreeCAD Documentation
(Created page with "[http://www.pythonocc.org/ PythonOCC] è un progetto abbastanza giovane e dinamico che mira a unire la gamma di funzioni di OpenCascade in un modulo python. Questo è un metod...")
(Updating to match new version of source page)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>

== Description ==

<div class="mw-translate-fuzzy">
[http://www.pythonocc.org/ PythonOCC] è un progetto abbastanza giovane e dinamico che mira a unire la gamma di funzioni di OpenCascade in un modulo python. Questo è un metodo molto differente da quello di FreeCAD, che utilizza solo alcuni componenti di OpenCascade, e che risulta una struttura molto più semplice.
[http://www.pythonocc.org/ PythonOCC] è un progetto abbastanza giovane e dinamico che mira a unire la gamma di funzioni di OpenCascade in un modulo python. Questo è un metodo molto differente da quello di FreeCAD, che utilizza solo alcuni componenti di OpenCascade, e che risulta una struttura molto più semplice.
</div>


<div class="mw-translate-fuzzy">
PythonOCC, on the other hand, since it provides you access to all of OCC classes and functions, is very complex, but also very powerful. It is therefore a very fine addition to FreeCAD. When you are limited by FreeCAD's available OCC functionality in your python scripts, it's time to load pythonOCC.
PythonOCC, d'altra parte, dato che fornisce l'accesso a tutte le classi e funzioni OCC, è molto complesso, ma è anche molto potente. È quindi una bella aggiunta a FreeCAD. Quando si è limitati dalle funzionalità OCC disponibili in FreeCAD per gli script python, è il momento di caricare pythonOCC.
</div>


== Usage ==
Currently in the Part module we have the methods: '''Part.__toPythonOCC__()''' and '''Part.__fromPythonOCC__()''' to exchange TopoDS_Shape entities to/from pythonOCC. This allows to use the full power of OCC in python (using pythonocc) and then put the resulting shapes back to FreeCAD.


<div class="mw-translate-fuzzy">
[[Category:Hubs]]
Attualmente nel modulo Parte abbiamo i metodi: '''Part.__toPythonOCC__()''' e '''Part.__fromPythonOCC__()''' per scambiare entità TopoDS_Shape da o per pythonOCC. Questo permette di utilizzare tutta la potenza di OCC in python (con pythonocc) e poi di mettere nuovamente le forme risultanti in FreeCAD.
[[Category:Poweruser_Documentation]]
</div>


PythonOCC is internally used by the [[Arch_IFC|IFC]] viewer included with the [[IfcOpenShell|IfcOpenShell]] libraries. IfcOpenShell is used to read and write [[Arch_IFC|IFC]] documents with FreeCAD. PythonOCC is only needed to launch IfcOpenShell's integrated viewer, otherwise it is not necessary.

== Installation ==

PythonOCC must be compiled from source. For this you need to get the corresponding development files for [[OpenCASCADE|OpenCASCADE Technology]] (OCCT) and SWIG. The older version of PythonOCC was intended to wrap around OCE 0.18, the community edition of OCCT 6.9.x, which is now unmaintained. The newest version of PythonOCC is now intended to work with the recent, official OCCT 7.4 version.

Together with OCCT 7.4, PythonOCC requires fairly recent dependencies like Python 3.7, CMake 3.12, and SWIG 3.0.11. Python 2 is no longer supported.

It is also possible to install pre-compiled PythonOCC libraries using [[Conda|Conda]]. For more information and compilation instructions, see the main project's repository, [https://github.com/tpaviot/pythonocc-core tpaviot/pythonocc-core].

== Compilation ==

You can also self compile pythonOCC (see [https://github.com/tpaviot/pythonocc-core/blob/master/INSTALL.md instructions]). Below is the procedure for Debian/Ubuntu using distro-provided opencascade packages:

<pre>
git clone git://github.com/tpaviot/pythonocc-core.git pythonocc
cd pythonocc
mkdir build
cd build
cmake -DOCE_INCLUDE_PATH=/usr/include/opencascade -DOCE_LIB_PATH=/usr/lib/x86_64-linux-gnu ..
make
</pre>

== More information ==

* Project page: [http://www.pythonocc.org/ pythonocc.org]
* Newer version compatible with OCCT 7.4, [https://github.com/tpaviot/pythonocc-core tpaviot/pythonocc-core].
* Older version compatible with OCE 0.18, the community edition of OCCT 6.9.x, [https://github.com/tpaviot/pythonocc tpaviot/pythonocc].
* [https://forum.freecadweb.org/viewtopic.php?f=39&t=33254 IfcPlusPlus compiled on Gentoo - questions and alternatives?]

{{Powerdocnavi{{#translation:}}}}
[[Category:Developer Documentation{{#translation:}}]]
[[Category:Python Code{{#translation:}}]]
{{clear}}
{{clear}}
<languages/>

Latest revision as of 19:01, 25 March 2021

Description

PythonOCC è un progetto abbastanza giovane e dinamico che mira a unire la gamma di funzioni di OpenCascade in un modulo python. Questo è un metodo molto differente da quello di FreeCAD, che utilizza solo alcuni componenti di OpenCascade, e che risulta una struttura molto più semplice.

PythonOCC, d'altra parte, dato che fornisce l'accesso a tutte le classi e funzioni OCC, è molto complesso, ma è anche molto potente. È quindi una bella aggiunta a FreeCAD. Quando si è limitati dalle funzionalità OCC disponibili in FreeCAD per gli script python, è il momento di caricare pythonOCC.

Usage

Attualmente nel modulo Parte abbiamo i metodi: Part.__toPythonOCC__() e Part.__fromPythonOCC__() per scambiare entità TopoDS_Shape da o per pythonOCC. Questo permette di utilizzare tutta la potenza di OCC in python (con pythonocc) e poi di mettere nuovamente le forme risultanti in FreeCAD.

PythonOCC is internally used by the IFC viewer included with the IfcOpenShell libraries. IfcOpenShell is used to read and write IFC documents with FreeCAD. PythonOCC is only needed to launch IfcOpenShell's integrated viewer, otherwise it is not necessary.

Installation

PythonOCC must be compiled from source. For this you need to get the corresponding development files for OpenCASCADE Technology (OCCT) and SWIG. The older version of PythonOCC was intended to wrap around OCE 0.18, the community edition of OCCT 6.9.x, which is now unmaintained. The newest version of PythonOCC is now intended to work with the recent, official OCCT 7.4 version.

Together with OCCT 7.4, PythonOCC requires fairly recent dependencies like Python 3.7, CMake 3.12, and SWIG 3.0.11. Python 2 is no longer supported.

It is also possible to install pre-compiled PythonOCC libraries using Conda. For more information and compilation instructions, see the main project's repository, tpaviot/pythonocc-core.

Compilation

You can also self compile pythonOCC (see instructions). Below is the procedure for Debian/Ubuntu using distro-provided opencascade packages:

git clone git://github.com/tpaviot/pythonocc-core.git pythonocc
cd pythonocc
mkdir build
cd build
cmake -DOCE_INCLUDE_PATH=/usr/include/opencascade -DOCE_LIB_PATH=/usr/lib/x86_64-linux-gnu ..
make

More information