PythonOCC: Difference between revisions
(→More information: Older version compatible with OCE 0.18, the community edition of OCCT 6.9.x) |
Renatorivo (talk | contribs) (Marked this version for translation) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
<translate> |
<translate> |
||
== Description == |
== Description == <!--T: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 |
[[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, |
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 == |
== Usage == <!--T:6--> |
||
<!--T:3--> |
<!--T:3--> |
||
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--> |
|||
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 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 == <!--T:10--> |
|||
⚫ | |||
<!--T:11--> |
|||
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. |
|||
<!--T:12--> |
|||
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. |
|||
<!--T:13--> |
|||
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]. |
|||
⚫ | |||
<!--T:9--> |
|||
* Project page: [http://www.pythonocc.org/ pythonocc.org] |
* Project page: [http://www.pythonocc.org/ pythonocc.org] |
||
* Newer version compatible with OCCT 7.4, [https://github.com/tpaviot/pythonocc-core tpaviot/pythonocc-core]. |
* Newer version compatible with OCCT 7.4, [https://github.com/tpaviot/pythonocc-core tpaviot/pythonocc-core]. |
Revision as of 19:10, 29 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.
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