Browse Source

merge fixes from 2.5.60 to 2.7

supermerill 4 months ago
parent
commit
5870c4d780

+ 249 - 201
BuildLinux.sh

@@ -1,225 +1,272 @@
 #!/bin/bash
+#
+# This script can download and compile dependencies, compile SuperSlicer
+# and optional build a .tgz and an appimage.
+#
+# Original script from SuperSlicer by supermerill https://github.com/supermerill/SuperSlicer
+#
+# Change log:
+#
+# 20 Nov 2023, wschadow, branding and minor changes
+# 01 Jan 2024, wschadow, added build options
+#
+
+set -e # exit on first error
 
 export ROOT=`pwd`
 export NCORES=`nproc`
-FOUND_GTK2=$(dpkg -l libgtk* | grep gtk2)
-FOUND_GTK3=$(dpkg -l libgtk* | grep gtk-3)
-
-unset name
-while getopts ":hwdrigbsyu" opt; do
-  case ${opt} in
-    u )
-        UPDATE_LIB="1"
-        ;;
-    i )
-        BUILD_IMAGE="1"
-        ;;
-    d )
-        BUILD_DEPS="1"
-        ;;
-    s )
-        BUILD_SLIC3R="1"
-        ;;
-    t)
-        BUILD_TESTS="1"
-        ;;
-    b )
-        BUILD_DEBUG="1"
-        ;;
-    g )
-        FOUND_GTK3=""
-        ;;
-    w )
-        BUILD_WIPE="1"
-        ;;
-    r )
-        BUILD_CLEANDEPEND="1"
-        ;;
-    h ) echo "Usage: ./BuildLinux.sh [-h][-w][-d][-r][-i][-g][-b][-s][-t][-u]"
-        echo "   -h: this message"
-        echo "   -w: wipe build directories before building"
-        echo "   -d: build deps (optional)"
-        echo "   -r: clean dependencies building files (reduce disk usage)"
-        echo "   -i: Generate appimage (optional)"
-        echo "   -g: force gtk2 build"
-        echo "   -b: build with debug symbols"
-        echo "   -s: build Slic3r/SuperSlicer"
-        echo "   -t: build tests (in combination with -s)"
-        echo "   -u: only update clock & dependency packets (optional and need sudo)"
-        echo "For a first use, you want to 'sudo ./BuildLinux.sh -u'"
-        echo "   and then './BuildLinux.sh -dsi'"
-        exit 0
-        ;;
-  esac
-done
 
-if [ $OPTIND -eq 1 ]
-then
-    echo "Usage: ./BuildLinux.sh [-h][-w][-d][-r][-i][-g][-b][-s][-t][-u]"
+function usage() {
+    echo "Usage: ./BuildLinux.sh [-h][-u][-w][-g][-b][-r][-d][-s][-l][-t][-i]"
     echo "   -h: this message"
+    echo "   -u: only update dependency packets (optional and need sudo)"
     echo "   -w: wipe build directories before building"
-    echo "   -d: build deps (optional)"
-    echo "   -r: clean dependencies building files (reduce disk usage)"
-    echo "   -i: Generate appimage (optional)"
     echo "   -g: force gtk2 build"
-    echo "   -b: build with debug symbols"
-    echo "   -s: build Slic3r/SuperSlicer"
+    echo "   -b: build in debug mode"
+    echo "   -r: clean dependencies"
+    echo "   -d: build deps"
+    echo "   -s: build Slic3r"
+    echo "   -l: update language .pot file"
     echo "   -t: build tests (in combination with -s)"
-    echo "   -u: only update clock & dependency packets (optional and need sudo)"
-    echo "For a first use, you want to 'sudo ./BuildLinux.sh -u'"
-    echo "   and then './BuildLinux.sh -dsi'"
+    echo "   -i: generate .tgz and appimage (optional)"
+    echo -e "\n   For a first use, you want to 'sudo ./BuildLinux.sh -u'"
+    echo -e "   and then './BuildLinux.sh -dsi'\n"
     exit 0
-fi
+}
 
-if [[ -n "$FOUND_GTK3" ]]
-then
-    echo "Found GTK3"
-else
-    if [[ -n "$FOUND_GTK2" ]]
-    then
-        echo "Found GTK2"
-    fi
-fi
+function check_operating_system() {
+# check operating system
 
-if [[ -n "$UPDATE_LIB" ]]
-then
-    echo -n -e "Updating linux ...\n"
-    hwclock -s
-    apt update
-	apt install g++ m4
-    if [[ -z "$FOUND_GTK3" ]]
-    then
-        echo -e "\nInstalling: libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev cmake git gettext fuse\n"
-        apt install libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev cmake git gettext fuse
+    OS_FOUND=$( command -v uname)
+
+    case   $( "${OS_FOUND}" | tr '[:upper:]' '[:lower:]') in
+    linux*)
+        TARGET_OS="linux"
+    ;;
+    msys*|cygwin*|mingw*)
+        # or possible 'bash on windows'
+        TARGET_OS='windows'
+    ;;
+    nt|win*)
+        TARGET_OS='windows'
+        ;;
+    darwin)
+        TARGET_OS='macos'
+        ;;
+    *)
+        TARGET_OS='unknown'
+        ;;
+    esac
+
+    echo
+    if [ $TARGET_OS == "linux" ]; then
+        if [ $(uname -m) == "x86_64" ]; then
+            echo -e "$(tput setaf 2)Linux 64-bit found$(tput sgr0)\n"
+            Processor="64"
+        elif [[ $(uname -m) == "i386" || $(uname -m) == "i686" ]]; then
+            echo "$(tput setaf 2)Linux 32-bit found$(tput sgr0)\n"
+            Processor="32"
+        else
+            echo "$(tput setaf 1)Unsupported OS: Linux $(uname -m)"
+            exit -1
+        fi
     else
-        echo -e "\nFind libgtk-3, installing: libgtk-3-dev libglew-dev libudev-dev libdbus-1-dev cmake git gettext fuse\n"
-        apt install libgtk-3-dev libglew-dev libudev-dev libdbus-1-dev cmake git gettext fuse
+        echo -e "$(tput setaf 1)This script doesn't support your Operating system!"
+        echo -e "Please use Linux 64-bit or Windows 10 64-bit with Linux subsystem / git-bash.$(tput sgr0)\n"
+        exit -1
+    fi
+}
+
+function check_available_memory_and_disk() {
+    FREE_MEM_GB=$(free -g -t | grep 'Mem:' | rev | cut -d" " -f1 | rev)
+    MIN_MEM_GB=5
+
+    FREE_DISK_KB=$(df -k . | tail -1 | awk '{print $4}')
+    MIN_DISK_KB=$((10 * 1024 * 1024))
+
+    if [ ${FREE_MEM_GB} -le ${MIN_MEM_GB} ]; then
+        echo -e "\nERROR: SuperSlicer Builder requires at least ${MIN_MEM_GB}G of 'available' mem (systen has only ${FREE_MEM_GB}G available)"
+        echo && free -h && echo
+        exit 2
     fi
-    # for ubuntu 22.04:
-    ubu_version="$(cat /etc/issue)" 
-    if [[ $ubu_version == "Ubuntu 22.04"* ]]
+
+    if [[ ${FREE_DISK_KB} -le ${MIN_DISK_KB} ]]; then
+        echo -e "\nERROR: SuperSlicer Builder requires at least $(echo ${MIN_DISK_KB} |awk '{ printf "%.1fG\n", $1/1024/1024; }') (systen has only $(echo ${FREE_DISK_KB} | awk '{ printf "%.1fG\n", $1/1024/1024; }') disk free)"
+        echo && df -h . && echo
+        exit 1
+    fi
+}
+
+function check_distribution() {
+    DISTRIBUTION=$(awk -F= '/^ID=/ {print $2}' /etc/os-release)
+    # treat ubuntu as debian
+    if [ "${DISTRIBUTION}" == "ubuntu" ]
     then
-        apt install curl libssl-dev libcurl4-openssl-dev m4
+        DISTRIBUTION="debian"
     fi
-    if [[ -n "$BUILD_DEBUG" ]]
+    echo -e "$(tput setaf 2)${DISTRIBUTION} found$(tput sgr0)\n"
+    if [ ! -f ./src/platform/unix/linux.d/${DISTRIBUTION} ]
     then
-        echo -e "\nInstalling: libssl-dev libcurl4-openssl-dev\n"
-        apt install libssl-dev libcurl4-openssl-dev
+        echo "Your distribution does not appear to be currently supported by these build scripts"
+        exit 1
     fi
-    echo -e "done\n"
-    exit 0
-fi
+}
 
-FOUND_GTK2_DEV=$(dpkg -l libgtk* | grep gtk2.0-dev)
-FOUND_GTK3_DEV=$(dpkg -l libgtk* | grep gtk-3-dev)
-echo "FOUND_GTK2=$FOUND_GTK2)"
-if [[ -z "$FOUND_GTK2_DEV" ]]
-then
-if [[ -z "$FOUND_GTK3_DEV" ]]
+#=======================================================================================
+
+check_operating_system
+check_distribution
+check_available_memory_and_disk
+
+#---------------------------------------------------------------------------------------
+#check command line arguments
+unset name
+while getopts ":hugbdrsltiw" opt; do
+    case ${opt} in
+        u )
+            UPDATE_LIB="1"
+            ;;
+        i )
+            BUILD_IMAGE="1"
+            ;;
+        d )
+            BUILD_DEPS="1"
+            ;;
+        s )
+            BUILD_SLIC3R="1"
+            ;;
+        l )
+            UPDATE_POTFILE="1"
+            ;;
+        t )
+            BUILD_TESTS="1"
+            ;;
+        b )
+            BUILD_DEBUG="1"
+            ;;
+        g )
+            FORCE_GTK2="-g"
+            ;;
+        r )
+            BUILD_CLEANDEPEND="1"
+            ;;
+        w )
+            BUILD_WIPE="1"
+            ;;
+        h ) usage
+#            exit 0
+            ;;
+        * ) usage
+#            exit 0
+            ;;
+    esac
+done
+
+
+if [ ${OPTIND} -eq 1 ]
 then
-    echo "Error, you must install the dependencies before."
-    echo "Use option -u with sudo"
+    usage
     exit 0
 fi
-fi
 
-echo "[1/9] Updating submodules..."
-{
-    # update submodule profiles
-    pushd resources/profiles
-    git submodule update --init
-    popd
-}
+#---------------------------------------------------------------------------------------
 
-echo "[2/9] Changing date in version..."
-{
-    # change date in version
-    sed -i "s/+UNKNOWN/_$(date '+%F')/" version.inc
-}
-echo "done"
+# check installation of required packages or update when -u is set
 
-# mkdir build
-if [ ! -d "build" ]
-then
-    mkdir build
-fi
+source ./src/platform/unix/linux.d/${DISTRIBUTION}
 
-# mkdir in deps
-if [ ! -d "deps/build" ]
+if [[ -n "$FORCE_GTK2" ]]
 then
-    mkdir deps/build
+    FOUND_GTK2=$(dpkg -l libgtk* | grep gtk2)
+    FOUND_GTK2_DEV=$(dpkg -l libgtk* | grep gtk2.0-dev)
+    echo -e "\nFOUND_GTK2:\n$FOUND_GTK2\n"
+else
+    FOUND_GTK3=$(dpkg -l libgtk* | grep gtk-3)
+    FOUND_GTK3_DEV=$(dpkg -l libgtk* | grep gtk-3-dev)
+    echo -e "\nFOUND_GTK3:\n$FOUND_GTK3)\n"
 fi
 
 if [[ -n "$BUILD_DEPS" ]]
 then
     if [[ -n $BUILD_WIPE ]]
     then
-       echo -e "\n wiping deps/build directory ...\n"
+       echo -e "\n wiping deps/build directory...\n"
        rm -fr deps/build
        echo -e " ... done\n"
     fi
-    # mkdir in deps
+    # mkdir build in deps
     if [ ! -d "deps/build" ]
     then
         mkdir deps/build
     fi
-    echo "[3/9] Configuring dependencies..."
+    echo -e "[1/9] Configuring dependencies ...\n"
     BUILD_ARGS=""
     if [[ -n "$FOUND_GTK3_DEV" ]]
     then
         BUILD_ARGS="-DDEP_WX_GTK3=ON"
+    else
+        BUILD_ARGS="-DDEP_WX_GTK3=OFF"
     fi
     if [[ -n "$BUILD_DEBUG" ]]
     then
         # have to build deps with debug & release or the cmake won't find evrything it needs
+    if [ ! -d "deps/build/release" ]
+    then
         mkdir deps/build/release
-        pushd deps/build/release
-            cmake ../.. -DDESTDIR="../destdir" $BUILD_ARGS
-            make -j$NCORES
-        popd
+    fi
+        pushd deps/build/release > /dev/null
+        cmake ../.. -DDESTDIR="../destdir" $BUILD_ARGS
+        popd > /dev/null
         BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug"
     fi
-    
-    # cmake deps
-    pushd deps/build
-        cmake .. $BUILD_ARGS
-        echo "done"
-        
-        # make deps
-        echo "[4/9] Building dependencies..."
-        make -j$NCORES
-        echo "done"
-        
-        # rename wxscintilla
-        echo "[5/9] Renaming wxscintilla library..."
-        pushd destdir/usr/local/lib
-            if [[ -z "$FOUND_GTK3_DEV" ]]
-            then
-                cp libwxscintilla-3.2.a libwx_gtk2u_scintilla-3.2.a
-            else
-                cp libwxscintilla-3.2.a libwx_gtk3u_scintilla-3.2.a
-            fi
-        popd
-        echo "done"
-        
-    popd
-    echo "done"
+
+    pushd deps/build > /dev/null
+    cmake .. $BUILD_ARGS
+    echo -e "\n ... done\n"
+
+    echo -e "\n[2/9] Building dependencies...\n"
+    # make deps
+    make -j$NCORES
+    echo -e "\n ... done\n"
+
+    # rename wxscintilla
+    echo "[3/9] Renaming wxscintilla library..."
+    pushd destdir/usr/local/lib  > /dev/null
+    if [[ -z "$FOUND_GTK3_DEV" ]]
+    then
+        cp libwxscintilla-3.1.a libwx_gtk2u_scintilla-3.1.a
+    else
+        cp libwxscintilla-3.1.a libwx_gtk3u_scintilla-3.1.a
+    fi
+    popd > /dev/null
+    popd > /dev/null
+    echo -e "\n ... done\n"
 fi
 
-# clean deps
 if [[ -n "$BUILD_CLEANDEPEND" ]]
 then
-    echo -e "[6/9] Cleaning dependencies...\n"
-    pushd deps/build
-    pwd
+    echo -e "[4/9] Cleaning dependencies...\n"
+    pushd deps/build > /dev/null
     rm -fr dep_*
     popd > /dev/null
-    echo -e "\n ... done\n"
+    echo -e " ... done\n"
 fi
 
 if [[ -n "$BUILD_SLIC3R" ]]
 then
-    echo "[7/9] Configuring Slic3r..."
+    echo -e "[5/9] Configuring SuperSlicer ...\n"
+    if [[ -n $BUILD_WIPE ]]
+    then
+       echo -e "\n wiping build directory ...\n"
+       rm -fr build
+       echo -e "\n ... done"
+    fi
+    # mkdir build
+    if [ ! -d "build" ]
+    then
+    mkdir build
+    fi
+
     BUILD_ARGS=""
     if [[ -n "$FOUND_GTK3_DEV" ]]
     then
@@ -229,47 +276,48 @@ then
     then
         BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug"
     fi
-    if [[ -n "$BUILD_TESTS" ]]
-    then
-        BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TESTS=1"
-    else
-        BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TESTS=0"
-    fi
-    
+
+   if [[ -n "$BUILD_TESTS" ]]
+   then
+       BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TESTS=1"
+   else
+       BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TESTS=0"
+   fi
+
     # cmake
-    pushd build
-        cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DSLIC3R_STATIC=1 ${BUILD_ARGS}
-        echo "done"
-        
-        #make avrdude-slic3r
-        make avrdude-slic3r
-        
-        # make Slic3r
-        echo "[8/9] Building Slic3r..."
-        make -j$NCORES Slic3r
-
-        # make .mo
-        make gettext_po_to_mo
-        
-        # make OCCTWrapper.so
-        make OCCTWrapper
-        
-        # update the pot
+    pushd build > /dev/null
+    cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DSLIC3R_STATIC=1 ${BUILD_ARGS}
+    echo " ... done"
+    # make SuperSlicer
+    echo -e "\n[6/9] Building SuperSlicer ...\n"
+    make -j$NCORES Slic3r
+    make -j$NCORES OCCTWrapper
+    echo -e "\n ... done"
+
+    echo -e "\n[7/9] Generating language files ...\n"
+    #make .mo
+    if [[ -n "$UPDATE_POTFILE" ]]
+    then
         make gettext_make_pot
-    popd
-    echo "done"
-fi
+    fi
+    make gettext_po_to_mo
 
-# Give proper permissions to script
-chmod 755 $ROOT/build/src/BuildLinuxImage.sh
+    popd  > /dev/null
+    echo -e "\n ... done"
 
-echo "[9/9] Generating Linux app..."
-    pushd build
-        if [[ -n "$BUILD_IMAGE" ]]
-        then
-            $ROOT/build/src/BuildLinuxImage.sh -i
-        else
-            $ROOT/build/src/BuildLinuxImage.sh
-        fi
-    popd
-echo "done"
+    # Give proper permissions to script
+    chmod 755 $ROOT/build/src/BuildLinuxImage.sh
+
+    pushd build  > /dev/null
+    $ROOT/build/src/BuildLinuxImage.sh -a $FORCE_GTK2
+    popd  > /dev/null
+fi
+
+if [[ -n "$BUILD_IMAGE" ]]
+then
+    # Give proper permissions to script
+    chmod 755 $ROOT/build/src/BuildLinuxImage.sh
+    pushd build  > /dev/null
+    $ROOT/build/src/BuildLinuxImage.sh -i $FORCE_GTK2
+    popd  > /dev/null
+fi

+ 69 - 18
BuildMacOS.sh

@@ -1,18 +1,68 @@
 #!/bin/bash
+#
+# This script can download and compile dependencies, compile SuperSlicer
+# and optional build a .tgz and an appimage.
+#
+# Original script from SuperSlicer by supermerill https://github.com/supermerill/SuperSlicer
+#
+# Change log:
+#
+# 20 Nov 2023, wschadow, branding and minor changes
+# 01 Jan 2024, wschadow, added build options
+#
 
 export ROOT=`pwd`
 export NCORES=`sysctl -n hw.ncpu`
-export CMAKE_INSTALLED=`which cmake`
-#export ARCH=$(uname -m)
+
+OS_FOUND=$( command -v uname)
+
+case $( "${OS_FOUND}" | tr '[:upper:]' '[:lower:]') in
+  linux*)
+    TARGET_OS="linux"
+   ;;
+  msys*|cygwin*|mingw*)
+    # or possible 'bash on windows'
+    TARGET_OS='windows'
+   ;;
+  nt|win*)
+    TARGET_OS='windows'
+    ;;
+  darwin)
+    TARGET_OS='macos'
+    ;;
+  *)
+    TARGET_OS='unknown'
+    ;;
+esac
+
+# check operating system
+echo
+if [ $TARGET_OS == "macos" ]; then
+    if [ $(uname -m) == "x86_64" ]; then
+        echo -e "$(tput setaf 2)macOS x86_64 found$(tput sgr0)\n"
+        Processor="64"
+    elif [[ $(uname -m) == "i386" || $(uname -m) == "i686" ]]; then
+        echo "$(tput setaf 2)macOS arm64 found$(tput sgr0)\n"
+        Processor="64"
+    else
+        echo "$(tput setaf 1)Unsupported OS: macOS $(uname -m)"
+        exit -1
+    fi
+else
+    echo -e "$(tput setaf 1)This script doesn't support your Operating system!"
+    echo -e "Please use a macOS.$(tput sgr0)\n"
+    exit -1
+fi
 
 # Check if CMake is installed
+export CMAKE_INSTALLED=`which cmake`
 if [[ -z "$CMAKE_INSTALLED" ]]
 then
     echo "Can't find CMake. Either is not installed or not in the PATH. Aborting!"
     exit -1
 fi
 
-while getopts ":idaxbhcstwr" opt; do
+while getopts ":idaxbhcsltwr" opt; do
   case ${opt} in
     i )
         BUILD_IMAGE="1"
@@ -37,6 +87,9 @@ while getopts ":idaxbhcstwr" opt; do
     t)
         BUILD_TESTS="1"
         ;;
+    l )
+        UPDATE_POTFILE="1"
+        ;;
     c)
         BUILD_XCODE="1"
         ;;
@@ -103,14 +156,8 @@ export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib/
 #    export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix libiconv)/lib/
 #fi
 
-echo -n "[1/9] Updating submodules..."
-{
-    # update submodule profiles
-    pushd resources/profiles
-    git submodule update --init
-    popd
-} #> $ROOT/build/Build.log # Capture all command output
-echo "done"
+export $BUILD_ARCH
+export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib/
 
 echo -n "[2/9] Changing date in version..."
 {
@@ -144,16 +191,16 @@ then
         BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug"
     fi
     # cmake deps
-    echo "Cmake command: cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=\"10.14\" ${BUILD_ARCH} "
+    echo "Cmake command: cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" ${BUILD_ARCH} "
     pushd deps/build > /dev/null
-    cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET="10.14" $BUILD_ARGS
+    cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" $BUILD_ARGS
 
     echo -e "\n ... done\n"
 
     echo -e "[4/9] Building dependencies ...\n"
 
     # make deps
-    make -j$NCORES
+    make -j1
 
     echo -e "\n ... done\n"
 
@@ -192,7 +239,7 @@ then
     # mkdir build
     if [ ! -d "build" ]
     then
-	mkdir build
+    mkdir build
     fi
 
     BUILD_ARGS=""
@@ -225,11 +272,16 @@ then
     if [[ -z "$BUILD_XCODE" ]]
     then
         echo -e "\n[6/9] Building Slicer ...\n"
-        make -j1
+        make -j$NCORES
         echo -e "\n ... done"
     fi
-   echo -e "\n[7/9] Generating language files ...\n"
+
+    echo -e "\n[7/9] Generating language files ...\n"
     #make .mo
+    if [[ -n "$UPDATE_POTFILE" ]]
+    then
+        make gettext_make_pot
+    fi
     make gettext_po_to_mo
 
     popd  > /dev/null
@@ -259,4 +311,3 @@ then
     popd  > /dev/null
 fi
 
-

+ 1 - 1
CMakeLists.txt

@@ -661,7 +661,7 @@ if(SLIC3R_BUILD_TESTS)
 endif()
 
 if (NOT WIN32 AND NOT APPLE)
-    configure_file(${LIBDIR}/platform/unix/build_appimage.sh.in ${CMAKE_CURRENT_BINARY_DIR}/build_appimage.sh @ONLY)
+    configure_file(${LIBDIR}/platform/unix/build_appimage.sh.in ${LIBDIR_BIN}/build_appimage.sh @ONLY)
 endif()
 
 # Resources install target, configure fhs.hpp on UNIX

+ 5 - 0
deps/CMakeLists.txt

@@ -26,6 +26,11 @@
 cmake_minimum_required(VERSION 3.12)
 project(Slic3r-deps)
 
+# timestamp of the extracted content from archive set to the extraction date. OLD to set to the timestamp from the archive.
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
+    cmake_policy(SET CMP0135 NEW)
+endif ()
+
 # Redefine BUILD_SHARED_LIBS with default being OFF
 option(BUILD_SHARED_LIBS "Build shared libraries instead of static (experimental)" OFF)
 

+ 20 - 3
resources/calibration/filament_pressure/filament_pressure.html

@@ -23,14 +23,31 @@
 </tbody>
 </table>
 
-<p><strong>this test is still in development, beta should work "ok" for now though.<br> your current print settings will need to be saved before clicking "generate" since it uses the saved values to create the model</strong></p>
-<p>note: this test will auto pull all your currently loaded config parameters and generate a model for you to print!<br> for to help with firmware speed/processing limitations it's reccomended to have most extrusion roles similar set to speeds.</p>
+<p><strong>this test is still in development, beta should work "ok" for now though.this page will be get updated along with it :)<br> your current print settings will need to be saved before clicking "generate" since it uses the saved values to create the model</strong></p>
+<p>note: this test will auto pull all your currently loaded config parameters and generate a model for you to print!<br> for to help with firmware speed/processing limitations it's reccomended to have most extrusion roles similar set to speeds.(but you don't have to!)</p>
 
 <h2>How to tune your printer for Pressure/Linear Advance</h2>
-<p>todo add detaisl here</p>
+<p>to get started</p>
+<ul>
+<li>select the number of tests to create, if you select more than 1 for now you will have to resize the window manually(click and drag the window from the bottom right)</li>
+<li>select the start/end/increment/ extrusion role values</li>
+<li>each row is the config for each base test model, eg; first row = externalPerimeter second row = firstLayer </li>
+<li>since each model will have it's own config one test model might be faster/slower than the others, this is expected and normal</li>
+<li>i will reccomend setting 'first_layer_speed' and 'first_layer_min_speed' to the same vales </li>
+
+</ul>
+
+<p>what is this "verify" option?<br>
+you may notice there is the "verify" option in the extrusion role dropdown, this feature currently doesn't work.(you can still use it, but any role that has gap fill will be incorrect and the test for that role should be ignored!) <br>
+when i get it working, it's purpose is to make it easy to see what extrusion roles need it's PA values tuned. 
+ it will create a model for each ER role, and assign that roles speed/acceleration/widths/spacing to the single model<br>
+you can then manually add the pressure advance command into the "per region g-code" box, slice and print it.
+</p>
+
 <h2>Advice</h2>
 <p>Before doing this test, it's preferable to tune everything else first!<br>i would reccomended setting XXXX to the same speeds, XXX to a slow speed, and everything else you can send it with.</p>
 <p>note: having large variance with ER speeds can reduce print quality/dimensional accuracy this is effect is mainly caused by the inner perimeter getting pulled closer to the external perimeter as it cools down, since each perimeter would be at different temperatues.</p>
+<p>i will reccomend setting 'first_layer_speed' and 'first_layer_min_speed' to the same vales </p>
 <p><strong>TODO add things about PA and setting first layer correctly<br>add notes about fan speed and disabling fan speed for this test, or do i have check box in GUI that would auto change relavent UI tab?</strong></p>
 <ul>
 <li>bullet points</li>

+ 1 - 0
src/libslic3r/BuildVolume.cpp

@@ -243,6 +243,7 @@ BuildVolume::ObjectState object_state_templ(const indexed_triangle_set &its, con
                             assert(sign(p1) == s[iprev]);
                             assert(sign(p2) == s[iedge]);
                             assert((p1.z() - world_min_z) * (p2.z() - world_min_z) < 0);
+                            assert(std::abs(p2.z() - p1.z()) > EPSILON);
                             // Edge crosses the z plane. Calculate intersection point with the plane.
                             const float t = (world_min_z - p1.z()) / (p2.z() - p1.z());
                             (is_inside(Vec3f(p1.x() + (p2.x() - p1.x()) * t, p1.y() + (p2.y() - p1.y()) * t, world_min_z)) ? inside : outside) = true;

+ 7 - 9
src/libslic3r/Config.cpp

@@ -358,26 +358,24 @@ size_t GraphData::data_size() const
 }
 
 double GraphData::interpolate(double x_value) const{
-    double y_value = 0.;
+    double y_value = 1.0f;
     if (this->data_size() < 1) {
         // nothing
-    } else if (this->graph_points.size() == 1 || this->graph_points.front().x() >= x_value) {
+    } else if (this->graph_points.size() == 1 || this->graph_points[begin_idx].x() >= x_value) {
         y_value = this->graph_points.front().y();
-    } else if (this->graph_points.back().x() <= x_value) {
+    } else if (this->graph_points[end_idx - 1].x() <= x_value) {
         y_value = this->graph_points.back().y();
     } else {
         // find first and second datapoint
         for (size_t idx = this->begin_idx; idx < this->end_idx; ++idx) {
             const auto &data_point = this->graph_points[idx];
-            if (data_point.x() == x_value) {
+            if (is_approx(data_point.x(), x_value)) {
                 // lucky point
-                y_value = data_point.y();
-                break;
+                return data_point.y();
             } else if (data_point.x() < x_value) {
                 // not yet, iterate
             } else if (idx == 0) {
-                y_value = data_point.y();
-                break;
+                return data_point.y();
             } else {
                 // interpolate
                 const auto &data_point_before = this->graph_points[idx - 1];
@@ -453,7 +451,7 @@ double GraphData::interpolate(double x_value) const{
                 } else {
                     assert(false);
                 }
-                break;
+                return y_value;
             }
         }
     }

+ 16 - 2
src/libslic3r/GCode.cpp

@@ -3945,7 +3945,7 @@ std::string GCodeGenerator::extrude_loop_vase(const ExtrusionLoop &original_loop
     //get extrusion length
     coordf_t length = 0;
     for (ExtrusionPaths::iterator path = paths.begin(); path != paths.end(); ++path) {
-        //path->simplify(SCALED_RESOLUTION); //not useful, this should have been done before.
+        path->simplify(std::max(coord_t(SCALED_EPSILON), scale_t(m_config.resolution.value)), false, 0); //not useful, this should have been done before.
         length += path->length() * SCALING_FACTOR;
     }
 
@@ -4676,7 +4676,21 @@ std::string GCodeGenerator::extrude_loop(const ExtrusionLoop &original_loop, con
         }
     }
     if (building_paths.empty()) return "";
-
+    
+    //simplify paths
+    for (size_t i=0 ; i< building_paths.size(); ++i){
+        ExtrusionPath &path = building_paths[i];
+        path.simplify(std::max(coord_t(SCALED_EPSILON), scale_t(m_config.resolution.value)), false, 0);
+        if (path.length() < std::max(coord_t(SCALED_EPSILON), scale_t(m_config.resolution.value))) {
+            if (i + 1 < building_paths.size()) {
+                building_paths[i+1].polyline.set_points().front() = path.polyline.front();
+                building_paths.erase(building_paths.begin() + i);
+                --i;
+            } else {
+                building_paths.pop_back();
+            }
+        }
+    }
     const ExtrusionPaths& wipe_paths = building_paths;
     for (const ExtrusionPath &path : wipe_paths)
         for (int i = 1; i < path.polyline.size(); ++i)

+ 1 - 1
src/libslic3r/GCode/GCodeProcessor.cpp

@@ -4818,7 +4818,7 @@ void GCodeProcessor::store_move_vertex(EMoveType type, bool internal_only)
         m_line_id + 1 :
         ((type == EMoveType::Seam) ? m_last_line_id : m_line_id);
     assert(type != EMoveType::Noop);
-
+//    std::cout<<"store_move_vertex @"<<m_time_processor.machines[0].time<<"\n";
     // push_back(GCodeProcessorResult::MoveVertex{})
     m_result.moves.emplace_back(
         m_last_line_id,

+ 2 - 1
src/libslic3r/GCode/SeamPlacer.cpp

@@ -1318,8 +1318,9 @@ std::optional<std::pair<size_t, size_t>> SeamPlacer::find_next_seam_in_layer(
         const SeamPlacerImpl::SeamComparator &comparator) const {
     using namespace SeamPlacerImpl;
     // empty layer (nothing to print)
-    if(layers[layer_idx].points.empty())
+    if(layers[layer_idx].points.empty() || layers[layer_idx].points_tree->empty()) {
         return {};
+    }
 
     std::vector<size_t> nearby_points_indices = find_nearby_points(*layers[layer_idx].points_tree, projected_position,
             max_distance);

Some files were not shown because too many files changed in this diff