{"id":4463,"library":"cadquery-ocp","title":"cadquery-ocp: Open CASCADE Technology Python Wrapper","description":"cadquery-ocp provides a low-level Python wrapper for the Open CASCADE Technology (OCCT) 3D geometry kernel, offering thin bindings to almost all OCCT C++ libraries. It is a fundamental dependency for the CadQuery parametric CAD framework and is regularly updated to react quickly to new OCCT releases. The current version is 7.9.3.1.","status":"active","version":"7.9.3.1","language":"en","source_language":"en","source_url":"https://github.com/CadQuery/OCP","tags":["CAD","3D modeling","OCCT","Open CASCADE","geometry","wrapper","CadQuery"],"install":[{"cmd":"pip install cadquery-ocp","lang":"bash","label":"PyPI (pip)"},{"cmd":"conda install -c conda-forge -c cadquery ocp","lang":"bash","label":"Conda (recommended for CadQuery users)"}],"dependencies":[{"reason":"OCP is the underlying binding for the CadQuery library, which provides a more user-friendly 'fluent API' for parametric CAD. While OCP can be used independently, its primary use case is with CadQuery.","package":"CadQuery","optional":true},{"reason":"OCP is a direct Python binding for the C++ OCCT library; extensive knowledge of OCCT's C++ API is often required for direct OCP usage.","package":"Open CASCADE Technology (OCCT)","optional":false},{"reason":"Some `cadquery-ocp` wheels are built with VTK support, which may be implicitly included depending on the installation method and platform.","package":"VTK","optional":true}],"imports":[{"note":"General pattern: `from OCP.ThePackageName import TheClassName` for direct OCCT API bindings.","symbol":"BRepPrimAPI_MakeBox","correct":"from OCP.BRepPrimAPI import BRepPrimAPI_MakeBox"},{"note":"General pattern: `from OCP.ThePackageName import TheClassName` for direct OCCT API bindings.","symbol":"gp_Pnt","correct":"from OCP.gp import gp_Pnt"}],"quickstart":{"code":"from OCP.BRepPrimAPI import BRepPrimAPI_MakeBox\nfrom OCP.gp import gp_Pnt\n\n# Create a 10x20x30mm box starting at (0,0,0)\nbox_maker = BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 0), 10.0, 20.0, 30.0)\nocp_shape = box_maker.Shape()\n\n# The ocp_shape object can then be used by other OCP functions\n# or converted into a CadQuery object for higher-level operations.\n# Example (requires CadQuery):\n# import cadquery as cq\n# cq_box = cq.Shape.cast(ocp_shape)\n# print(cq_box.isValid())\n\nprint(f\"Created OCP shape: {ocp_shape.__class__.__name__}\")","lang":"python","description":"This quickstart demonstrates how to create a basic 3D shape (a box) directly using the low-level OCP bindings for the Open CASCADE Technology API. It imports specific classes like `BRepPrimAPI_MakeBox` and `gp_Pnt` from their respective OCP packages to construct the shape."},"warnings":[{"fix":"For most parametric CAD tasks, it is recommended to use the CadQuery library (which builds on OCP) for a more Pythonic and fluent API. Only drop down to OCP when direct OCCT access is essential.","message":"Direct usage of the OCP (OCCT C++ API) is significantly more verbose and complex than using higher-level libraries like CadQuery. It requires a strong understanding of the underlying Open CASCADE Technology C++ classes and concepts.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If `pip install cadquery-ocp` fails, try using `conda install -c conda-forge -c cadquery ocp`. Ensure your Python environment meets the required versions.","message":"Installation via `pip` can sometimes encounter issues due to complex binary dependencies, especially on less common system configurations or Python versions. `conda` is often recommended for a more robust installation experience, particularly when also installing CadQuery.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure you are using a compatible Python version, e.g., Python 3.10, 3.11, 3.12, or 3.13 for OCP 7.9.3.1. It is highly recommended to use a virtual environment.","message":"The `cadquery-ocp` library has specific Python version requirements (>=3.10, <3.15 for version 7.9.3.1). Installing with an incompatible Python version will lead to installation failures or runtime errors.","severity":"gotcha","affected_versions":"All versions of `cadquery-ocp` (check `requires_python` in PyPI)"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}