PythonOCC
Description
PythonOCC ist ein Projekt, das darauf abzielt, den gesamten Funktionsumfang von OpenCasCADe in ein Python Modul zu integrieren. Dies ist ein anderer Ansatz als FreeCAD, bei dem nur bestimmte Komponenten von OpenCasCade verwendet werden, was zu einer wesentlich einfacheren Struktur führt.
PythonOCC hingegen ist sehr komplex, aber auch sehr leistungsfähig, da es Dir Zugriff auf alle OCC Klassen und -Funktionen bietet. Es ist daher eine sehr gute Ergänzung zu FreeCAD. Wenn Du durch die verfügbare OCC Funktionalität von FreeCAD in Deinen Python Skripten eingeschränkt bist, ist es an der Zeit, pythonOCC zu laden.
Usage
Derzeit haben wir im Part Arbeitsbereich die Methoden: Part.__toPythonOCC__() und Part.__fromPythonOCC__()', um TopoDS_Shape Entitäten zu/von PythonOCC auszutauschen. Dies ermöglicht es, die volle Leistung von OCC in Python (unter Verwendung von Pythonocc) zu nutzen und die resultierenden Shapes dann wieder in FreeCAD einzubinden.
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.
More information
- Project page: pythonocc.org
- Newer version compatible with OCCT 7.4, tpaviot/pythonocc-core.
- Older version compatible with OCE 0.18, the community edition of OCCT 6.9.x, tpaviot/pythonocc.
- IfcPlusPlus compiled on Gentoo - questions and alternatives?
- FreeCAD scripting: Python, Introduction to Python, Python scripting tutorial, FreeCAD Scripting Basics
- Modules: Builtin modules, Units, Quantity
- Workbenches: Workbench creation, Gui Commands, Commands, Installing more workbenches
- Meshes and Parts: Mesh Scripting, Topological data scripting, Mesh to Part, PythonOCC
- Parametric objects: Scripted objects, Viewproviders (Custom icon in tree view)
- Scenegraph: Coin (Inventor) scenegraph, Pivy
- Graphical interface: Interface creation, Interface creation completely in Python (1, 2, 3, 4, 5), PySide, PySide examples beginner, intermediate, advanced
- Macros: Macros, How to install macros
- Embedding: Embedding FreeCAD, Embedding FreeCADGui
- Other: Expressions, Code snippets, Line drawing function, FreeCAD vector math library (deprecated)
- Hubs: User hub, Power users hub, Developer hub