Skip to content

Bindings for misc. occt functions - #16

Merged
torusJKL merged 28 commits into
mainfrom
misc-occt
May 26, 2026
Merged

Bindings for misc. occt functions#16
torusJKL merged 28 commits into
mainfrom
misc-occt

Conversation

@torusJKL

Copy link
Copy Markdown
Owner

Create bindings for the remaining OCCT functionality.

torusJKL added 28 commits May 25, 2026 21:15
Add C wrapper, CFFI bindings, CLOS wrappers, and tests for 6 new
OCCT Data Exchange formats:

  IGES  — write-iges / read-iges / write-iges-assembly / read-iges-assembly
  OBJ   — write-obj / read-obj with :coordinate-system, :name-format, :per-vertex-colors
  VRML  — write-vrml with :deflection
  glTF  — write-gltf / read-gltf with :coordinate-system, :per-vertex-colors
  PLY   — write-ply with :coordinate-system, :per-vertex-colors

Also adds RWMesh_CoordinateSystem / RWMesh_NameFormat utility enums.

Build changes:
  - Link TKDEIGES, TKDEVRML, TKDEPLY, TKDEOBJ, TKRWMesh (OCCT 8.0 naming)
  - Add USE_RAPIDJSON=ON, BUILD_MODULE_DEGLTF=ON for glTF support

Closes: mesh-io-bindings
… HLR, shape conversion

New extern C wrappers, CFFI bindings and CLOS wrappers for 7 OCCT
functions across 5 capability areas:

  BRepBuilderAPI_Sewing          → sew-shapes
  BRepAlgoAPI_Defeaturing        → defeature-shape
  BRepAlgoAPI_Check              → check-shape-validity
  BRepAlgoAPI_BuilderAlgo        → boolean-builder
  HLRBRep_Algo                   → hlr-project
  ShapeCustom_ConvertToRevolution     → convert-to-revolution
  ShapeCustom_SweptToElementary       → convert-swept-to-elementary

Includes 18 tests (all 412 core tests pass), api-reference.md
documentation, and OpenSpec change artifacts for the change lifecycle.
Add C wrappers, CFFI bindings, CLOS wrappers, tests, and docs for:
- AIS_ColoredShape — per-subshape color assignment
- AIS_Manipulator — interactive transform gizmo
- AIS_ConnectedInteractive — shared geometry reference
- AIS_MultipleConnectedInteractive — composite of connected objects
- AIS_PointCloud — point cloud display
- AIS_Triangulation — colored mesh display (Poly_Triangulation)
- AIS_Plane, AIS_Axis, AIS_Line, AIS_Circle — construction geometry overlays
- AIS_TexturedShape — shape with image texture
- AIS_ViewCube — 3D orientation cube widget
- AIS_ColorScale — color legend bar
- AIS_LightSource — interactive light icon
…, write-stl params

Expose OCCT mesh classes across the 3-layer architecture:

C wrapper (wrap/occt_wrap.h/cpp):
- mesh_shape: explicit BRepMesh_IncrementalMesh with deflection/angle/relative
- mesh_get_vertices/triangles/normals/triangle_count: Poly_Triangulation data extraction
- mesh_triangle_adjacent/elements: Poly_Connect adjacency queries
- meshvs_create_mesh/set_data/display/free: MeshVS mesh viewer display
- rwmesh_coordinate_system/name_format: enum wrappers
- write_stl: extended with angle and relative meshing parameters

Build: added -lTKMeshVS linker flag
…erials, clipping planes, editor

Add C wrapper functions in wrap/occt_wrap.h/.cpp for XCAFDoc_LayerTool,
XCAFDoc_MaterialTool, XCAFDoc_ViewTool, XCAFDoc_VisMaterialTool,
XCAFDoc_ClippingPlaneTool, and XCAFDoc_Editor (Expand).
…re2Dplane, TextureParams, PBRMaterial, BSDF

C wrapper (occt_wrap.h/cpp):
- Image_AlienPixMap load/save/query
- Graphic3d_Texture2D from file or Image_PixMap
- Graphic3d_Texture2Dplane with scale/origin/rotation
- Graphic3d_TextureParams with filter/repeat/aniso
- Graphic3d_PBRMaterial (albedo, metallic, roughness, emissive, IOR, transparency)
- Graphic3d_BSDF (Kd, Ks, Kt, Kc, Fresnel, absorption)
…nimationCamera, AIS_AnimationAxisRotation)

