OCP Gordon Surface Interpolation
raw JSON → 0.2.0 verified Sat May 09 auth: no python
A Python library for Gordon surface interpolation using B-splines, building on Open CASCADE Technology (OCCT) via OCP. Version 0.2.0 requires Python >=3.10,<3.15. Active development with frequent releases.
pip install ocp-gordon Common errors
error ModuleNotFoundError: No module named 'ocp_gordon' ↓
cause Library not installed or installed with different casing (e.g., ocp-gordon vs ocp_gordon).
fix
Run
pip install ocp-gordon and import as ocp_gordon. error AttributeError: 'GordonSurface' object has no attribute 'toTopoDS_Shape' ↓
cause Method renamed in v0.2.0 from 'toTopoDS_Shape' to 'to_shape'.
fix
Use
surf.to_shape() instead, or downgrade to v0.1.x with pip install ocp-gordon==0.1.18. Warnings
gotcha The `GordonSurface` constructor expects a list of 4 corner points in order: lower-left, lower-right, upper-left, upper-right. Incorrect ordering produces a twisted surface. ↓
fix Ensure points are ordered: [p00, p10, p01, p11] where u varies along rows, v along columns.
breaking In v0.2.0, the `to_shape()` method replaces the deprecated `toTopoDS_Shape()` from v0.1.x. Calling the old method raises AttributeError. ↓
fix Use `shape = surf.to_shape()` instead of `shape = surf.toTopoDS_Shape()`.
deprecated The function `make_gordon_surface` (with underscores) is deprecated in v0.2.0 in favor of `GordonSurface` class. It will be removed in v0.3.0. ↓
fix Use `GordonSurface(...)` constructor instead.
Imports
- GordonSurface
from ocp_gordon import GordonSurface - make_gordon_surface wrong
from ocp_gordon.surface import make_gordon_surfacecorrectfrom ocp_gordon import make_gordon_surface
Quickstart
from ocp_gordon import GordonSurface
from OCP.BRepPrimAPI import BRepPrimAPI_MakeBox
from OCP.gp import gp_Pnt
# Create a simple Gordon surface from four corner points
pts = [gp_Pnt(0,0,0), gp_Pnt(1,0,0.5), gp_Pnt(0,1,0.3), gp_Pnt(1,1,0.8)]
surf = GordonSurface(pts, degree_u=3, degree_v=3)
# Convert to shape for further processing
shape = surf.to_shape()
print('Gordon surface created')