PythonOCC: Difference between revisions

From FreeCAD Documentation
(Marked this version for translation)
(Therefore, when you are limited by FreeCAD's OCCT functionality, using OCC is a good alternative.)
Line 5: Line 5:


<!--T:1-->
<!--T:1-->
[[PythonOCC|PythonOCC]] is a project that aims at providing the entire range of [[OpenCASCADE|OpenCASCADE Technology]] (OCCT) functions through the [[Python|Python]] module {{incode|OCC}}. This is a different approach from FreeCAD's, where only certain components of OCCT are exposed, resulting in a much simpler structure.
[[PythonOCC|PythonOCC]] is a project that aims at providing the entire range of [[OpenCASCADE|OpenCASCADE Technology]] (OCCT) functions through the [[Python|Python]] module {{incode|OCC}}. This is a different approach from FreeCAD's, where only certain components of OCCT are exposed through the [[Part_Module|Part Workbench]].


<!--T:2-->
<!--T:2-->
PythonOCC, on the other hand, since it provides you access to all of OCCT classes and functions, is very complex, but also very powerful. When you are limited by FreeCAD's available OCCT functionality in your Python scripts, it's time to load {{incode|OCC}}.
PythonOCC, on the other hand, provides access to all OCCT classes and functions so it is complex but also very powerful. Therefore, when you are limited by FreeCAD's OCCT functionality, using {{incode|OCC}} is a good alternative.


== Usage == <!--T:6-->
== Usage == <!--T:6-->

Revision as of 23:09, 24 August 2020

Description

PythonOCC is a project that aims at providing the entire range of OpenCASCADE Technology (OCCT) functions through the Python module OCC. This is a different approach from FreeCAD's, where only certain components of OCCT are exposed through the Part Workbench.

PythonOCC, on the other hand, provides access to all OCCT classes and functions so it is complex but also very powerful. Therefore, when you are limited by FreeCAD's OCCT functionality, using OCC is a good alternative.

Usage

Currently in the Part module we have the methods Part.__toPythonOCC__() and Part.__fromPythonOCC__() to exchange TopoDS_Shape (Part TopoShape) entities to and from PythonOCC. This allows us to use the full power of OCCT in Python and then put the resulting shapes back to 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, through the Arch and BIM Workbenches. PythonOCC is only needed to launch IfcOpenShell's integrated viewer, otherwise, it is not used at all by FreeCAD.

More information