- C wrapper: 17 extern C functions in wrap/occt_wrap.{h,cpp}
- Core: CLOS hierarchy (ais-animation, ais-animation-object,
  ais-animation-camera, ais-animation-axis-rotation) with
  tg:finalize GC, predicates, setters/getters
- Fix sb-ext:quit :code → :unix-status in justfile
- C wrapper: StdSelect_EdgeFilter, FaceFilter, ShapeTypeFilter constructors,
  ais_context_add_filter/remove_filter, filter_set_edge_type/face_type,
  ais_context_selected_owner, brep_owner_shape, owner_priority, owner_location
- CFFI: %make-edge-filter, %make-face-filter, %make-shape-type-filter,
  %ais-context-add-filter, %ais-context-remove-filter, %ais-context-selected-owner,
  %filter-set-edge-type, %filter-set-face-type, %brep-owner-has-shape, etc.
- CLOS: entity-owner, brep-owner, selection-filter, edge-filter, face-filter,
  shape-type-filter classes with tg:finalize GC
- Public API: make-edge-filter, make-face-filter, make-shape-type-filter,
  ais-add-filter, ais-remove-filter, set-filter-edge-type, set-filter-face-type,
  ais-selected-owner, owner-priority, brep-owner-shape, owner-location,
  free-filter, free-owner, and type predicates
- 12 viewer tests for filters and entity owners
- api-reference.md updated with Selection Filters and Entity Owners sections
- 605 tests pass (473 core + 132 viewer)
…tructure, Group, RenderingParams

C wrapper (wrap/occt_wrap.cpp, occt_wrap.h):
- Graphic3d_ClipPlane: create/free, equation, on/off, capping
- Graphic3d_ShaderProgram: create/free, vertex/fragment source via ShaderObject, header
- Graphic3d_AspectFillArea3d/Line3d/Marker3d/Text3d: create/free, get/set color/type/width/scale/style
- Graphic3d_Structure: create/free, visibility, transform, connect/disconnect, display/erase
- Graphic3d_Group: create, add triangles/lines/points/text, set aspect
- Graphic3d_RenderingParams: method, raytracing depth, shadows, reflections, AA
…ools bindings

Add C wrappers, CFFI bindings, and CLOS wrappers for ~15 OCCT classes:

Prs3d Tools & Primitives:
- Prs3d_ToolCylinder/Sphere/Torus/Disk parametric mesh generators
- Prs3d_Arrow (DrawShaded) and Prs3d_BndBox (FillSegments)
- prs3d-triangulation and prs3d-segments CLOS classes with accessors

Math Optimization:
- math_BFGS, math_FRPR, math_PSO, math_GlobOptMin

IntTools Intersection:
- IntTools_EdgeEdge, IntTools_EdgeFace, IntTools_FaceFace
Break apart four large files that had grown unwieldy:

wrap/occt_wrap.cpp (9738 lines) → 27 domain .cpp + occt_wrap_internal.h
wrap/occt_wrap.h   (998 lines)  → 28 domain sub-headers + master include
t/smoke-tests.lisp (4307 lines) → 33 domain-specific test files
src/ffi/bindings.lisp (2389 lines) → 28 domain binding files

Summary of changes:
- Each .cpp file includes only its own sub-header for incremental builds
- Parallel Makefile (make -j) reduces clean build to ~4.5s
- Incremental builds take ~1.7s (single file + relink) vs 2s full rebuild
- Added missing graphic3d_group_set_visible stub (was declared but never implemented)

Build system: just wrap delegates to wrap/Makefile with -MMD dependency
tracking for correct incremental rebuilds on header changes.
… null-pointer crash

- Rename test to graphic-group-add-triangles-valid to avoid deftest
  shadowing the function being tested (invalid number of arguments).
- Pass cffi:null-pointer instead of nil for optional normals parameter
  to satisfy CFFI :pointer type requirement.
- Add free-graphic-group public API for explicit group resource cleanup.
- Fix cleanup condition to check &key normals instead of bound norms.
… (topology-ai-queries)

Topology graph navigation (face→edges, edge→vertices, vertex→edges,
edge→faces, face→wires, wire→edges, adjacency, shape type,
orientation) exposed via C wrapper + CFFI + CLOS wrappers.

