This repository contains two libraries, "OpenCascade-hs" and "Waterfall CAD".
A third party Haskell wrapper to Open CASCADE (wiki), which is the underlying framework behind FreeCAD.
Wrapping the Open Cascade API has been done on an incremental basis, and only a partially subset has been extracted, this largely consists of the modeling functionality (BRep/Boolean Ops/Curves/etc), and does not include the visualization components.
Waterfall CAD is a declarative CAD/Solid Modeling library.
This uses opencascade-hs as the kernel, but provides a "more functional" API over it.
OpenCASCADE-hs depends on Open Cascade version 7.8.x
. In order to run with an earlier version of Open Cascade, you'll need to use a version prior to 0.3.0.0
.
OpenCASCADE-hs is only tested on Debian and MacOS.
As this library depends on OpenCASCADE, I've been developing on Debian with the following packages installed:
> sudo apt-get install libocct-data-exchange-7.8 libocct-data-exchange-dev libocct-draw-7.8 libocct-draw-dev libocct-foundation-7.8 libocct-foundation-dev libocct-modeling-algorithms-7.8 libocct-modeling-algorithms-dev libocct-modeling-data-7.8 libocct-modeling-data-dev libocct-ocaf-7.8 libocct-ocaf-dev libocct-visualization-7.8 libocct-visualization-dev occt-misc
I think there should be some flexibility as to the exact version of libocct required, and which occt packages are necessary.
On MacOS, you should be able to install OpenCASCADE via homebrew:
brew install opencascade
You'll also need to configure the path to the OpenCASCADE header files, either via extra-include-dirs
, or CPATH
:
export CPATH=$CPATH:/usr/local/Cellar/opencascade/7.*/include/opencascade/
export CPATH=$CPATH:/opt/homebrew/Cellar/opencascade/7.*/include/opencascade/
You can add this to your stack.yaml file:
extra-include-dirs:
- /opt/homebrew/Cellar/opencascade/7.8.1_1/include/opencascade
extra-lib-dirs:
- /opt/homebrew/Cellar/opencascade/7.8.1_1/lib
Because OpenCASCADE is licensed under the LGPL version 2.1, I'm also using that library for this project.
If you're having any problems using either of these libraries, please feel free to open an issue.
If you've found the project useful, or interesting, or if you've built anything with it, I'd love to hear from you: there's a Waterfall-CAD Discord server.