PythonOCC/cs: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 1: Line 1:
<languages/>
<languages/>
[[PythonOCC|PythonOCC]] is a project that aims at binding the whole range of OpenCASCADE Technology (OCCT) functions into a [[Python|Python]] module. This is a different approach than FreeCAD, where only certain components of OCCT are used, resulting in a much simpler structure. The project page is [http://www.pythonocc.org/ pythonocc.org].


== Description ==
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 OCCT functionality in your Python scripts, it's time to load {{incode|pythonOCC}}.


[[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.
Currently in the [[Part_Module|Part module]] we have the methods {{incode|Part.__toPythonOCC__()}} and {{incode|Part.__fromPythonOCC__()}} to exchange {{incode|TopoDS_Shape}} ([[Part_TopoShape|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, 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}}.

== Usage ==

Currently in the [[Part_Module|Part module]] we have the methods {{incode|Part.__toPythonOCC__()}} and {{incode|Part.__fromPythonOCC__()}} to exchange {{incode|TopoDS_Shape}} ([[Part_TopoShape|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 [[Arch_IFC|IFC]] viewer included with the [[IfcOpenShell|IfcOpenShell]] libraries. IfcOpenShell is used to read and write [[Arch_IFC|IFC]] documents with FreeCAD, through the [[Arch_Workbench|Arch]] and [[BIM_Workbench|BIM Workbenches]]. PythonOCC is only needed to launch IfcOpenShell's integrated viewer, otherwise, it is not used at all by FreeCAD.

== 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:}}}}
{{Powerdocnavi{{#translation:}}}}
[[Category:Developer Documentation{{#translation:}}]]
[[Category:Python Code{{#translation:}}]]
{{clear}}
{{clear}}

Revision as of 21:32, 23 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, resulting in a much simpler structure.

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

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