PythonOCC: Difference between revisions

From FreeCAD Documentation
(Therefore, when you are limited by FreeCAD's OCCT functionality, using OCC is a good alternative.)
(PythonOCC is only needed to launch IfcOpenShell's integrated viewer, otherwise it is not necessary.)
Line 13: Line 13:


<!--T:3-->
<!--T:3-->
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.
The [[Part_Module|Part module]] has the methods {{incode|Part.__toPythonOCC__()}} and {{incode|Part.__fromPythonOCC__()}} to exchange {{incode|TopoDS_Shape}} ([[Part_TopoShape|Part TopoShape]]) entities to and from PythonOCC. These methods allow us to use the full power of OCCT in Python and then put the resulting shapes back into FreeCAD objects.


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


== More information == <!--T:8-->
== More information == <!--T:8-->

Revision as of 00:16, 25 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

The Part module has the methods Part.__toPythonOCC__() and Part.__fromPythonOCC__() to exchange TopoDS_Shape (Part TopoShape) entities to and from PythonOCC. These methods allow us to use the full power of OCCT in Python and then put the resulting shapes back into FreeCAD objects.

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.

More information