The public API is what import pyocc exports (see src/pyocc/__init__.py). This
reference groups it by area. Signatures shown are the common entry points;
consult the docstrings in the source for full parameter lists.
Shape, Vertex, Edge, Wire, Face, Shell, Solid, Compound.
All concrete shapes subclass Shape and share these operations:
| Method | Description |
|---|---|
topods_shape() |
The underlying OpenCASCADE TopoDS_Shape |
translate(offset) |
New shape translated by a 3-vector |
scale(factor) |
New shape scaled (uniform float, or per-axis sequence) |
rotate_axis_angle(axis, angle, origin=(0,0,0)) |
New shape rotated about an axis |
transform(matrix) |
New shape under a 3x4 row-major transform |
valid() |
True if the geometry passes OCC's analyzer |
reversed() |
True if the shape orientation is reversed |
find_closest_point_data(datum) |
(point, middle, distance) — see below |
save_to_occ_native(filename) |
Write a binary .brep |
box() |
Axis-aligned bounding Box |
num_vertices() / num_edges() / num_faces() |
De-duplicated sub-shape counts |
vertices() / edges() / faces() / wires() |
De-duplicated iterators of sub-shapes |
find_closest_point_data(datum) returns a 3-tuple (point, middle, distance)
where middle is the curve parameter (Edge/Wire), the closest sub-Face
(Solid/Face/Shell), or None (Vertex).
Factory methods (all return a Solid):
Solid.make_box(dx, dy, dz, corner_point=None)
Solid.make_sphere(radius, center=None, ...)
Solid.make_cylinder(radius, height, center=None, axis=None, angle=None)
Solid.make_cone(radius1, radius2, height, ...)
Solid.make_torus(major_radius, minor_radius, ...)Boolean operations are static and take two solids:
Solid.union(solid1, solid2)
Solid.difference(solid1, solid2)
Solid.intersection(solid1, solid2)Mass properties: volume(), area(), center_of_mass().
Edge.make_line_from_points(start_point, end_point)
Edge.make_circle(center, radius, direction=(0, 0, 1))
Edge.make_arc_of_circle(pt1, pt2, pt3)Evaluation: point(u), tangent(u), length(), curve_type(), u_bounds()
(returns an Interval). A u in [0, 1] is treated as a normalized parameter;
values outside that range are treated as raw curve parameters (clamped to bounds).
point(uv), normal(uv) (accept a 2-element [u, v] array or separate u, v),
uv_bounds() (a 2D Box, unpackable as u_min, u_max, v_min, v_max), area().
Plane, Sketch, Constraint, ConstraintType — planes, 2D sketches, and the
constraint types used to solve them.
uvgrid(face, num_u=10, num_v=10, uvs=False, method="point") # 2D grid of points/normals
ugrid(edge, num_u=10, us=False, method="point") # 1D grid along a curve
uvgrid_points(face, ...) / uvgrid_normals(face, ...)
UniformGrid(face, u_count=10, v_count=10) # .get_points(), .get_parameters(), .get_normals()
sample_face_uniformly(face, num_u=10, num_v=10) # dict: points, normals, parameters
sample_edge_uniformly(edge, num_points=10) # dict: points, tangents, parameterssave_step(shapes, filename, schema="AP203") load_step(filename) -> Compound
save_iges(shapes, filename) load_iges(filename) -> Compound
save_stl(shape, filename, linear_deflection=0.1, ascii_mode=False) load_stl(filename) -> Shape
save_brep(shapes, filename) load_brep(filename) -> ShapeSave functions return True/False; load functions return the wrapped shape or
None on failure.
Viewer,create_viewer(),display_shape()— interactive desktop viewer.OffscreenRenderer— headless image rendering.JupyterViewer— WebGL widget for notebooks.DisplayShape,DisplayMaterial,DisplayVertex,DisplayEdge,DisplayFace— display-state dataclasses.batch.render_multiview:MultiViewRenderer,RenderSettings,ViewAngle,BatchProcessor,create_documentation_images,create_comparison_grid,render_animation_frames.
- Graphs (
graph):TopologyGraph,FaceAdjacencyGraph,VertexAdjacencyGraph, plus the functionsface_adjacency(shape)andvertex_adjacency(shape)that return NetworkX graphs directly. EntityMapper— stable indices for sub-shapes.EdgeDataExtractor— sampled geometric data along an edge.comparison:compute_shape_hash,shapes_equal,shape_similarity,ShapeFingerprint,ComparisonLevel.analysis.section:create_planar_section,analyze_section_properties,create_multiple_sections,find_section_at_point,section_along_curve,SectionResult,SectionType.
Interval— 1D interval with.a/.b,middle(),length(),interpolate(t),normalize(value).Box— axis-aligned box with.min/.max,center(),size(); iterable as interleaved per-axis bounds.ArcLengthParamFinder— arc-length reparameterization of curves.
A self-contained SQL-like query language: parse_query(text) -> Query, with the
full AST (SelectClause, WhereClause, JoinClause, aggregations, …) and helper
builders (literal, column, function, binary_op, …). Exported but not yet
wired into shape querying.
PyOCCContext holds tolerances, deflections, and the coordinate-system setting;
PyOCCContextManager scopes a context for a block of operations.