Per-subshape properties (face area, edge length, face normal at center,
surface/curve type, bounding box, center point, extent along direction,
planar predicate) with C wrapper + CFFI + CLOS wrappers.

Infrastructure:
  - cl-occt.asd — flattened component structure, added cl-occt/packages
    bootstrap system for clean builds; wired up new files
…lyzer, make-connected, make-periodic

Implements six BOPAlgo operations — Splitter, MakerVolume, CellsBuilder,
ArgumentAnalyzer, MakeConnected, MakePeriodic — across all layers:

System integration:
  - wrap/Makefile: add -lTKBO
…local properties

New shape analysis capabilities:
- shape-proximity, shape-overlap-p, shape-overlap, shape-self-intersect-p
- face-distance (min/max between two faces)
- curve-tangent-at, curve-curvature-at
- surface-normal-at, surface-curvature-at
- face-normal-at, face-curvature-at
New public API:
- (fair-curve-batten points &key free-end free-slide initial-tangent final-tangent)
  → BSpline curve through 3D points using degree-3 interpolation
- (fair-curve-minvar points &key free-end free-slide initial-slope final-slope)
  → Variant minimizing curvature variation
- (fill-surface-from-curves curves &key continuity support-faces)
  → GeomPlate surface filling from 3+ boundary curves, G0/G1/G2
…ion)

Implement the OCAF (Open CASCADE Application Framework) foundation layer:

C wrapper (wrap/):
  - occt_wrap_ocaf_core: TDF_Data/TDocStd document lifecycle, label tree
    navigation (root, find, children, tag, depth), transaction management
    (begin/commit/undo), and TDataStd attributes (Integer, Real, String, Name)
  - occt_wrap_ocaf_naming: TNaming_Builder/NamedShape for topological naming
    with evolution code support (PRIMITIVE, GENERATED, DELETE, etc.)
  - occt_wrap_ocaf_naming: TFunction_Function/GraphNode/Driver/Iterator for
    parametric function definitions, dependency tracking, and recomputation

Core CLOS wrappers (src/core/):
  - ocaf-label-tree: ocaf-doc class, ocaf-label struct, label navigation,
    transaction API
  - ocaf-attributes: integer/real/string/name attribute set/get/has
  - ocaf-naming: shape naming with evolution keywords (:primitive :generated
    :modified :deleted :selected)
  - ocaf-functions: function creation, I/O dependencies, recompute API
…nces)

Add XCAFDimTolObjects-based GD&T annotation system with C wrapper,
CFFI bindings, core API, tests, and documentation.

- C wrapper (wrap/occt_wrap_xcaf_dimtol.[h|cpp]): 11 extern C functions
  for creating and querying dimensions, tolerances, datums,
  and geometric tolerances via XCAFDoc_DimTolTool
vertex point, edge curve+range, face surface+UV, tolerance, natural restriction, orientation, curve/surface evaluation, deep copy, precision constants
Add occlusion detection, shape location, edge finding by geometry,
normal projection, BREP native I/O, wedge primitive, drafted prism,
remove features, fix small faces, shape tolerance tools, RWStl I/O.
…sion interpreter, extended math solvers

Add four new OCCT utility capabilities with full C wrapper, CFFI bindings,
CLOS core wrappers, tests, and documentation:

- Constrained 2D Geometry (GccAna): circle-tangent-two-lines, line-through-two-points
- Units API (UnitsAPI): convert-units, convert-to-si, convert-from-si
- Expression Interpreter (ExprIntrp): evaluate-expression
- Extended Math Solvers: function-root (BissecNewton), newton-minimum (NewtonMinimum)
- Remove dead v3d_view_set_transparent_shading duplicate declarations
  from wrap/occt_wrap_visual.h (function was never implemented in C++)
- Fix xcaf_get_layer_count to use GetLayers() per-shape instead of
  GetLayerLabels() (was returning all document layers, not per-shape)
- Implement xcaf_get_layer_name C wrapper via XCAFDoc_LayerTool::GetLayers()
- Implement xcaf-get-shape-layers core function (was stubbed as not-yet-implemented)
@torusJKL
torusJKL merged commit 69f7f3d into main May 26, 2026
1 check failed
@torusJKL
torusJKL deleted the misc-occt branch May 26, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant