PythonOCC
Description
PythonOCC est un projet qui vise à fournir toute la gamme des fonctions OpenCASCADE Technology (OCCT) via le module Python OCC
. C'est une approche différente de celle de FreeCAD, où seuls certains composants d'OCCT sont exposés via l'atelier Part.
PythonOCC, d'autre part, donne accès à toutes les classes et fonctions OCCT, ce qui est complexe mais aussi très puissant. Par conséquent, lorsque vous êtes limité par la fonctionnalité OCCT de FreeCAD, l'utilisation de pythonOCC
est une bonne alternative.
Usage
Actuellement dans l'Atelier Part, nous avons les méthodes Part.__toPythonOCC__()
et Part.__fromPythonOCC__()
pour échanger TopoDS_Shape
(Part TopoShape) entités vers et depuis pythonOCC. Cela nous permet d'utiliser toute la puissance d'OCTT en Python puis de remettre les formes résultantes dans 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. 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?
- Scripts FreeCAD : Python, Introduction à Python, Tutoriel sur les scripts Python, Débuter avec les scripts
- Modules : Modules intégrés, Unités, Quantity
- Ateliers : Création d'atelier, Commands Gui, Les commandes, Installer des ateliers supplémentaires
- Maillages et objets Parts : Scripts Mesh, Script de données topologiques, Conversion objet Mesh en Part, PythonOCC
- Objets paramétriques : Objets créés par script, Viewproviders (Icône personnalisée dans l'arborescence)
- Scénographie : Graphe de scène Coin (Inventor), Pivy
- Interface graphique : Création d'interface, Création d'une boite de dialogue (1, 2, 3, 4, 5), PySide, Exemples PySide débutant, intermédiaire, expérimenté
- Macros : Macros, Comment installer des macros
- Intégration : Intégrer FreeCAD, Intégration de FreeCADGui
- Autre : Expressions, Extraits de codes, Fonction - tracer une ligne, Bibliothèque mathématique vectorielle de FreeCAD (déprécié)