cadquery-ocp: Open CASCADE Technology Python Wrapper

7.9.3.1 · active · verified Sun Apr 12

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.

Warnings

Install

Imports

Quickstart

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.

from OCP.BRepPrimAPI import BRepPrimAPI_MakeBox
from OCP.gp import gp_Pnt

# Create a 10x20x30mm box starting at (0,0,0)
box_maker = BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 0), 10.0, 20.0, 30.0)
ocp_shape = box_maker.Shape()

# The ocp_shape object can then be used by other OCP functions
# or converted into a CadQuery object for higher-level operations.
# Example (requires CadQuery):
# import cadquery as cq
# cq_box = cq.Shape.cast(ocp_shape)
# print(cq_box.isValid())

print(f"Created OCP shape: {ocp_shape.__class__.__name__}")

view raw JSON →