Skip to content

Instantly share code, notes, and snippets.

@ochafik
Last active February 13, 2022 10:17
Show Gist options
  • Save ochafik/28bde2491d1f8cc0992a51c8e6f25716 to your computer and use it in GitHub Desktop.
Save ochafik/28bde2491d1f8cc0992a51c8e6f25716 to your computer and use it in GitHub Desktop.
Building OpenSCAD with remeshing to fix fast-csg's performance on very large models

fast-csg is still a work in progress.

For large models it works best with CGAL/cgal#5461 in CGAL and used in OpenSCAD by openscad/openscad#4107.

If you want a sneak peek of the new world, enable fast-csg-remesh in the following build:

( git clone https://github.com/sloriot/cgal \
    -b PMP-decimation --depth=1 \
    cgal-sloriot-PMP-decimation && \
  cd cgal-sloriot-PMP-decimation && \
  mkdir -p build && \
  cd build && \
  cmake .. -DCMAKE_INSTALL_PREFIX=$PWD && \
  make install )

( git clone https://github.com/ochafik/openscad\
    -b remesh-support --depth=1 \
    openscad-ochafik-remesh-support && \
  cd openscad-ochafik-remesh-support && \
  git submodule update --init && \
  mkdir -p build && \
  cd build && \
  cmake .. \
    -DCMAKE_BUILD_TYPE=Release \
    -DEXPERIMENTAL=1 \
    -DSORT_BUILD=1 \
    -DENABLE_CGAL_REMESHING=1 \
    -DCGAL_DIR=$PWD/../../cgal-sloriot-PMP-decimation/build && \
  make -j12 )
  
cd openscad-ochafik-remesh-support/build
# On Mac: 
#   alias openscad=$PWD/OpenSCAD.app/Contents/MacOS/OpenSCAD
alias openscad=$PWD/openscad

openscad \
  --enable=fast-csg \
  --enable=fast-csg-trust-corefinement \
  --enable=fast-csg-remesh \
  -o $PWD/out.stl \
  <some input file>

(if you haven't done so already, you'll need to install build dependencies as explained here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment