PythonOCC

From FreeCAD Documentation
Revision as of 19:10, 29 August 2020 by FuzzyBot (talk | contribs) (Updating to match new version of source page)

Description

PythonOCC es un proyecto joven y muy activo que pretende envolver todo el rango de las funciones de OpenCasCADe en un módulo de Python. Esta es una aproximción muy diferente a la de FreeCAD, donde sólo se utilizan ciertos componentes de OpenCasCade, resultando en una estructura mucho más simple.

PythonOCC, por otra parte, desde que proporciona acceso a todas las clases y funciones de OCC, es muy complejo, pero también potente. Es por tanto una magnifica adicción a FreeCAD. Cuando estés limitado por las limitadas funcionalidades disponibles de OCC en FreeCAD en tus archivos de guión de Python, es hora de cargar PythonOCC.

Usage

Actualmente en el módulo de Pieza tenemos los métodos: Part.__toPythonOCC__() y Part.__fromPythonOCC__() para intercambiar entidadese TopoDS_Shape a/hacia PythonOCC. Esto permite utilizar todo el poder de OCC en Python (utilizando pythonocc) y luego poner las formas resultantes de vuelta en 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