Current section
Files
Jump to
Current section
Files
README.md
# OCEx**Native Elixir geometry, powered by Open CASCADE Technology.**OCEx provides immutable, immediate geometry operations through a C++ NIF linked toOCCT 7.9.3. Create solids, build profiles, combine and finish bodies, inspect theirtopology, and exchange STEP, BREP, or STL. No Python runtime or runtime Hexdependencies are required.For deferred pipelines, workplanes, named assemblies, Livebook previews, andverified STL/3MF bundles, use [Smith](https://hexdocs.pm/smith). OCEx is the lowerlayer and can be used independently.## A first solidInstall the native prerequisites using the [installation guide](guides/installation.md),then save this as `plate.exs`:```elixirMix.install([{:ocex, "~> 0.1.0"}]){:ok, blank} = OCEx.box(60, 40, 5){:ok, bore} = OCEx.cylinder(4, 7){:ok, bore} = OCEx.translate(bore, {30, 20, -1}){:ok, plate} = OCEx.cut(blank, bore){:ok, true} = OCEx.valid?(plate){:ok, volume} = OCEx.volume(plate){:ok, :ok} = OCEx.write_step(plate, "plate.step"){:ok, :ok} = OCEx.write_stl(plate, "plate.stl", 0.03, 0.5)IO.puts("Plate volume: #{volume} mm³")```Run `elixir plate.exs`. For a Mix application, add `{:ocex, "~> 0.1.0"}` to itsdependencies. Mix builds the NIF automatically. The exact OCCT toolkit must remaininstalled at runtime because the NIF dynamically links its libraries.## What is included| Area | Operations || --- | --- || Solids | Box, cylinder, sphere, cone, ring torus || Profiles | Lines, circles, directed arcs, interpolated splines, wires, planar faces || Modeling | Extrusion, revolution, ruled/smooth loft, sweep, shelling, split, section, draft, sewing, offset, thickening, compound, union, subtraction, intersection || Finishing | Fillet, chamfer, same-domain cleanup || Placement | Translation, axis-angle rotation, planar mirror, uniform scale || Inspection | Topology, validity, bounds, volume, area, length, centroids, curve/surface information || Exchange | BREP snapshots, STEP import/export, binary STL export, indexed surface mesh |See the `OCEx` module for each function's contract and the[native geometry guide](guides/native-geometry.md) for units, orientation,profile requirements, selectors, meshing, and exchange behavior.## A small, explicit contractEvery public operation returns `{:ok, value}` or `{:error, reason}`. Shapes areopaque, garbage-collected native resources. Modeling operations preserve theirinputs; edge selections belong to one exact shape revision. Coordinates are`{x, y, z}` tuples, examples use millimeters, and modeling angles use degrees.Mesh angular deflection uses radians.OCEx covers the operations needed by Smith, not the full OCCT API. Calls run onBEAM dirty schedulers and are serialized for predictable native ownership.In-process native faults can crash the VM, and kernel operations cannot beforcibly cancelled by terminating an Elixir process. Read[errors and lifetimes](guides/errors-and-lifetimes.md) before integrating a service.## Documentation and development- [Installation and deployment](guides/installation.md)- [Geometry and exchange](guides/native-geometry.md)- [Errors, ownership, and execution](guides/errors-and-lifetimes.md)- [Changelog](CHANGELOG.md)- [Repository and test workflow](https://github.com/ntodd/ocex)The suite exercises the real kernel with analytic measurements, topology checks,file round trips, invalid inputs, resource lifetimes, and concurrency. The sourceinstaller pins and checksums OCCT; release checks build isolated consumers frompackage archives.OCEx is MIT licensed. Open CASCADE Technology has its own license and exception.The installer applies a documented allocator-alignment patch to OCCT 7.9.3 andkeeps kernel exception checks enabled. Full OCCT sources and binaries are notbundled in this package.## Working on OCExThis is a standalone repository. See [development](https://github.com/ntodd/ocex/blob/main/docs/development.md) forlocal checks and [releasing](https://github.com/ntodd/ocex/blob/main/docs/releasing.md) for this package's release steps.