diff --git a/.devcontainer/postCreate.sh b/.devcontainer/postCreate.sh index ea76f8e22c..b805c08b8b 100755 --- a/.devcontainer/postCreate.sh +++ b/.devcontainer/postCreate.sh @@ -3,12 +3,13 @@ apt update apt upgrade -y +build_linux="./build_linux.sh -u" echo "-----------------------------------------" -echo "Running BuildLinux.sh with update flag..." +echo "Running ${build_linux}..." echo "-----------------------------------------" -./BuildLinux.sh -u +${build_linux} echo "------------------------------" echo "Installing missing packages..." echo "------------------------------" -apt install -y libgl1-mesa-dev m4 autoconf libtool \ No newline at end of file +apt install -y libgl1-mesa-dev m4 autoconf libtool diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index c0990561e1..9b44b5639c 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -25,7 +25,7 @@ on: - '**/CMakeLists.txt' - 'version.inc' - ".github/workflows/build_*.yml" - - 'BuildLinux.sh' + - 'build_linux.sh' - 'build_release_vs2022.bat' - 'build_release_macos.sh' - 'flatpak/**' @@ -64,7 +64,7 @@ jobs: flatpak: name: "Flatpak" container: - image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-46 + image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-47 options: --privileged volumes: - /usr/local/lib/android:/usr/local/lib/android diff --git a/.github/workflows/build_deps.yml b/.github/workflows/build_deps.yml index b9dd05f647..4a29a133a1 100644 --- a/.github/workflows/build_deps.yml +++ b/.github/workflows/build_deps.yml @@ -97,7 +97,7 @@ jobs: libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules pkgconf \ libglu1-mesa-dev libcairo2-dev libgtk-3-dev libsoup2.4-dev libwebkit2gtk-${{ env.webkit-ver }}-dev \ libgstreamer1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-base1.0-dev \ - gstreamer1.0-plugins-bad libosmesa6-dev wget sudo autoconf curl libunwind-dev texinfo + gstreamer1.0-plugins-bad wget sudo autoconf curl libunwind-dev texinfo - name: Build on Ubuntu if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' @@ -105,9 +105,9 @@ jobs: run: | mkdir -p ${{ github.workspace }}/deps/build mkdir -p ${{ github.workspace }}/deps/build/destdir - sudo ./BuildLinux.sh -ur + sudo ./build_linux.sh -ur sudo chown $USER -R ./ - ./BuildLinux.sh -dr + ./build_linux.sh -dr cd deps/build tar -czvf OrcaSlicer_dep_ubuntu_$(date +"%Y%m%d").tar.gz destdir diff --git a/.github/workflows/build_orca.yml b/.github/workflows/build_orca.yml index 75e78e344a..1ae30f7b3b 100644 --- a/.github/workflows/build_orca.yml +++ b/.github/workflows/build_orca.yml @@ -243,13 +243,13 @@ jobs: ${{ env.apt-cmd }} install -y autoconf build-essential cmake curl eglexternalplatform-dev \ extra-cmake-modules file git libcairo2-dev libcurl4-openssl-dev libdbus-1-dev libglew-dev libglu1-mesa-dev \ libglu1-mesa-dev libgstreamer1.0-dev libgstreamerd-3-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev \ - libgtk-3-dev libgtk-3-dev libmspack-dev libosmesa6-dev libsecret-1-dev libsoup2.4-dev libssl-dev libudev-dev libwayland-dev \ + libgtk-3-dev libgtk-3-dev libmspack-dev libsecret-1-dev libsoup2.4-dev libssl-dev libudev-dev libwayland-dev \ libwebkit2gtk-${{ env.webkit-ver }}-dev libxkbcommon-dev locales locales-all m4 pkgconf sudo wayland-protocols wget ${{ env.libfuse2-pkg }} - - name: Install dependencies from BuildLinux.sh + - name: Install dependencies from build_linux.sh if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' shell: bash - run: sudo ./BuildLinux.sh -ur + run: sudo ./build_linux.sh -ur - name: Fix permissions if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' @@ -262,7 +262,7 @@ jobs: env: ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }} run: | - ./BuildLinux.sh -isr + ./build_linux.sh -isr mv -n ./build/OrcaSlicer_Linux_V${{ env.ver_pure }}.AppImage ./build/OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage chmod +x ./build/OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage diff --git a/BuildLinux.sh b/BuildLinux.sh deleted file mode 100755 index d0ff7348a0..0000000000 --- a/BuildLinux.sh +++ /dev/null @@ -1,207 +0,0 @@ -#!/bin/bash - -export ROOT=$(dirname $(readlink -f ${0})) - -set -e # exit on first error - -function check_available_memory_and_disk() { - FREE_MEM_GB=$(free -g -t | grep 'Mem' | rev | cut -d" " -f1 | rev) - MIN_MEM_GB=10 - - 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: Orca Slicer Builder requires at least ${MIN_MEM_GB}G of 'available' mem (system has only ${FREE_MEM_GB}G available)" - echo && free -h && echo - echo "Invoke with -r to skip ram and disk checks." - exit 2 - fi - - if [[ ${FREE_DISK_KB} -le ${MIN_DISK_KB} ]]; then - echo -e "\nERROR: Orca Slicer Builder requires at least $(echo ${MIN_DISK_KB} |awk '{ printf "%.1fG\n", $1/1024/1024; }') (system has only $(echo ${FREE_DISK_KB} | awk '{ printf "%.1fG\n", $1/1024/1024; }') disk free)" - echo && df -h . && echo - echo "Invoke with -r to skip ram and disk checks." - exit 1 - fi -} - -function usage() { - echo "Usage: ./BuildLinux.sh [-1][-b][-c][-d][-i][-r][-s][-u] [-j N]" - echo " -1: limit builds to 1 core (where possible)" - echo " -j N: limit builds to N cores (where possible)" - echo " -b: build in debug mode" - echo " -c: force a clean build" - echo " -d: build deps (optional)" - echo " -h: this help output" - echo " -i: Generate appimage (optional)" - echo " -r: skip ram and disk checks (low ram compiling)" - echo " -s: build orca-slicer (optional)" - echo " -u: update and build dependencies (optional and need sudo)" - echo "For a first use, you want to 'sudo ./BuildLinux.sh -u'" - echo " and then './BuildLinux.sh -dsi'" -} - -unset name -while getopts ":1j:bcdghirsu" opt; do - case ${opt} in - 1 ) - export CMAKE_BUILD_PARALLEL_LEVEL=1 - ;; - j ) - export CMAKE_BUILD_PARALLEL_LEVEL=$OPTARG - ;; - b ) - BUILD_DEBUG="1" - ;; - c ) - CLEAN_BUILD=1 - ;; - d ) - BUILD_DEPS="1" - ;; - h ) usage - exit 0 - ;; - i ) - BUILD_IMAGE="1" - ;; - r ) - SKIP_RAM_CHECK="1" - ;; - s ) - BUILD_ORCA="1" - ;; - u ) - UPDATE_LIB="1" - ;; - esac -done - -if [ ${OPTIND} -eq 1 ] -then - usage - exit 0 -fi - - -# cmake 4.x compatibility workaround -export CMAKE_POLICY_VERSION_MINIMUM=3.5 - -DISTRIBUTION=$(awk -F= '/^ID=/ {print $2}' /etc/os-release | tr -d '"') -DISTRIBUTION_LIKE=$(awk -F= '/^ID_LIKE=/ {print $2}' /etc/os-release | tr -d '"') -# Check for direct distribution match to Ubuntu/Debian -if [ "${DISTRIBUTION}" == "ubuntu" ] || [ "${DISTRIBUTION}" == "linuxmint" ]; then - DISTRIBUTION="debian" -# Check if distribution is Debian/Ubuntu-like based on ID_LIKE -elif [[ "${DISTRIBUTION_LIKE}" == *"debian"* ]] || [[ "${DISTRIBUTION_LIKE}" == *"ubuntu"* ]]; then - DISTRIBUTION="debian" -elif [[ "${DISTRIBUTION_LIKE}" == *"arch"* ]]; then - DISTRIBUTION="arch" -fi -if [ ! -f ./linux.d/${DISTRIBUTION} ] -then - echo "Your distribution does not appear to be currently supported by these build scripts" - exit 1 -fi -source ./linux.d/${DISTRIBUTION} - -echo "FOUND_GTK3=${FOUND_GTK3}" -if [[ -z "${FOUND_GTK3_DEV}" ]] -then - echo "Error, you must install the dependencies before." - echo "Use option -u with sudo" - exit 1 -fi - -echo "Changing date in version..." -{ - # change date in version - sed -i "s/+UNKNOWN/_$(date '+%F')/" version.inc -} -echo "done" - - -if ! [[ -n "${SKIP_RAM_CHECK}" ]] -then - check_available_memory_and_disk -fi - -if [[ -n "${BUILD_DEPS}" ]] -then - echo "Configuring dependencies..." - BUILD_ARGS="${DEPS_EXTRA_BUILD_ARGS} -DDEP_WX_GTK3=ON" - if [[ -n "${CLEAN_BUILD}" ]] - then - rm -fr deps/build - fi - if [ ! -d "deps/build" ] - then - mkdir deps/build - fi - if [[ -n "${BUILD_DEBUG}" ]] - then - # have to build deps with debug & release or the cmake won't find everything it needs - if [ ! -d "deps/build/release" ] - then - mkdir deps/build/release - fi - cmake -S deps -B deps/build/release -G Ninja -DDESTDIR="${PWD}/deps/build/destdir" -DDEP_DOWNLOAD_DIR="${PWD}/deps/DL_CACHE" ${BUILD_ARGS} - cmake --build deps/build/release - BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug" - fi - - echo "cmake -S deps -B deps/build -G Ninja ${BUILD_ARGS}" - cmake -S deps -B deps/build -G Ninja ${BUILD_ARGS} - cmake --build deps/build -fi - - -if [[ -n "${BUILD_ORCA}" ]] -then - echo "Configuring OrcaSlicer..." - if [[ -n "${CLEAN_BUILD}" ]] - then - rm -fr build - fi - BUILD_ARGS="${ORCA_EXTRA_BUILD_ARGS}" - if [[ -n "${FOUND_GTK3_DEV}" ]] - then - BUILD_ARGS="${BUILD_ARGS} -DSLIC3R_GTK=3" - fi - if [[ -n "${BUILD_DEBUG}" ]] - then - BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug -DBBL_INTERNAL_TESTING=1" - else - BUILD_ARGS="${BUILD_ARGS} -DBBL_RELEASE_TO_PUBLIC=1 -DBBL_INTERNAL_TESTING=0" - fi - echo -e "cmake -S . -B build -G Ninja -DCMAKE_PREFIX_PATH="${PWD}/deps/build/destdir/usr/local" -DSLIC3R_STATIC=1 -DORCA_TOOLS=ON ${BUILD_ARGS}" - cmake -S . -B build -G Ninja \ - -DCMAKE_PREFIX_PATH="${PWD}/deps/build/destdir/usr/local" \ - -DSLIC3R_STATIC=1 \ - -DORCA_TOOLS=ON \ - ${BUILD_ARGS} - echo "done" - echo "Building OrcaSlicer ..." - cmake --build build --target OrcaSlicer - echo "Building OrcaSlicer_profile_validator .." - cmake --build build --target OrcaSlicer_profile_validator - ./run_gettext.sh - echo "done" -fi - -if [[ -e ${ROOT}/build/src/BuildLinuxImage.sh ]]; then -# Give proper permissions to script -chmod 755 ${ROOT}/build/src/BuildLinuxImage.sh - -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" -fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ff06e0c25..5524e3a1e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,6 +108,15 @@ set(SLIC3R_GTK "2" CACHE STRING "GTK version to use with wxWidgets on Linux") set(IS_CROSS_COMPILE FALSE) +option (COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." OFF) +if (${COLORED_OUTPUT}) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + add_compile_options (-fdiagnostics-color=always) + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_compile_options (-fcolor-diagnostics) + endif () +endif () + if (APPLE) set(CMAKE_FIND_FRAMEWORK LAST) set(CMAKE_FIND_APPBUNDLE LAST) @@ -264,7 +273,7 @@ if(WIN32) if(WIN10SDK_INCLUDE_PATH) message("Building with Win10 Netfabb STL fixing service support") add_definitions(-DHAS_WIN10SDK) - include_directories("${WIN10SDK_INCLUDE_PATH}") + include_directories(SYSTEM "${WIN10SDK_INCLUDE_PATH}") else() message("Building without Win10 Netfabb STL fixing service support") endif() @@ -292,7 +301,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux") find_package(Threads REQUIRED) find_package(DBus REQUIRED) - include_directories(${DBUS_INCLUDE_DIRS}) + include_directories(SYSTEM ${DBUS_INCLUDE_DIRS}) endif() if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX) @@ -401,11 +410,11 @@ message(STATUS "LIBDIR: ${LIBDIR}") message(STATUS "LIBDIR_BIN: ${LIBDIR_BIN}") # For the bundled boost libraries (boost::nowide) -include_directories(${LIBDIR}) +include_directories(SYSTEM ${LIBDIR}) # For generated header files -include_directories(${LIBDIR_BIN}/platform) +include_directories(SYSTEM ${LIBDIR_BIN}/platform) # For ligigl -include_directories(${LIBDIR}/libigl) +include_directories(SYSTEM ${LIBDIR}/libigl) if(WIN32) add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) @@ -475,6 +484,9 @@ endif() # set(Boost_COMPILER "-mgw81") # boost::process was introduced first in version 1.64.0, # boost::beast::detail::base64 was introduced first in version 1.66.0 +if(POLICY CMP0167) + cmake_policy(SET CMP0167 NEW) +endif() find_package(Boost 1.83.0 REQUIRED COMPONENTS system filesystem thread log log_setup locale regex chrono atomic date_time iostreams program_options nowide) add_library(boost_libs INTERFACE) @@ -501,7 +513,7 @@ function(slic3r_remap_configs targets from_Cfg to_Cfg) endif() endfunction() -target_include_directories(boost_headeronly INTERFACE ${Boost_INCLUDE_DIRS}) +target_include_directories(boost_headeronly SYSTEM INTERFACE ${Boost_INCLUDE_DIRS}) target_link_libraries(boost_libs INTERFACE boost_headeronly ${Boost_LIBRARIES}) # Find and configure intel-tbb @@ -511,7 +523,7 @@ endif() set(TBB_DEBUG 1) set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO RelWithDebInfo Release "") find_package(TBB REQUIRED) -# include_directories(${TBB_INCLUDE_DIRS}) +# include_directories(SYSTEM ${TBB_INCLUDE_DIRS}) # add_definitions(${TBB_DEFINITIONS}) # if(MSVC) # # Suppress implicit linking of the TBB libraries by the Visual Studio compiler. @@ -553,7 +565,7 @@ if (SLIC3R_STATIC AND NOT SLIC3R_STATIC_EXCLUDE_CURL) find_package(OpenSSL REQUIRED) message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}") message("OpenSSL libraries: ${OPENSSL_LIBRARIES}") - target_include_directories(libcurl INTERFACE ${OPENSSL_INCLUDE_DIR}) + target_include_directories(libcurl SYSTEM INTERFACE ${OPENSSL_INCLUDE_DIR}) target_link_libraries(libcurl INTERFACE ${OPENSSL_LIBRARIES}) endif() endif() @@ -806,7 +818,7 @@ endif() if (NOT WIN32 AND NOT APPLE) set(SLIC3R_APP_CMD "orca-slicer") - 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 ${CMAKE_CURRENT_BINARY_DIR}/build_appimage.sh USE_SOURCE_PERMISSIONS @ONLY) endif() option(BUILD_BBS_TEST_TOOLS "Build bbs test tools" OFF) diff --git a/Dockerfile b/Dockerfile index f244d20acb..0cc12ac2aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,6 @@ RUN apt-get update && apt-get install -y \ libgstreamer-plugins-good1.0-dev \ libgtk-3-dev \ libgtk-3-dev \ - libosmesa6-dev \ libsecret-1-dev \ libsoup2.4-dev \ libssl3 \ @@ -65,17 +64,17 @@ WORKDIR OrcaSlicer # These can run together, but we run them seperate for podman caching # Update System dependencies -RUN ./BuildLinux.sh -u +RUN ./build_linux.sh -u # Build dependencies in ./deps -RUN ./BuildLinux.sh -dr +RUN ./build_linux.sh -dr # Build slic3r -RUN ./BuildLinux.sh -sr +RUN ./build_linux.sh -sr # Build AppImage ENV container podman -RUN ./BuildLinux.sh -ir +RUN ./build_linux.sh -ir # It's easier to run Orca Slicer as the same username, # UID and GID as your workstation. Since we bind mount diff --git a/README.md b/README.md index 3802af7a9e..eff7c96317 100644 --- a/README.md +++ b/README.md @@ -183,4 +183,3 @@ The GNU Affero General Public License, version 3 ensures that if you use any par Orca Slicer includes a pressure advance calibration pattern test adapted from Andrew Ellis' generator, which is licensed under GNU General Public License, version 3. Ellis' generator is itself adapted from a generator developed by Sineos for Marlin, which is licensed under GNU General Public License, version 3. The Bambu networking plugin is based on non-free libraries from BambuLab. It is optional to the Orca Slicer and provides extended functionalities for Bambulab printer users. - diff --git a/build_linux.sh b/build_linux.sh new file mode 100755 index 0000000000..eb3c1bc920 --- /dev/null +++ b/build_linux.sh @@ -0,0 +1,217 @@ +#!/usr/bin/env bash + +SCRIPT_NAME=$(basename "$0") +SCRIPT_PATH=$(dirname $(readlink -f ${0})) + +pushd ${SCRIPT_PATH} > /dev/null + +set -e # Exit immediately if a command exits with a non-zero status. + +function check_available_memory_and_disk() { + FREE_MEM_GB=$(free --gibi --total | grep 'Mem' | rev | cut --delimiter=" " --fields=1 | rev) + MIN_MEM_GB=10 + + FREE_DISK_KB=$(df --block-size=1K . | tail -1 | awk '{print $4}') + MIN_DISK_KB=$((10 * 1024 * 1024)) + + if [[ ${FREE_MEM_GB} -le ${MIN_MEM_GB} ]] ; then + echo -e "\nERROR: Orca Slicer Builder requires at least ${MIN_MEM_GB}G of 'available' mem (system has only ${FREE_MEM_GB}G available)" + echo && free --human && echo + echo "Invoke with -r to skip RAM and disk checks." + exit 2 + fi + + if [[ ${FREE_DISK_KB} -le ${MIN_DISK_KB} ]] ; then + echo -e "\nERROR: Orca Slicer Builder requires at least $(echo ${MIN_DISK_KB} |awk '{ printf "%.1fG\n", $1/1024/1024; }') (system has only $(echo ${FREE_DISK_KB} | awk '{ printf "%.1fG\n", $1/1024/1024; }') disk free)" + echo && df --human-readable . && echo + echo "Invoke with -r to skip ram and disk checks." + exit 1 + fi +} + +function usage() { + echo "Usage: ./${SCRIPT_NAME} [-1][-b][-c][-d][-h][-i][-j N][-p][-r][-s][-u]" + echo " -1: limit builds to one core (where possible)" + echo " -j N: limit builds to N cores (where possible)" + echo " -b: build in debug mode" + echo " -c: force a clean build" + echo " -C: enable ANSI-colored compile output (GNU/Clang only)" + echo " -d: download and build dependencies in ./deps/ (build prerequisite)" + echo " -h: prints this help text" + echo " -i: build the Orca Slicer AppImage (optional)" + echo " -p: boost ccache hit rate by disabling precompiled headers (default: ON)" + echo " -r: skip RAM and disk checks (low RAM compiling)" + echo " -s: build the Orca Slicer (optional)" + echo " -u: install system dependencies (asks for sudo password; build prerequisite)" + echo "For a first use, you want to './${SCRIPT_NAME} -u'" + echo " and then './${SCRIPT_NAME} -dsi'" +} + +SLIC3R_PRECOMPILED_HEADERS="ON" + +unset name +while getopts ":1j:bcCdhiprsu" opt ; do + case ${opt} in + 1 ) + export CMAKE_BUILD_PARALLEL_LEVEL=1 + ;; + j ) + export CMAKE_BUILD_PARALLEL_LEVEL=$OPTARG + ;; + b ) + BUILD_DEBUG="1" + ;; + c ) + CLEAN_BUILD=1 + ;; + C ) + COLORED_OUTPUT="-DCOLORED_OUTPUT=ON" + ;; + d ) + BUILD_DEPS="1" + ;; + h ) usage + exit 0 + ;; + i ) + BUILD_IMAGE="1" + ;; + p ) + SLIC3R_PRECOMPILED_HEADERS="OFF" + ;; + r ) + SKIP_RAM_CHECK="1" + ;; + s ) + BUILD_ORCA="1" + ;; + u ) + UPDATE_LIB="1" + ;; + esac +done + +if [ ${OPTIND} -eq 1 ] ; then + usage + exit 0 +fi + +# cmake 4.x compatibility workaround +export CMAKE_POLICY_VERSION_MINIMUM=3.5 + +DISTRIBUTION=$(awk -F= '/^ID=/ {print $2}' /etc/os-release | tr -d '"') +DISTRIBUTION_LIKE=$(awk -F= '/^ID_LIKE=/ {print $2}' /etc/os-release | tr -d '"') +# Check for direct distribution match to Ubuntu/Debian +if [ "${DISTRIBUTION}" == "ubuntu" ] || [ "${DISTRIBUTION}" == "linuxmint" ] ; then + DISTRIBUTION="debian" +# Check if distribution is Debian/Ubuntu-like based on ID_LIKE +elif [[ "${DISTRIBUTION_LIKE}" == *"debian"* ]] || [[ "${DISTRIBUTION_LIKE}" == *"ubuntu"* ]] ; then + DISTRIBUTION="debian" +elif [[ "${DISTRIBUTION_LIKE}" == *"arch"* ]] ; then + DISTRIBUTION="arch" +fi + +if [ ! -f ./linux.d/${DISTRIBUTION} ] ; then + echo "Your distribution \"${DISTRIBUTION}\" is not supported by system-dependency scripts in ./linux.d/" + echo "Please resolve dependencies manually and contribute a script for your distribution to upstream." + exit 1 +else + echo "resolving system dependencies for distribution \"${DISTRIBUTION}\" ..." + source ./linux.d/${DISTRIBUTION} +fi + +echo "FOUND_GTK3=${FOUND_GTK3}" +if [[ -z "${FOUND_GTK3_DEV}" ]] ; then + echo "Error, you must install the dependencies before." + echo "Use option -u with sudo" + exit 1 +fi + +echo "Changing date in version..." +{ + # change date in version + sed --in-place "s/+UNKNOWN/_$(date '+%F')/" version.inc +} +echo "done" + + +if ! [[ -n "${SKIP_RAM_CHECK}" ]] ; then + check_available_memory_and_disk +fi + +if [[ -n "${BUILD_DEPS}" ]] ; then + echo "Configuring dependencies..." + BUILD_ARGS="${DEPS_EXTRA_BUILD_ARGS} -DDEP_WX_GTK3=ON" + if [[ -n "${CLEAN_BUILD}" ]] + then + rm -fr deps/build + fi + if [ ! -d "deps/build" ] + then + mkdir deps/build + fi + if [[ -n "${BUILD_DEBUG}" ]] ; then + # build deps with debug and release else cmake will not find required sources + if [ ! -d "deps/build/release" ] ; then + mkdir deps/build/release + fi + cmake -S deps -B deps/build/release -DSLIC3R_PCH=${SLIC3R_PRECOMPILED_HEADERS} -G Ninja -DDESTDIR="${SCRIPT_PATH}/deps/build/destdir" -DDEP_DOWNLOAD_DIR="${SCRIPT_PATH}/deps/DL_CACHE" ${COLORED_OUTPUT} ${BUILD_ARGS} + cmake --build deps/build/release + BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug" + fi + + echo "cmake -S deps -B deps/build -G Ninja ${BUILD_ARGS}" + cmake -S deps -B deps/build -G Ninja ${COLORED_OUTPUT} ${BUILD_ARGS} + cmake --build deps/build +fi + +if [[ -n "${BUILD_ORCA}" ]] ; then + echo "Configuring OrcaSlicer..." + if [[ -n "${CLEAN_BUILD}" ]] ; then + rm --force --recursive build + fi + BUILD_ARGS="${ORCA_EXTRA_BUILD_ARGS}" + if [[ -n "${FOUND_GTK3_DEV}" ]] ; then + BUILD_ARGS="${BUILD_ARGS} -DSLIC3R_GTK=3" + fi + if [[ -n "${BUILD_DEBUG}" ]] ; then + BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug -DBBL_INTERNAL_TESTING=1" + else + BUILD_ARGS="${BUILD_ARGS} -DBBL_RELEASE_TO_PUBLIC=1 -DBBL_INTERNAL_TESTING=0" + fi + + CMAKE_CMD="cmake -S . -B build -G Ninja \ +-DSLIC3R_PCH=${SLIC3R_PRECOMPILED_HEADERS} \ +-DCMAKE_PREFIX_PATH="${SCRIPT_PATH}/deps/build/destdir/usr/local" \ +-DSLIC3R_STATIC=1 \ +-DORCA_TOOLS=ON \ +${COLORED_OUTPUT} \ +${BUILD_ARGS}" + echo -e "${CMAKE_CMD}" + ${CMAKE_CMD} + echo "done" + echo "Building OrcaSlicer ..." + cmake --build build --target OrcaSlicer + echo "Building OrcaSlicer_profile_validator .." + cmake --build build --target OrcaSlicer_profile_validator + ./run_gettext.sh + echo "done" +fi + +if [[ -n "${BUILD_IMAGE}" || -n "${BUILD_ORCA}" ]] ; then + pushd build > /dev/null + echo "[9/9] Generating Linux app..." + build_linux_image="./src/build_linux_image.sh" + if [[ -e ${build_linux_image} ]] ; then + extra_script_args="" + if [[ -n "${BUILD_IMAGE}" ]] ; then + extra_script_args="-i" + fi + ${build_linux_image} ${extra_script_args} + + echo "done" + fi + popd > /dev/null # build +fi + +popd > /dev/null # ${SCRIPT_PATH} diff --git a/deps/GLEW/glew/README.md b/deps/GLEW/glew/README.md index bfec3064de..475c69afc8 100644 --- a/deps/GLEW/glew/README.md +++ b/deps/GLEW/glew/README.md @@ -22,7 +22,6 @@ https://github.com/nigels-com/glew * [Install build tools](#install-build-tools) * [Build](#build-1) * [Linux EGL](#linux-egl) - * [Linux OSMesa](#linux-osmesa) * [Linux mingw-w64](#linux-mingw-w64) * [Using cmake](#using-cmake) * [Install build tools](#install-build-tools-1) @@ -95,11 +94,6 @@ _Note: you may need to call `make` in the **auto** folder first_ $ sudo apt install libegl1-mesa-dev $ make SYSTEM=linux-egl -##### Linux OSMesa - - $ sudo apt install libosmesa-dev - $ make SYSTEM=linux-osmesa - ##### Linux mingw-w64 $ sudo apt install mingw-w64 @@ -140,7 +134,6 @@ RedHat/CentOS/Fedora: `$ sudo yum install libXmu-devel libXi-devel libGL-devel c | --------------- | ----------- | | BUILD_UTILS | Build the `glewinfo` and `visualinfo` executables. | | GLEW_REGAL | Build in Regal mode. | -| GLEW_OSMESA | Build in off-screen Mesa mode. | | BUILD_FRAMEWORK | Build as MacOSX Framework. Setting `CMAKE_INSTALL_PREFIX` to `/Library/Frameworks` is recommended. | ### Windows diff --git a/deps/OCCT/0001-OCCT-fix.patch b/deps/OCCT/0001-OCCT-fix.patch index d0de170d5a..27f5db7e0f 100644 --- a/deps/OCCT/0001-OCCT-fix.patch +++ b/deps/OCCT/0001-OCCT-fix.patch @@ -195,3 +195,27 @@ index 5ae9899f..0a17372b 100644 if (!myFTLib->IsValid()) { +From 7236e83dcc1e7284e66dc61e612154617ef715d6 Mon Sep 17 00:00:00 2001 +From: dpasukhi +Date: Tue, 27 Aug 2024 11:33:29 +0100 +Subject: [PATCH] 0033808: Coding - FreeType Use unsigned point and contour + indexing in `FT_Outline` + +Changes to auto instead of specific type +--- + src/StdPrs/StdPrs_BRepFont.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/StdPrs/StdPrs_BRepFont.cxx b/src/StdPrs/StdPrs_BRepFont.cxx +index ab2d9b3c9f..cd701879b1 100644 +--- a/src/StdPrs/StdPrs_BRepFont.cxx ++++ b/src/StdPrs/StdPrs_BRepFont.cxx +@@ -457,7 +457,7 @@ Standard_Boolean StdPrs_BRepFont::renderGlyph (const Standard_Utf32Char theChar, + for (short aContour = 0, aStartIndex = 0; aContour < anOutline->n_contours; ++aContour) + { + const FT_Vector* aPntList = &anOutline->points[aStartIndex]; +- const char* aTags = &anOutline->tags[aStartIndex]; ++ const auto* aTags = &anOutline->tags[aStartIndex]; + const short anEndIndex = anOutline->contours[aContour]; + const short aPntsNb = (anEndIndex - aStartIndex) + 1; + aStartIndex = anEndIndex + 1; diff --git a/doc/How-to-build.md b/doc/How-to-build.md index 49553c039e..2377656e08 100644 --- a/doc/How-to-build.md +++ b/doc/How-to-build.md @@ -172,7 +172,6 @@ All required dependencies will be installed automatically by the provided shell - libgstreamerd-3-dev - libsecret-1-dev - libwebkit2gtk-4.0-dev -- libosmesa6-dev - libssl-dev - libcurl4-openssl-dev - eglexternalplatform-dev @@ -188,6 +187,6 @@ All required dependencies will be installed automatically by the provided shell ### Instructions ```shell -sudo ./BuildLinux.sh -u # Install dependencies -./BuildLinux.sh -dsi # Build OrcaSlicer +`./build_linux.sh -u` # install dependencies +`./build_linux.sh -disr` # build OrcaSlicer ``` diff --git a/flatpak/entrypoint b/flatpak/entrypoint index 0c8e163fdc..38fd86f451 100644 --- a/flatpak/entrypoint +++ b/flatpak/entrypoint @@ -6,11 +6,4 @@ grep -q org.freedesktop.Platform.GL.nvidia /.flatpak-info && export WEBKIT_DISAB # Work-around https://github.com/bambulab/BambuStudio/issues/3440 export LC_ALL=C.UTF-8 -if XDG_CONFIG_HOME=$HOME/.config /app/bin/uses-dark-theme.py; then - export GTK_THEME='Adwaita:dark' - export ORCA_SLICER_DARK_THEME='true' - echo "Message: $(date +%T): INFO: using dark theme variant" -fi - -exec /app/bin/orca-slicer "$@" & -$(/app/bin/set-dark-theme-variant.py) & +exec /app/bin/orca-slicer "$@" diff --git a/flatpak/io.github.softfever.OrcaSlicer.yml b/flatpak/io.github.softfever.OrcaSlicer.yml index f40e2cba4f..3dde299a64 100755 --- a/flatpak/io.github.softfever.OrcaSlicer.yml +++ b/flatpak/io.github.softfever.OrcaSlicer.yml @@ -1,6 +1,6 @@ app-id: io.github.softfever.OrcaSlicer runtime: org.gnome.Platform -runtime-version: "46" +runtime-version: "47" sdk: org.gnome.Sdk command: entrypoint separate-locales: true @@ -19,34 +19,8 @@ finish-args: - --talk-name=io.github.softfever.OrcaSlicer.InstanceCheck.* - --system-talk-name=org.freedesktop.UDisks2 - --env=SPNAV_SOCKET=/run/spnav.sock - # set dark theme - - --env=ORCA_SLICER_DARK_THEME=false modules: - # xprop, xlib is needed to manipulate the X11 window and set _GTK_THEME_VARIANT dark on X11 - # and paint the window dark when ORCA_SLICER_DARK_THEME is true - # see: entrypoint & set-dark-theme-variant.py (originated from Pursa Slicer flatpak which originated from spotify client flatpak) - - name: xprop - sources: - - type: archive - url: https://xorg.freedesktop.org/archive/individual/app/xprop-1.2.5.tar.gz - sha256: b7bf6b6be6cf23e7966a153fc84d5901c14f01ee952fbd9d930aa48e2385d670 - - name: python-setuptools_scm - buildsystem: simple - build-commands: - - pip3 install --no-deps --no-build-isolation --verbose --prefix=${FLATPAK_DEST} . - sources: - - type: archive - url: https://files.pythonhosted.org/packages/57/38/930b1241372a9f266a7df2b184fb9d4f497c2cef2e016b014f82f541fe7c/setuptools_scm-6.0.1.tar.gz - sha256: d1925a69cb07e9b29416a275b9fadb009a23c148ace905b2fb220649a6c18e92 - - name: python-xlib - buildsystem: simple - build-commands: - - pip3 install --no-deps --no-build-isolation --verbose --prefix=${FLATPAK_DEST} . - sources: - - type: archive - url: https://files.pythonhosted.org/packages/86/f5/8c0653e5bb54e0cbdfe27bf32d41f27bc4e12faa8742778c17f2a71be2c0/python-xlib-0.33.tar.gz - sha256: 55af7906a2c75ce6cb280a584776080602444f75815a7aff4d287bb2d7018b32 # JPEG codec for the liveview - name: gst-plugins-good @@ -62,29 +36,6 @@ modules: url: https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.22.8.tar.xz sha256: e305b9f07f52743ca481da0a4e0c76c35efd60adaf1b0694eb3bb021e2137e39 - # For libOSMesa - - name: mesa - buildsystem: meson - config-opts: - - -Dosmesa=classic - - -Ddri-drivers=[] - - -Dgallium-drivers=[] - - -Dvulkan-drivers=[] - - -Dplatforms=[] - build-options: - arch: - aarch64: - config-opts: - - -Dlibunwind=disabled - cleanup: - - /share/drirc.d - - /include - - "*.a" - sources: - - type: archive - url: https://archive.mesa3d.org/older-versions/20.x/mesa-20.2.6.tar.xz - sha256: f12ca3c6c622f11cd79ad66b4220f04514fa96f795062fe92a37339ab19885db - - name: glu config-opts: - --disable-static @@ -112,7 +63,7 @@ modules: - type: archive url: https://github.com/FreeSpacenav/libspnav/releases/download/v1.2/libspnav-1.2.tar.gz sha256: 093747e7e03b232e08ff77f1ad7f48552c06ac5236316a5012db4269951c39db - + - name: orca_wxwidgets buildsystem: simple build-commands: @@ -221,6 +172,12 @@ modules: dest: external-packages/GMP sha256: eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c + # curl + - type: file + url: https://github.com/curl/curl/archive/refs/tags/curl-7_75_0.zip + dest: external-packages/CURL + sha256: a63ae025bb0a14f119e73250f2c923f4bf89aa93b8d4fafa4a9f5353a96a765a + # MPFR - type: file url: https://www.mpfr.org/mpfr-4.2.2/mpfr-4.2.2.tar.bz2 @@ -257,6 +214,12 @@ modules: dest: external-packages/OpenEXR sha256: 0307a3d7e1fa1e77e9d84d7e9a8694583fbbbfd50bdc6884e2c96b8ef6b902de + # OpenSSL + - type: file + url: https://github.com/openssl/openssl/archive/OpenSSL_1_1_1w.tar.gz + dest: external-packages/OpenSSL + sha256: 2130e8c2fb3b79d1086186f78e59e8bc8d1a6aedf17ab3907f4cb9ae20918c41 + # OpenVDB - type: file url: https://github.com/tamasmeszaros/openvdb/archive/a68fd58d0e2b85f01adeb8b13d7555183ab10aa5.zip @@ -325,8 +288,6 @@ modules: desktop-file-edit --set-key=Exec --set-value="entrypoint %U" /app/share/applications/${FLATPAK_ID}.desktop install -Dm755 entrypoint /app/bin install -Dm755 umount /app/bin - install set-dark-theme-variant.py /app/bin - install uses-dark-theme.py /app/bin sources: # - @@ -344,14 +305,6 @@ modules: - type: file path: io.github.softfever.OrcaSlicer.metainfo.xml - # script to set dark theme variant - - type: file - path: set-dark-theme-variant.py - - # script to detect if host uses dark theme - - type: file - path: uses-dark-theme.py - # start-up script - type: file path: entrypoint diff --git a/flatpak/patches/0001-Enable-using-a-dark-theme-when-Gnome-dark-style-is-s.patch b/flatpak/patches/0001-Enable-using-a-dark-theme-when-Gnome-dark-style-is-s.patch index 7f8bd07d44..877b69b459 100644 --- a/flatpak/patches/0001-Enable-using-a-dark-theme-when-Gnome-dark-style-is-s.patch +++ b/flatpak/patches/0001-Enable-using-a-dark-theme-when-Gnome-dark-style-is-s.patch @@ -1,4 +1,4 @@ -From 221be0af1a0b5bcf05c59b3403f969643b42dbaf Mon Sep 17 00:00:00 2001 +From f0135d9c3faf0207f7100991ccf512f228b90570 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 30 Sep 2023 16:42:58 -0700 Subject: [PATCH] Enable using a dark theme when Gnome "dark style" is set @@ -8,11 +8,11 @@ automatically, so request it explicitly. Co-authored-by: Colin Kinloch --- - src/gtk/settings.cpp | 112 ++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 111 insertions(+), 1 deletion(-) + src/gtk/settings.cpp | 118 ++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 117 insertions(+), 1 deletion(-) diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp -index 304724773711..74898d9bb953 100644 +index 3047247737..f13ea2ef24 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -183,6 +183,64 @@ static void notify_gtk_font_name(GObject*, GParamSpec*, void*) @@ -80,7 +80,7 @@ index 304724773711..74898d9bb953 100644 // Some notes on using GtkStyleContext. Style information from a context // attached to a non-visible GtkWidget is not accurate. The context has an // internal visibility state, controlled by the widget, which it presumably -@@ -1124,12 +1182,62 @@ bool wxSystemSettingsNative::HasFeature(wxSystemFeature index) +@@ -1124,12 +1182,68 @@ bool wxSystemSettingsNative::HasFeature(wxSystemFeature index) class wxSystemSettingsModule: public wxModule { public: @@ -109,8 +109,14 @@ index 304724773711..74898d9bb953 100644 + + m_proxy = nullptr; + ++ if (getenv("ORCA_SLICER_DARK_THEME") != nullptr) { ++ /* 1 for prefer dark */ ++ GVariant *value = g_variant_new_uint32(1); ++ UpdatePreferDark(value); ++ g_variant_unref(value); ++ } + // GTK_THEME environment variable overrides other settings -+ if (getenv("GTK_THEME") == nullptr) ++ else if (getenv("GTK_THEME") == nullptr) + { + m_proxy = g_dbus_proxy_new_for_bus_sync( + G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, nullptr, @@ -144,7 +150,7 @@ index 304724773711..74898d9bb953 100644 void wxSystemSettingsModule::OnExit() { #ifdef __WXGTK3__ -@@ -1141,6 +1249,8 @@ void wxSystemSettingsModule::OnExit() +@@ -1141,6 +1255,8 @@ void wxSystemSettingsModule::OnExit() g_signal_handlers_disconnect_by_func(settings, (void*)notify_gtk_font_name, NULL); } @@ -154,5 +160,5 @@ index 304724773711..74898d9bb953 100644 if (gs_tlw_parent) { -- -2.46.2 +2.49.0 diff --git a/flatpak/set-dark-theme-variant.py b/flatpak/set-dark-theme-variant.py deleted file mode 100644 index 2f05be0fe5..0000000000 --- a/flatpak/set-dark-theme-variant.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python3 - -import Xlib -import Xlib.display -import time -import subprocess -import os -import sys - - -disp = Xlib.display.Display() -root = disp.screen().root - -NET_CLIENT_LIST = disp.intern_atom('_NET_CLIENT_LIST') - - -def set_theme_variant_by_window_id(id, variant): - # Use subprocess to call - # xprop and set the variant from id. - try: - s = subprocess.call(['xprop', '-f', '_GTK_THEME_VARIANT', '8u', '-set', '_GTK_THEME_VARIANT', variant, '-id', str(id)], - stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - if s == 0: - return True - return False - except Exception as ex: - return False - - -def set_theme_variant_from_win_id_collection(win_id_collection, variant): - # Loop though all of the collected - # window ids and set theme variant - for win_id in win_id_collection: - set_theme_variant_by_window_id(win_id, variant) - - -def collection_win_id_from_wm_class_name(win_class_name): - - collect = [] - - # Loop though all of the windows - # and collect id's those that match - # win_class: prusa-slicer - for win_id in root.get_full_property(NET_CLIENT_LIST, Xlib.X.AnyPropertyType).value: - try: - win = disp.create_resource_object('window', win_id) - if not win.get_wm_transient_for(): - win_class = win.get_wm_class() - if win_id and win_class_name in win_class: - collect.append( - win_id) if win_id not in collect else collect - except Xlib.error.BadWindow: - pass - - return collect - - -if __name__ == '__main__': - - if os.environ.get('ORCA_SLICER_DARK_THEME', 'false') != 'true': - sys.exit(0) - - # Listen for X Property Change events. - root.change_attributes(event_mask=Xlib.X.PropertyChangeMask) - # the class name of the slicer window - win_class_name = 'orcaslicer' - # the variant to set - variant = 'dark' - - start = time.time() - - while True: - # collect all of the window ids - collect = collection_win_id_from_wm_class_name(win_class_name) - # give Orca Slicer window 2 secs to - # collect the wanted window ids - # set the theme variant and exit - if time.time() - start <= 2: - # disp.next_event() blocks if no events are - # queued. In combination with while True - # it creates a very simple event loop. - disp.next_event() - set_theme_variant_from_win_id_collection(collect, variant) - else: - break diff --git a/flatpak/uses-dark-theme.py b/flatpak/uses-dark-theme.py deleted file mode 100644 index 4d7ebbc87a..0000000000 --- a/flatpak/uses-dark-theme.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -import gi -gi.require_version("Gtk", "3.0") -from gi.repository import Gtk as gtk - - -if __name__ == '__main__': - forced = os.environ.get('ORCA_SLICER_DARK_THEME', 'false') == 'true' - settings = gtk.Settings.get_default() - prefer_dark = settings.get_property('gtk-application-prefer-dark-theme') - - if not forced and not prefer_dark: - sys.exit(1) - else: - sys.exit(0) diff --git a/linux.d/README.md b/linux.d/README.md index 7f05a77cd4..4cfc11b045 100644 --- a/linux.d/README.md +++ b/linux.d/README.md @@ -1,3 +1,3 @@ Files in this directory are named for the **exact** output of `awk -F= '/^ID=/ {print $2}' /etc/os-release` for their respective distribution. -When `BuildLinux.sh` is executed, the respective file for the distribution will be sourced so the distribution specific instructions/logic are used. +When `build_linux.sh` is executed, the respective file for the distribution will be sourced so the distribution specific instructions/logic are used. diff --git a/linux.d/debian b/linux.d/debian index 10d866fcb5..cce41d74ce 100644 --- a/linux.d/debian +++ b/linux.d/debian @@ -15,7 +15,6 @@ REQUIRED_DEV_PACKAGES=( libgstreamerd-3-dev libgtk-3-dev libmspack-dev - libosmesa6-dev libsecret-1-dev libspnav-dev libssl-dev @@ -44,7 +43,7 @@ then fi # check which version of libwebkit2gtk is available - if [ "$(apt show --quiet libwebkit2gtk-4.0-dev)" != "" ] + if [ "$(apt show --quiet libwebkit2gtk-4.0-dev 2>/dev/null)" != "" ] then REQUIRED_DEV_PACKAGES+=(libwebkit2gtk-4.0-dev) else diff --git a/linux.d/fedora b/linux.d/fedora index bdfe05d567..ed91883dd9 100644 --- a/linux.d/fedora +++ b/linux.d/fedora @@ -22,7 +22,6 @@ REQUIRED_DEV_PACKAGES=( libtool m4 mesa-libGLU-devel - mesa-libOSMesa-devel ninja-build openssl-devel perl-FindBin diff --git a/resources/profiles/Phrozen.json b/resources/profiles/Phrozen.json new file mode 100644 index 0000000000..e5eae56b69 --- /dev/null +++ b/resources/profiles/Phrozen.json @@ -0,0 +1,70 @@ +{ + "name": "Phrozen", + "version": "00.00.00.01", + "force_update": "0", + "description": "Phrozen configurations", + "machine_model_list": [ + { + "name": "Phrozen Arco", + "sub_path": "machine/Phrozen Arco.json" + } + ], + "process_list": [ + { + "name": "fdm_process_common", + "sub_path": "process/fdm_process_common.json" + }, + { + "name": "0.20mm Standard @Phrozen Arco", + "sub_path": "process/0.20mm Standard @Phrozen Arco 0.4 nozzle.json" + } + ], + "filament_list": [ + { + "name": "fdm_filament_common", + "sub_path": "filament/fdm_filament_common.json" + }, + { + "name": "fdm_filament_pla", + "sub_path": "filament/fdm_filament_pla.json" + }, + { + "name": "fdm_filament_tpu", + "sub_path": "filament/fdm_filament_tpu.json" + }, + { + "name": "fdm_filament_pet", + "sub_path": "filament/fdm_filament_pet.json" + }, + { + "name": "fdm_filament_abs", + "sub_path": "filament/fdm_filament_abs.json" + }, + { + "name": "fdm_filament_pc", + "sub_path": "filament/fdm_filament_pc.json" + }, + { + "name": "fdm_filament_asa", + "sub_path": "filament/fdm_filament_asa.json" + }, + { + "name": "fdm_filament_pva", + "sub_path": "filament/fdm_filament_pva.json" + }, + { + "name": "fdm_filament_pa", + "sub_path": "filament/fdm_filament_pa.json" + } + ], + "machine_list": [ + { + "name": "fdm_machine_common", + "sub_path": "machine/fdm_machine_common.json" + }, + { + "name": "Phrozen Arco 0.4 nozzle", + "sub_path": "machine/Phrozen Arco 0.4 nozzle.json" + } + ] +} diff --git a/resources/profiles/Phrozen/Phrozen Arco_buildplate_model.stl b/resources/profiles/Phrozen/Phrozen Arco_buildplate_model.stl new file mode 100644 index 0000000000..d3c6b8107a Binary files /dev/null and b/resources/profiles/Phrozen/Phrozen Arco_buildplate_model.stl differ diff --git a/resources/profiles/Phrozen/Phrozen Arco_buildplate_texture.png b/resources/profiles/Phrozen/Phrozen Arco_buildplate_texture.png new file mode 100644 index 0000000000..c0aa13c089 Binary files /dev/null and b/resources/profiles/Phrozen/Phrozen Arco_buildplate_texture.png differ diff --git a/resources/profiles/Phrozen/Phrozen Arco_buildplate_texture.svg b/resources/profiles/Phrozen/Phrozen Arco_buildplate_texture.svg new file mode 100644 index 0000000000..1ae1e92edf --- /dev/null +++ b/resources/profiles/Phrozen/Phrozen Arco_buildplate_texture.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/profiles/Phrozen/Phrozen Arco_cover.png b/resources/profiles/Phrozen/Phrozen Arco_cover.png new file mode 100644 index 0000000000..f0ffbf6680 Binary files /dev/null and b/resources/profiles/Phrozen/Phrozen Arco_cover.png differ diff --git a/resources/profiles/Phrozen/filament/Phrozen PLA @Phrozen Arco 0.4 nozzle.json b/resources/profiles/Phrozen/filament/Phrozen PLA @Phrozen Arco 0.4 nozzle.json new file mode 100644 index 0000000000..b36382bbc3 --- /dev/null +++ b/resources/profiles/Phrozen/filament/Phrozen PLA @Phrozen Arco 0.4 nozzle.json @@ -0,0 +1,258 @@ +{ + "type": "filament", + "filament_id": "GFL99", + "setting_id": "GFSA04", + "from": "system", + "instantiation": "true", + "name": "Phrozen PLA @Phrozen Arco 0.4 nozzle", + "inherits": "fdm_filament_pla", + "filament_settings_id": [ + "Phrozen PLA @Phrozen Arco 0.4 nozzle" + ], + "filament_flow_ratio": [ + "0.98" + ], + "filament_max_volumetric_speed": [ + "12" + ], + "nozzle_temperature": [ + "205" + ], + "compatible_printers": [ + "Phrozen Arco 0.4 nozzle" + ], + "activate_air_filtration": [ + "1" + ], + "activate_chamber_temp_control": [ + "0" + ], + "adaptive_pressure_advance_model": [ + "0.042,0.72,5000\n0.044,1.44,5000\n0.045,2.16,5000\n0.045,2.88,5000\n0.045,3.58,5000\n0.044,4.3,5000\n0.045,5.02,5000\n0.043,5.73,5000\n0.045,6.45,5000\n0.041,7.17,5000\n0.039,7.89,5000\n0.038,8.61,5000\n0.036,9.33,5000\n0.033,10.05,5000\n0.032,10.77,5000\n0.034,11.49,5000\n0.033,12.21,5000" + ], + "additional_cooling_fan_speed": [ + "60" + ], + "bed_type": [ + "Cool Plate" + ], + "chamber_temperature": [ + "0" + ], + "close_fan_the_first_x_layers": [ + "1" + ], + "compatible_printers_condition": "", + "compatible_prints": [], + "compatible_prints_condition": "", + "complete_print_exhaust_fan_speed": [ + "80" + ], + "cool_plate_temp": [ + "35" + ], + "cool_plate_temp_initial_layer": [ + "35" + ], + "default_filament_colour": [ + "" + ], + "during_print_exhaust_fan_speed": [ + "60" + ], + "enable_overhang_bridge_fan": [ + "1" + ], + "enable_pressure_advance": [ + "1" + ], + "eng_plate_temp": [ + "0" + ], + "eng_plate_temp_initial_layer": [ + "0" + ], + "fan_cooling_layer_time": [ + "100" + ], + "fan_max_speed": [ + "100" + ], + "fan_min_speed": [ + "100" + ], + "filament_cooling_final_speed": [ + "0" + ], + "filament_cooling_initial_speed": [ + "0" + ], + "filament_cooling_moves": [ + "0" + ], + "filament_cost": [ + "20" + ], + "filament_density": [ + "1.24" + ], + "filament_deretraction_speed": [ + "nil" + ], + "filament_diameter": [ + "1.75" + ], + "filament_end_gcode": [ + "; filament end gcode\n" + ], + "filament_is_support": [ + "0" + ], + "filament_load_time": [ + "31.925" + ], + "filament_loading_speed": [ + "0" + ], + "filament_loading_speed_start": [ + "0" + ], + "filament_long_retractions_when_cut": [ + "nil" + ], + "filament_minimal_purge_on_wipe_tower": [ + "15" + ], + "filament_multitool_ramming": [ + "0" + ], + "filament_multitool_ramming_flow": [ + "0" + ], + "filament_multitool_ramming_volume": [ + "0" + ], + "filament_notes": [ + "" + ], + "filament_ramming_parameters": [ + "120 100 6.6 6.8 7.2 7.6 7.9 8.2 8.7 9.4 9.9 10.0| 0.05 6.6 0.45 6.8 0.95 7.8 1.45 8.3 1.95 9.7 2.45 10 2.95 7.6 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6" + ], + "filament_retract_before_wipe": [ + "nil" + ], + "filament_retract_lift_above": [ + "nil" + ], + "filament_retract_lift_below": [ + "nil" + ], + "filament_retract_lift_enforce": [ + "nil" + ], + "filament_retract_restart_extra": [ + "nil" + ], + "filament_retract_when_changing_layer": [ + "nil" + ], + "filament_retraction_distances_when_cut": [ + "nil" + ], + "filament_retraction_length": [ + "nil" + ], + "filament_retraction_minimum_travel": [ + "nil" + ], + "filament_retraction_speed": [ + "nil" + ], + "filament_shrink": [ + "100%" + ], + "filament_soluble": [ + "0" + ], + "filament_start_gcode": [ + "; filament start gcode" + ], + "filament_toolchange_delay": [ + "0" + ], + "filament_unload_time": [ + "24.75" + ], + "filament_unloading_speed": [ + "0" + ], + "filament_unloading_speed_start": [ + "0" + ], + "filament_wipe": [ + "nil" + ], + "filament_wipe_distance": [ + "nil" + ], + "filament_z_hop": [ + "nil" + ], + "filament_z_hop_types": [ + "nil" + ], + "full_fan_speed_layer": [ + "0" + ], + "hot_plate_temp": [ + "55" + ], + "hot_plate_temp_initial_layer": [ + "55" + ], + "nozzle_temperature_initial_layer": [ + "215" + ], + "nozzle_temperature_range_high": [ + "240" + ], + "nozzle_temperature_range_low": [ + "190" + ], + "overhang_fan_speed": [ + "100" + ], + "overhang_fan_threshold": [ + "50%" + ], + "pressure_advance": [ + "0.035" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "required_nozzle_HRC": [ + "3" + ], + "slow_down_for_layer_cooling": [ + "1" + ], + "slow_down_layer_time": [ + "8" + ], + "slow_down_min_speed": [ + "20" + ], + "support_material_interface_fan_speed": [ + "-1" + ], + "temperature_vitrification": [ + "55" + ], + "textured_plate_temp": [ + "55" + ], + "textured_plate_temp_initial_layer": [ + "55" + ] +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/filament/fdm_filament_abs.json b/resources/profiles/Phrozen/filament/fdm_filament_abs.json new file mode 100644 index 0000000000..55f18c5ee9 --- /dev/null +++ b/resources/profiles/Phrozen/filament/fdm_filament_abs.json @@ -0,0 +1,82 @@ +{ + "type": "filament", + "name": "fdm_filament_abs", + "from": "system", + "instantiation": "false", + "inherits": "fdm_filament_common", + "filament_type": [ + "ABS" + ], + "cool_plate_temp": [ + "105" + ], + "eng_plate_temp": [ + "105" + ], + "hot_plate_temp": [ + "105" + ], + "cool_plate_temp_initial_layer": [ + "105" + ], + "eng_plate_temp_initial_layer": [ + "105" + ], + "hot_plate_temp_initial_layer": [ + "105" + ], + "slow_down_for_layer_cooling": [ + "1" + ], + "close_fan_the_first_x_layers": [ + "3" + ], + "fan_cooling_layer_time": [ + "30" + ], + "filament_max_volumetric_speed": [ + "28.6" + ], + "filament_density": [ + "1.04" + ], + "filament_cost": [ + "20" + ], + "nozzle_temperature_initial_layer": [ + "260" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "10" + ], + "overhang_fan_threshold": [ + "25%" + ], + "overhang_fan_speed": [ + "80" + ], + "nozzle_temperature": [ + "260" + ], + "temperature_vitrification": [ + "110" + ], + "nozzle_temperature_range_low": [ + "240" + ], + "nozzle_temperature_range_high": [ + "270" + ], + "slow_down_min_speed": [ + "10" + ], + "slow_down_layer_time": [ + "3" + ] +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/filament/fdm_filament_asa.json b/resources/profiles/Phrozen/filament/fdm_filament_asa.json new file mode 100644 index 0000000000..9495d85477 --- /dev/null +++ b/resources/profiles/Phrozen/filament/fdm_filament_asa.json @@ -0,0 +1,82 @@ +{ + "type": "filament", + "name": "fdm_filament_asa", + "from": "system", + "instantiation": "false", + "inherits": "fdm_filament_common", + "filament_type": [ + "ASA" + ], + "cool_plate_temp": [ + "105" + ], + "eng_plate_temp": [ + "105" + ], + "hot_plate_temp": [ + "105" + ], + "cool_plate_temp_initial_layer": [ + "105" + ], + "eng_plate_temp_initial_layer": [ + "105" + ], + "hot_plate_temp_initial_layer": [ + "105" + ], + "slow_down_for_layer_cooling": [ + "1" + ], + "close_fan_the_first_x_layers": [ + "3" + ], + "fan_cooling_layer_time": [ + "35" + ], + "filament_max_volumetric_speed": [ + "28.6" + ], + "filament_density": [ + "1.04" + ], + "filament_cost": [ + "20" + ], + "nozzle_temperature_initial_layer": [ + "260" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "10" + ], + "overhang_fan_threshold": [ + "25%" + ], + "overhang_fan_speed": [ + "80" + ], + "nozzle_temperature": [ + "260" + ], + "temperature_vitrification": [ + "110" + ], + "nozzle_temperature_range_low": [ + "240" + ], + "nozzle_temperature_range_high": [ + "270" + ], + "slow_down_min_speed": [ + "10" + ], + "slow_down_layer_time": [ + "3" + ] +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/filament/fdm_filament_common.json b/resources/profiles/Phrozen/filament/fdm_filament_common.json new file mode 100644 index 0000000000..457f288c63 --- /dev/null +++ b/resources/profiles/Phrozen/filament/fdm_filament_common.json @@ -0,0 +1,138 @@ +{ + "type": "filament", + "name": "fdm_filament_common", + "from": "system", + "instantiation": "false", + "cool_plate_temp": [ + "60" + ], + "eng_plate_temp": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "cool_plate_temp_initial_layer": [ + "60" + ], + "eng_plate_temp_initial_layer": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "overhang_fan_threshold": [ + "95%" + ], + "overhang_fan_speed": [ + "100" + ], + "slow_down_for_layer_cooling": [ + "1" + ], + "close_fan_the_first_x_layers": [ + "3" + ], + "filament_end_gcode": [ + "; filament end gcode \n" + ], + "filament_flow_ratio": [ + "1" + ], + "reduce_fan_stop_start_freq": [ + "0" + ], + "fan_cooling_layer_time": [ + "60" + ], + "filament_cost": [ + "0" + ], + "filament_density": [ + "0" + ], + "filament_deretraction_speed": [ + "nil" + ], + "filament_diameter": [ + "1.75" + ], + "filament_max_volumetric_speed": [ + "0" + ], + "filament_minimal_purge_on_wipe_tower": [ + "15" + ], + "filament_retraction_minimum_travel": [ + "nil" + ], + "filament_retract_before_wipe": [ + "nil" + ], + "filament_retract_when_changing_layer": [ + "nil" + ], + "filament_retraction_length": [ + "nil" + ], + "filament_z_hop": [ + "nil" + ], + "filament_z_hop_types": [ + "nil" + ], + "filament_retract_restart_extra": [ + "nil" + ], + "filament_retraction_speed": [ + "nil" + ], + "filament_settings_id": [ + "" + ], + "filament_soluble": [ + "0" + ], + "filament_type": [ + "PLA" + ], + "filament_vendor": [ + "Generic" + ], + "filament_wipe": [ + "nil" + ], + "filament_wipe_distance": [ + "nil" + ], + "bed_type": [ + "Cool Plate" + ], + "nozzle_temperature_initial_layer": [ + "200" + ], + "full_fan_speed_layer": [ + "0" + ], + "fan_max_speed": [ + "100" + ], + "fan_min_speed": [ + "35" + ], + "slow_down_min_speed": [ + "10" + ], + "slow_down_layer_time": [ + "8" + ], + "filament_start_gcode": [ + "; Filament gcode\n" + ], + "nozzle_temperature": [ + "200" + ], + "temperature_vitrification": [ + "100" + ] +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/filament/fdm_filament_pa.json b/resources/profiles/Phrozen/filament/fdm_filament_pa.json new file mode 100644 index 0000000000..e8c8dea0e8 --- /dev/null +++ b/resources/profiles/Phrozen/filament/fdm_filament_pa.json @@ -0,0 +1,79 @@ +{ + "type": "filament", + "name": "fdm_filament_pa", + "from": "system", + "instantiation": "false", + "inherits": "fdm_filament_common", + "filament_type": [ + "PA" + ], + "cool_plate_temp": [ + "0" + ], + "eng_plate_temp": [ + "100" + ], + "hot_plate_temp": [ + "100" + ], + "cool_plate_temp_initial_layer": [ + "0" + ], + "eng_plate_temp_initial_layer": [ + "100" + ], + "hot_plate_temp_initial_layer": [ + "100" + ], + "slow_down_for_layer_cooling": [ + "1" + ], + "close_fan_the_first_x_layers": [ + "3" + ], + "fan_cooling_layer_time": [ + "4" + ], + "filament_max_volumetric_speed": [ + "8" + ], + "filament_density": [ + "1.04" + ], + "filament_cost": [ + "20" + ], + "nozzle_temperature_initial_layer": [ + "290" + ], + "reduce_fan_stop_start_freq": [ + "0" + ], + "fan_max_speed": [ + "60" + ], + "fan_min_speed": [ + "0" + ], + "overhang_fan_speed": [ + "30" + ], + "nozzle_temperature": [ + "290" + ], + "temperature_vitrification": [ + "108" + ], + "nozzle_temperature_range_low": [ + "270" + ], + "nozzle_temperature_range_high": [ + "300" + ], + "slow_down_min_speed": [ + "10" + ], + "slow_down_layer_time": [ + "2" + ] +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/filament/fdm_filament_pc.json b/resources/profiles/Phrozen/filament/fdm_filament_pc.json new file mode 100644 index 0000000000..3192f802c5 --- /dev/null +++ b/resources/profiles/Phrozen/filament/fdm_filament_pc.json @@ -0,0 +1,82 @@ +{ + "type": "filament", + "name": "fdm_filament_pc", + "from": "system", + "instantiation": "false", + "inherits": "fdm_filament_common", + "filament_type": [ + "PC" + ], + "cool_plate_temp": [ + "0" + ], + "eng_plate_temp": [ + "110" + ], + "hot_plate_temp": [ + "110" + ], + "cool_plate_temp_initial_layer": [ + "0" + ], + "eng_plate_temp_initial_layer": [ + "110" + ], + "hot_plate_temp_initial_layer": [ + "110" + ], + "slow_down_for_layer_cooling": [ + "1" + ], + "close_fan_the_first_x_layers": [ + "3" + ], + "fan_cooling_layer_time": [ + "30" + ], + "filament_max_volumetric_speed": [ + "23.2" + ], + "filament_density": [ + "1.04" + ], + "filament_cost": [ + "20" + ], + "nozzle_temperature_initial_layer": [ + "270" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "fan_max_speed": [ + "60" + ], + "fan_min_speed": [ + "10" + ], + "overhang_fan_threshold": [ + "25%" + ], + "overhang_fan_speed": [ + "60" + ], + "nozzle_temperature": [ + "280" + ], + "temperature_vitrification": [ + "140" + ], + "nozzle_temperature_range_low": [ + "260" + ], + "nozzle_temperature_range_high": [ + "280" + ], + "slow_down_min_speed": [ + "10" + ], + "slow_down_layer_time": [ + "2" + ] +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/filament/fdm_filament_pet.json b/resources/profiles/Phrozen/filament/fdm_filament_pet.json new file mode 100644 index 0000000000..4d7ba4ada0 --- /dev/null +++ b/resources/profiles/Phrozen/filament/fdm_filament_pet.json @@ -0,0 +1,76 @@ +{ + "type": "filament", + "name": "fdm_filament_pet", + "from": "system", + "instantiation": "false", + "inherits": "fdm_filament_common", + "filament_type": [ + "PETG" + ], + "cool_plate_temp": [ + "60" + ], + "eng_plate_temp": [ + "0" + ], + "hot_plate_temp": [ + "80" + ], + "cool_plate_temp_initial_layer": [ + "60" + ], + "eng_plate_temp_initial_layer": [ + "0" + ], + "hot_plate_temp_initial_layer": [ + "80" + ], + "slow_down_for_layer_cooling": [ + "1" + ], + "close_fan_the_first_x_layers": [ + "3" + ], + "fan_cooling_layer_time": [ + "20" + ], + "filament_max_volumetric_speed": [ + "25" + ], + "filament_density": [ + "1.27" + ], + "filament_cost": [ + "30" + ], + "nozzle_temperature_initial_layer": [ + "255" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "fan_max_speed": [ + "100" + ], + "fan_min_speed": [ + "20" + ], + "overhang_fan_speed": [ + "100" + ], + "nozzle_temperature": [ + "255" + ], + "temperature_vitrification": [ + "80" + ], + "nozzle_temperature_range_low": [ + "220" + ], + "nozzle_temperature_range_high": [ + "260" + ], + "filament_start_gcode": [ + "; filament start gcode\n" + ] +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/filament/fdm_filament_pla.json b/resources/profiles/Phrozen/filament/fdm_filament_pla.json new file mode 100644 index 0000000000..5426679f33 --- /dev/null +++ b/resources/profiles/Phrozen/filament/fdm_filament_pla.json @@ -0,0 +1,88 @@ +{ + "type": "filament", + "name": "fdm_filament_pla", + "from": "system", + "instantiation": "false", + "inherits": "fdm_filament_common", + "filament_type": [ + "PLA" + ], + "fan_cooling_layer_time": [ + "100" + ], + "filament_max_volumetric_speed": [ + "12" + ], + "filament_density": [ + "1.24" + ], + "filament_cost": [ + "20" + ], + "cool_plate_temp": [ + "35" + ], + "eng_plate_temp": [ + "0" + ], + "hot_plate_temp": [ + "45" + ], + "cool_plate_temp_initial_layer": [ + "35" + ], + "eng_plate_temp_initial_layer": [ + "0" + ], + "hot_plate_temp_initial_layer": [ + "45" + ], + "nozzle_temperature_initial_layer": [ + "220" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "slow_down_for_layer_cooling": [ + "1" + ], + "fan_max_speed": [ + "100" + ], + "fan_min_speed": [ + "100" + ], + "overhang_fan_speed": [ + "100" + ], + "overhang_fan_threshold": [ + "50%" + ], + "close_fan_the_first_x_layers": [ + "1" + ], + "nozzle_temperature": [ + "220" + ], + "temperature_vitrification": [ + "60" + ], + "nozzle_temperature_range_low": [ + "190" + ], + "nozzle_temperature_range_high": [ + "230" + ], + "slow_down_min_speed": [ + "10" + ], + "slow_down_layer_time": [ + "4" + ], + "additional_cooling_fan_speed": [ + "70" + ], + "filament_start_gcode": [ + "; filament start gcode\n" + ] +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/filament/fdm_filament_pva.json b/resources/profiles/Phrozen/filament/fdm_filament_pva.json new file mode 100644 index 0000000000..eee5675ea8 --- /dev/null +++ b/resources/profiles/Phrozen/filament/fdm_filament_pva.json @@ -0,0 +1,94 @@ +{ + "type": "filament", + "name": "fdm_filament_pva", + "from": "system", + "instantiation": "false", + "inherits": "fdm_filament_common", + "filament_type": [ + "PVA" + ], + "cool_plate_temp": [ + "35" + ], + "eng_plate_temp": [ + "0" + ], + "hot_plate_temp": [ + "45" + ], + "cool_plate_temp_initial_layer": [ + "35" + ], + "eng_plate_temp_initial_layer": [ + "0" + ], + "hot_plate_temp_initial_layer": [ + "45" + ], + "fan_cooling_layer_time": [ + "100" + ], + "filament_max_volumetric_speed": [ + "15" + ], + "filament_soluble": [ + "1" + ], + "filament_is_support": [ + "1" + ], + "filament_density": [ + "1.24" + ], + "filament_cost": [ + "20" + ], + "nozzle_temperature_initial_layer": [ + "220" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "slow_down_for_layer_cooling": [ + "1" + ], + "fan_max_speed": [ + "100" + ], + "fan_min_speed": [ + "100" + ], + "overhang_fan_speed": [ + "100" + ], + "overhang_fan_threshold": [ + "50%" + ], + "close_fan_the_first_x_layers": [ + "1" + ], + "nozzle_temperature": [ + "220" + ], + "temperature_vitrification": [ + "50" + ], + "nozzle_temperature_range_low": [ + "190" + ], + "nozzle_temperature_range_high": [ + "250" + ], + "slow_down_min_speed": [ + "10" + ], + "slow_down_layer_time": [ + "4" + ], + "additional_cooling_fan_speed": [ + "70" + ], + "filament_start_gcode": [ + "; filament start gcode\n" + ] +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/filament/fdm_filament_tpu.json b/resources/profiles/Phrozen/filament/fdm_filament_tpu.json new file mode 100644 index 0000000000..3d14ece169 --- /dev/null +++ b/resources/profiles/Phrozen/filament/fdm_filament_tpu.json @@ -0,0 +1,82 @@ +{ + "type": "filament", + "name": "fdm_filament_tpu", + "from": "system", + "instantiation": "false", + "inherits": "fdm_filament_common", + "filament_type": [ + "TPU" + ], + "cool_plate_temp": [ + "30" + ], + "eng_plate_temp": [ + "30" + ], + "hot_plate_temp": [ + "35" + ], + "cool_plate_temp_initial_layer": [ + "30" + ], + "eng_plate_temp_initial_layer": [ + "30" + ], + "hot_plate_temp_initial_layer": [ + "35" + ], + "fan_cooling_layer_time": [ + "100" + ], + "filament_max_volumetric_speed": [ + "15" + ], + "filament_density": [ + "1.24" + ], + "filament_cost": [ + "20" + ], + "filament_retraction_length": [ + "0.4" + ], + "nozzle_temperature_initial_layer": [ + "240" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "slow_down_for_layer_cooling": [ + "1" + ], + "fan_max_speed": [ + "100" + ], + "fan_min_speed": [ + "100" + ], + "overhang_fan_speed": [ + "100" + ], + "additional_cooling_fan_speed": [ + "70" + ], + "close_fan_the_first_x_layers": [ + "1" + ], + "nozzle_temperature": [ + "240" + ], + "temperature_vitrification": [ + "60" + ], + "nozzle_temperature_range_low": [ + "200" + ], + "nozzle_temperature_range_high": [ + "250" + ], + "filament_start_gcode": [ + "; filament start gcode\n" + ] +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/machine/Phrozen Arco 0.4 nozzle.json b/resources/profiles/Phrozen/machine/Phrozen Arco 0.4 nozzle.json new file mode 100644 index 0000000000..d0d4866090 --- /dev/null +++ b/resources/profiles/Phrozen/machine/Phrozen Arco 0.4 nozzle.json @@ -0,0 +1,232 @@ +{ + "from": "User", + "inherits": "fdm_machine_common", + "instantiation": "true", + "printer_technology": "FFF", + "version": "0.0.0.1", + "printer_settings_id": "Phrozen Arco 0.4 nozzle", + "printer_model": "Phrozen Arco", + "printer_variant": "0.4", + "name": "Phrozen Arco 0.4 nozzle", + "nozzle_diameter": [ + "0.4" + ], + "default_print_profile": "0.20mm Standard @Phrozen Arco 0.4 nozzle", + "default_filament_profile": [ + "Phrozen PLA @Phrozen Arco 0.4 nozzle" + ], + "disable_m73": "1", + "gcode_flavor": "klipper", + "printable_area": [ + "0x0", + "300x0", + "300x300", + "0x300" + ], + "printable_height": "300", + "thumbnails": "240x224/PNG", + "thumbnails_format": "PNG", + "adaptive_bed_mesh_margin": "0", + "auxiliary_fan": "1", + "bbl_use_printhost": "0", + "bed_custom_model": "", + "bed_custom_texture": "", + "bed_exclude_area": [], + "bed_mesh_max": "0,0", + "bed_mesh_min": "0,0", + "bed_mesh_probe_distance": "0,0", + "before_layer_change_gcode": "; BEFORE_LAYER_CHANGE [layer_num] @ [layer_z]mm", + "best_object_pos": "0.5,0.5", + "change_extrusion_role_gcode": "", + "change_filament_gcode": "G1 E-1 F3600", + "cooling_tube_length": "0", + "cooling_tube_retraction": "0", + "deretraction_speed": [ + "0" + ], + "emit_machine_limits_to_gcode": "1", + "enable_filament_ramming": "0", + "enable_long_retraction_when_cut": "0", + "extra_loading_move": "0", + "extruder_clearance_height_to_lid": "240", + "extruder_clearance_height_to_rod": "48", + "extruder_clearance_radius": "60", + "extruder_colour": [ + "#FF4D4F" + ], + "extruder_offset": [ + "0x0" + ], + "fan_kickstart": "0", + "fan_speedup_overhangs": "1", + "fan_speedup_time": "0", + "head_wrap_detect_zone": [], + "high_current_on_filament_swap": "0", + "host_type": "octoprint", + "is_custom_defined": "0", + "layer_change_gcode": "; AFTER_LAYER_CHANGE [layer_num] @ [layer_z]mm", + "long_retractions_when_cut": [ + "0" + ], + "machine_end_gcode": "PRINT_END", + "machine_load_filament_time": "126.423", + "machine_max_acceleration_e": [ + "5000", + "5000" + ], + "machine_max_acceleration_extruding": [ + "20000", + "20000" + ], + "machine_max_acceleration_retracting": [ + "5000", + "5000" + ], + "machine_max_acceleration_travel": [ + "20000", + "20000" + ], + "machine_max_acceleration_x": [ + "10000", + "10000" + ], + "machine_max_acceleration_y": [ + "10000", + "10000" + ], + "machine_max_acceleration_z": [ + "500", + "500" + ], + "machine_max_jerk_e": [ + "2.5", + "2.5" + ], + "machine_max_jerk_x": [ + "9", + "9" + ], + "machine_max_jerk_y": [ + "9", + "9" + ], + "machine_max_jerk_z": [ + "3", + "3" + ], + "machine_max_speed_e": [ + "80", + "80" + ], + "machine_max_speed_x": [ + "600", + "600" + ], + "machine_max_speed_y": [ + "600", + "600" + ], + "machine_max_speed_z": [ + "15", + "15" + ], + "machine_min_extruding_rate": [ + "0", + "0" + ], + "machine_min_travel_rate": [ + "0", + "0" + ], + "machine_pause_gcode": "M601", + "machine_start_gcode": "M107\nG90\nM140 S65 ; set bed temperature\nM104 S140 ; set temperature\nM190 S65 ; set bed temperature\nM109 S140 ; set temperature\nPG28\nM106 S255 \nG30\n;AUTO_LEVELING_2\nM106 S0\nG21\nM83\nM109 S220\nP0 M1\nP28\nP2 A1", + "machine_tool_change_time": "0", + "machine_unload_filament_time": "0", + "manual_filament_change": "0", + "max_layer_height": [ + "0.28" + ], + "min_layer_height": [ + "0.08" + ], + "nozzle_height": "4", + "nozzle_hrc": "0", + "nozzle_type": "brass", + "nozzle_volume": "71.6", + "parking_pos_retraction": "0", + "pellet_modded_printer": "0", + "preferred_orientation": "0", + "printer_notes": "", + "printer_structure": "corexy", + "printhost_authorization_type": "key", + "printhost_ssl_ignore_revoke": "0", + "printing_by_object_gcode": "", + "purge_in_prime_tower": "0", + "retract_before_wipe": [ + "0%" + ], + "retract_length_toolchange": [ + "0" + ], + "retract_lift_above": [ + "0.3" + ], + "retract_lift_below": [ + "249" + ], + "retract_lift_enforce": [ + "All Surfaces" + ], + "retract_on_top_layer": [ + "1" + ], + "retract_restart_extra": [ + "0" + ], + "retract_restart_extra_toolchange": [ + "0" + ], + "retract_when_changing_layer": [ + "1" + ], + "retraction_distances_when_cut": [ + "18" + ], + "retraction_length": [ + "2" + ], + "retraction_minimum_travel": [ + "1" + ], + "retraction_speed": [ + "45" + ], + "scan_first_layer": "0", + "silent_mode": "0", + "single_extruder_multi_material": "1", + "support_air_filtration": "1", + "support_chamber_temp_control": "0", + "support_multi_bed_types": "0", + "template_custom_gcode": "", + "time_cost": "0", + "time_lapse_gcode": "", + "travel_slope": [ + "3" + ], + "upward_compatible_machine": [], + "use_firmware_retraction": "0", + "use_relative_e_distances": "1", + "wipe": [ + "1" + ], + "wipe_distance": [ + "2" + ], + "z_hop": [ + "0.4" + ], + "z_hop_types": [ + "Spiral Lift" + ], + "z_offset": "0" +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/machine/Phrozen Arco.json b/resources/profiles/Phrozen/machine/Phrozen Arco.json new file mode 100644 index 0000000000..b60155d2cd --- /dev/null +++ b/resources/profiles/Phrozen/machine/Phrozen Arco.json @@ -0,0 +1,12 @@ +{ + "type": "machine_model", + "machine_tech": "FFF", + "family": "Phrozen", + "name": "Phrozen Arco", + "model_id": "Phrozen Arco", + "nozzle_diameter": "0.4", + "bed_model": "Phrozen Arco_buildplate_model.stl", + "bed_texture": "Phrozen Arco_buildplate_texture.png", + "hotend_model": "", + "default_materials": "Phrozen PLA @Phrozen Arco 0.4 nozzle" +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/machine/_fdm_machine_common.json b/resources/profiles/Phrozen/machine/_fdm_machine_common.json new file mode 100644 index 0000000000..e11bc7c234 --- /dev/null +++ b/resources/profiles/Phrozen/machine/_fdm_machine_common.json @@ -0,0 +1,139 @@ +{ + "type": "machine", + "name": "fdm_machine_common", + "from": "system", + "instantiation": "false", + "gcode_flavor": "marlin", + "machine_start_gcode": "", + "machine_end_gcode": "", + "extruder_colour": [ + "#018001" + ], + "extruder_offset": [ + "0x0" + ], + "machine_max_acceleration_e": [ + "5000", + "5000" + ], + "machine_max_acceleration_extruding": [ + "2000", + "2000" + ], + "machine_max_acceleration_retracting": [ + "5000", + "5000" + ], + "machine_max_acceleration_travel": [ + "3000", + "3000" + ], + "machine_max_acceleration_x": [ + "2000", + "2000" + ], + "machine_max_acceleration_y": [ + "2000", + "2000" + ], + "machine_max_acceleration_z": [ + "300", + "200" + ], + "machine_max_speed_e": [ + "25", + "25" + ], + "machine_max_speed_x": [ + "300", + "200" + ], + "machine_max_speed_y": [ + "300", + "200" + ], + "machine_max_speed_z": [ + "12", + "12" + ], + "machine_max_jerk_e": [ + "2.5", + "2.5" + ], + "machine_max_jerk_x": [ + "9", + "9" + ], + "machine_max_jerk_y": [ + "9", + "9" + ], + "machine_max_jerk_z": [ + "0.2", + "0.4" + ], + "machine_min_extruding_rate": [ + "0", + "0" + ], + "machine_min_travel_rate": [ + "0", + "0" + ], + "max_layer_height": [ + "0.3" + ], + "min_layer_height": [ + "0.08" + ], + "printable_height": "300", + "extruder_clearance_radius": "65", + "extruder_clearance_height_to_rod": "36", + "extruder_clearance_height_to_lid": "140", + "nozzle_diameter": [ + "0.4" + ], + "printer_settings_id": "", + "printer_technology": "FFF", + "printer_variant": "0.4", + "retraction_minimum_travel": [ + "1" + ], + "retract_before_wipe": [ + "70%" + ], + "retract_when_changing_layer": [ + "1" + ], + "retraction_length": [ + "0.8" + ], + "retract_length_toolchange": [ + "2" + ], + "z_hop": [ + "0.4" + ], + "retract_restart_extra": [ + "0" + ], + "retract_restart_extra_toolchange": [ + "0" + ], + "retraction_speed": [ + "30" + ], + "deretraction_speed": [ + "30" + ], + "silent_mode": "0", + "single_extruder_multi_material": "1", + "change_filament_gcode": "", + "before_layer_change_gcode": ";BEFORE_LAYER_CHANGE\n;[layer_z]\nG92 E0\n", + "layer_change_gcode": ";AFTER_LAYER_CHANGE\n;[layer_z]", + "machine_pause_gcode": "M400 U1\n", + "wipe": [ + "1" + ], + "z_hop_types": "Normal Lift" +} diff --git a/resources/profiles/Phrozen/machine/fdm_machine_common.json b/resources/profiles/Phrozen/machine/fdm_machine_common.json new file mode 100644 index 0000000000..5316314092 --- /dev/null +++ b/resources/profiles/Phrozen/machine/fdm_machine_common.json @@ -0,0 +1,7 @@ +{ + "type": "machine", + "name": "fdm_machine_common", + "from": "system", + "instantiation": "false", + "gcode_flavor": "marlin" +} diff --git a/resources/profiles/Phrozen/process/0.20mm Standard @Phrozen Arco 0.4 nozzle.json b/resources/profiles/Phrozen/process/0.20mm Standard @Phrozen Arco 0.4 nozzle.json new file mode 100644 index 0000000000..58904f9912 --- /dev/null +++ b/resources/profiles/Phrozen/process/0.20mm Standard @Phrozen Arco 0.4 nozzle.json @@ -0,0 +1,292 @@ +{ + "type": "process", + "from": "system", + "setting_id": "GP004", + "name": "0.20mm Standard @Phrozen Arco 0.4 nozzle", + "inherits": "fdm_process_common", + "instantiation": "true", + "is_custom_defined": "0", + "version": "1.3.2412.13", + "print_settings_id": "0.20mm Standard @Phrozen Arco 0.4 nozzle", + "layer_height": "0.2", + "filename_format": "{input_filename_base}_{filament_type[0]}_{layer_height}_{print_time}.gcode", + "compatible_printers": [ + "Phrozen Arco 0.4 nozzle" + ], + "accel_to_decel_enable": "1", + "accel_to_decel_factor": "50%", + "alternate_extra_wall": "0", + "bottom_shell_layers": "3", + "bottom_shell_thickness": "0", + "bottom_solid_infill_flow_ratio": "1", + "bottom_surface_pattern": "monotonic", + "bridge_acceleration": "50%", + "bridge_angle": "0", + "bridge_density": "100%", + "bridge_flow": "0.9", + "bridge_no_support": "0", + "bridge_speed": "30", + "brim_ears_detection_length": "1", + "brim_ears_max_angle": "125", + "brim_object_gap": "0.1", + "brim_type": "auto_brim", + "brim_width": "5", + "compatible_printers_condition": "", + "counterbore_hole_bridging": "none", + "default_acceleration": "10000", + "default_jerk": "9", + "detect_narrow_internal_solid_infill": "1", + "detect_overhang_wall": "1", + "detect_thin_wall": "1", + "dont_filter_internal_bridges": "disabled", + "draft_shield": "disabled", + "elefant_foot_compensation": "0.075", + "elefant_foot_compensation_layers": "1", + "enable_arc_fitting": "0", + "enable_overhang_speed": "1", + "enable_prime_tower": "1", + "enable_support": "0", + "enforce_support_layers": "0", + "ensure_vertical_shell_thickness": "ensure_all", + "exclude_object": "1", + "extra_perimeters_on_overhangs": "1", + "filter_out_gap_fill": "0", + "flush_into_infill": "0", + "flush_into_objects": "0", + "flush_into_support": "1", + "fuzzy_skin": "none", + "fuzzy_skin_first_layer": "0", + "fuzzy_skin_point_distance": "0.8", + "fuzzy_skin_thickness": "0.3", + "gap_fill_target": "topbottom", + "gap_infill_speed": "250", + "gcode_add_line_number": "0", + "gcode_comments": "0", + "gcode_label_objects": "1", + "hole_to_polyhole": "0", + "hole_to_polyhole_threshold": "0.01", + "hole_to_polyhole_twisted": "1", + "independent_support_layer_height": "1", + "infill_anchor": "400%", + "infill_anchor_max": "20", + "infill_combination": "0", + "infill_direction": "45", + "infill_jerk": "9", + "infill_wall_overlap": "15%", + "initial_layer_acceleration": "500", + "initial_layer_infill_speed": "80", + "initial_layer_jerk": "9", + "initial_layer_line_width": "0.5", + "initial_layer_min_bead_width": "85%", + "initial_layer_print_height": "0.2", + "initial_layer_speed": "50", + "initial_layer_travel_speed": "100%", + "inner_wall_acceleration": "5000", + "inner_wall_jerk": "9", + "inner_wall_line_width": "0.45", + "inner_wall_speed": "300", + "interface_shells": "0", + "internal_bridge_flow": "1", + "internal_bridge_speed": "150%", + "internal_solid_infill_acceleration": "5000", + "internal_solid_infill_line_width": "0.42", + "internal_solid_infill_pattern": "monotonic", + "internal_solid_infill_speed": "250", + "ironing_angle": "-1", + "ironing_flow": "10%", + "ironing_pattern": "zig-zag", + "ironing_spacing": "0.15", + "ironing_speed": "30", + "ironing_type": "no ironing", + "is_infill_first": "0", + "line_width": "0.42", + "make_overhang_printable": "0", + "make_overhang_printable_angle": "55", + "make_overhang_printable_hole_size": "0", + "max_bridge_length": "10", + "max_travel_detour_distance": "0", + "max_volumetric_extrusion_rate_slope": "0", + "max_volumetric_extrusion_rate_slope_segment_length": "3", + "min_bead_width": "85%", + "min_feature_size": "25%", + "min_length_factor": "0.5", + "min_width_top_surface": "300%", + "minimum_sparse_infill_area": "15", + "mmu_segmented_region_interlocking_depth": "0", + "mmu_segmented_region_max_width": "0", + "notes": "", + "only_one_wall_first_layer": "0", + "only_one_wall_top": "1", + "ooze_prevention": "0", + "outer_wall_acceleration": "5000", + "outer_wall_jerk": "9", + "outer_wall_line_width": "0.42", + "outer_wall_speed": "200", + "overhang_1_4_speed": "0", + "overhang_2_4_speed": "50", + "overhang_3_4_speed": "30", + "overhang_4_4_speed": "10", + "overhang_reverse": "0", + "overhang_reverse_internal_only": "0", + "overhang_reverse_threshold": "50%", + "overhang_speed_classic": "1", + "overhang_totally_speed": "10", + "post_process": [], + "precise_outer_wall": "1", + "precise_z_height": "0", + "prime_tower_brim_width": "5", + "prime_tower_width": "35", + "prime_volume": "20", + "print_flow_ratio": "1", + "print_order": "default", + "print_sequence": "by layer", + "raft_contact_distance": "0.1", + "raft_expansion": "1.5", + "raft_first_layer_density": "90%", + "raft_first_layer_expansion": "5", + "raft_layers": "0", + "reduce_crossing_wall": "0", + "reduce_infill_retraction": "1", + "resolution": "0.012", + "role_based_wipe_speed": "1", + "rotate_solid_infill_direction": "1", + "scarf_angle_threshold": "155", + "scarf_joint_flow_ratio": "1", + "scarf_joint_speed": "35", + "scarf_overhang_threshold": "40%", + "seam_gap": "10%", + "seam_position": "aligned", + "seam_slope_conditional": "1", + "seam_slope_entire_loop": "0", + "seam_slope_inner_walls": "0", + "seam_slope_min_length": "10", + "seam_slope_start_height": "0", + "seam_slope_steps": "10", + "seam_slope_type": "none", + "single_extruder_multi_material_priming": "0", + "skirt_distance": "2", + "skirt_height": "1", + "skirt_loops": "0", + "skirt_speed": "50", + "slice_closing_radius": "0.049", + "slicing_mode": "regular", + "slow_down_layers": "0", + "slowdown_for_curled_perimeters": "0", + "small_area_infill_flow_compensation": "0", + "small_area_infill_flow_compensation_model": [ + "0,0", + "\n0.2,0.4444", + "\n0.4,0.6145", + "\n0.6,0.7059", + "\n0.8,0.7619", + "\n1.5,0.8571", + "\n2,0.8889", + "\n3,0.9231", + "\n5,0.9520", + "\n10,1" + ], + "small_perimeter_speed": "50%", + "small_perimeter_threshold": "0", + "solid_infill_direction": "45", + "solid_infill_filament": "1", + "sparse_infill_acceleration": "100%", + "sparse_infill_density": "15%", + "sparse_infill_filament": "1", + "sparse_infill_line_width": "0.45", + "sparse_infill_pattern": "crosshatch", + "sparse_infill_speed": "270", + "spiral_mode": "0", + "spiral_mode_max_xy_smoothing": "200%", + "spiral_mode_smooth": "0", + "staggered_inner_seams": "0", + "standby_temperature_delta": "-5", + "support_angle": "0", + "support_base_pattern": "default", + "support_base_pattern_spacing": "2.5", + "support_bottom_interface_spacing": "0.5", + "support_bottom_z_distance": "0.2", + "support_critical_regions_only": "0", + "support_expansion": "0", + "support_filament": "0", + "support_interface_bottom_layers": "2", + "support_interface_filament": "0", + "support_interface_loop_pattern": "0", + "support_interface_not_for_body": "1", + "support_interface_pattern": "auto", + "support_interface_spacing": "0.5", + "support_interface_speed": "80", + "support_interface_top_layers": "2", + "support_line_width": "0.42", + "support_object_xy_distance": "0.35", + "support_on_build_plate_only": "1", + "support_remove_small_overhang": "1", + "support_speed": "150", + "support_style": "default", + "support_threshold_angle": "30", + "support_top_z_distance": "0.18", + "support_type": "tree(auto)", + "thick_bridges": "0", + "thick_internal_bridges": "1", + "timelapse_type": "0", + "top_bottom_infill_wall_overlap": "25%", + "top_shell_layers": "5", + "top_shell_thickness": "1", + "top_solid_infill_flow_ratio": "0.97", + "top_surface_acceleration": "2000", + "top_surface_jerk": "9", + "top_surface_line_width": "0.42", + "top_surface_pattern": "monotonicline", + "top_surface_speed": "200", + "travel_acceleration": "10000", + "travel_jerk": "9", + "travel_speed": "300", + "travel_speed_z": "0", + "tree_support_adaptive_layer_height": "1", + "tree_support_angle_slow": "25", + "tree_support_auto_brim": "1", + "tree_support_branch_angle": "45", + "tree_support_branch_angle_organic": "40", + "tree_support_branch_diameter": "2", + "tree_support_branch_diameter_angle": "5", + "tree_support_branch_diameter_double_wall": "3", + "tree_support_branch_diameter_organic": "2", + "tree_support_branch_distance": "5", + "tree_support_branch_distance_organic": "1", + "tree_support_brim_width": "3", + "tree_support_tip_diameter": "0.8", + "tree_support_top_rate": "30%", + "tree_support_wall_count": "0", + "wall_direction": "auto", + "wall_distribution_count": "1", + "wall_filament": "1", + "wall_generator": "classic", + "wall_loops": "2", + "wall_sequence": "outer wall/inner wall", + "wall_transition_angle": "10", + "wall_transition_filter_deviation": "25%", + "wall_transition_length": "100%", + "wipe_before_external_loop": "0", + "wipe_on_loops": "0", + "wipe_speed": "80%", + "wipe_tower_bridging": "10", + "wipe_tower_cone_angle": "15", + "wipe_tower_extra_spacing": "120%", + "wipe_tower_extruder": "0", + "wipe_tower_max_purge_speed": "90", + "wipe_tower_no_sparse_layers": "0", + "wipe_tower_rotation_angle": "0", + "wiping_volumes_extruders": [ + "70", + "70", + "70", + "70", + "70", + "70", + "70", + "70", + "70", + "70" + ], + "xy_contour_compensation": "0", + "xy_hole_compensation": "0" +} \ No newline at end of file diff --git a/resources/profiles/Phrozen/process/fdm_process_common.json b/resources/profiles/Phrozen/process/fdm_process_common.json new file mode 100644 index 0000000000..489a8ca472 --- /dev/null +++ b/resources/profiles/Phrozen/process/fdm_process_common.json @@ -0,0 +1,107 @@ +{ + "type": "process", + "name": "fdm_process_common", + "from": "system", + "instantiation": "false", + "adaptive_layer_height": "0", + "reduce_crossing_wall": "0", + "max_travel_detour_distance": "0", + "bottom_surface_pattern": "monotonic", + "bottom_shell_thickness": "0", + "bridge_speed": "50", + "brim_width": "5", + "brim_object_gap": "0.1", + "compatible_printers": [], + "compatible_printers_condition": "", + "print_sequence": "by layer", + "default_acceleration": "1000", + "initial_layer_acceleration": "500", + "top_surface_acceleration": "800", + "travel_acceleration": "1000", + "inner_wall_acceleration": "900", + "outer_wall_acceleration": "700", + "bridge_no_support": "0", + "draft_shield": "disabled", + "elefant_foot_compensation": "0", + + "outer_wall_line_width": "0.4", + "wall_infill_order": "inner wall/outer wall/infill", + "line_width": "0.4", + "infill_direction": "45", + "sparse_infill_density": "15%", + "sparse_infill_pattern": "crosshatch", + "initial_layer_line_width": "0.5", + "initial_layer_print_height": "0.2", + "infill_combination": "0", + "sparse_infill_line_width": "0.45", + "infill_wall_overlap": "25%", + "interface_shells": "0", + "ironing_flow": "10%", + "ironing_spacing": "0.15", + "ironing_speed": "30", + "ironing_type": "no ironing", + "reduce_infill_retraction": "1", + "filename_format": "{input_filename_base}_{filament_type[initial_tool]}_{print_time}.gcode", + "detect_overhang_wall": "1", + "overhang_1_4_speed": "0", + "overhang_2_4_speed": "50", + "overhang_3_4_speed": "30", + "overhang_4_4_speed": "10", + "inner_wall_line_width": "0.45", + "wall_loops": "3", + "print_settings_id": "", + "raft_layers": "0", + "seam_position": "aligned", + "skirt_distance": "2", + "skirt_height": "1", + "skirt_loops": "0", + "minimum_sparse_infill_area": "15", + "internal_solid_infill_line_width": "0.4", + "spiral_mode": "0", + "standby_temperature_delta": "-5", + "enable_support": "0", + "resolution": "0.012", + "support_type": "normal(auto)", + "support_on_build_plate_only": "0", + "support_top_z_distance": "0.2", + "support_filament": "0", + "support_line_width": "0.4", + "support_interface_loop_pattern": "0", + "support_interface_filament": "0", + "support_interface_top_layers": "2", + "support_interface_bottom_layers": "2", + "support_interface_spacing": "0.5", + "support_interface_speed": "80", + "support_base_pattern": "rectilinear", + "support_base_pattern_spacing": "2.5", + "support_speed": "150", + "support_threshold_angle": "30", + "support_object_xy_distance": "0.35", + "tree_support_branch_angle": "30", + "tree_support_wall_count": "0", + "tree_support_with_infill": "0", + "detect_thin_wall": "0", + "top_surface_pattern": "monotonicline", + "top_surface_line_width": "0.4", + "top_shell_thickness": "0.8", + "enable_prime_tower": "0", + "wipe_tower_no_sparse_layers": "0", + "prime_tower_width": "60", + "xy_hole_compensation": "0", + "xy_contour_compensation": "0", + "layer_height": "0.2", + "bottom_shell_layers": "3", + "top_shell_layers": "4", + "bridge_flow": "1", + "initial_layer_speed": "45", + "initial_layer_infill_speed": "45", + "outer_wall_speed": "45", + "inner_wall_speed": "80", + "sparse_infill_speed": "150", + "internal_solid_infill_speed": "150", + "top_surface_speed": "50", + "gap_infill_speed": "30", + "travel_speed": "200", + "enable_arc_fitting": "0" + +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a541e7c548..91eaee8465 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -123,7 +123,7 @@ if (NOT WIN32 AND NOT APPLE) # Binary name on unix like systems (Linux, Unix) set_target_properties(OrcaSlicer PROPERTIES OUTPUT_NAME "orca-slicer") set(SLIC3R_APP_CMD "orca-slicer") - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/unix/BuildLinuxImage.sh.in ${CMAKE_CURRENT_BINARY_DIR}/BuildLinuxImage.sh @ONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/unix/build_linux_image.sh.in ${CMAKE_CURRENT_BINARY_DIR}/build_linux_image.sh USE_SOURCE_PERMISSIONS @ONLY) endif () target_link_libraries(OrcaSlicer libslic3r cereal::cereal) diff --git a/src/admesh/stlinit.cpp b/src/admesh/stlinit.cpp index 8196bf10cb..a69bd5497a 100644 --- a/src/admesh/stlinit.cpp +++ b/src/admesh/stlinit.cpp @@ -115,7 +115,6 @@ static FILE *stl_open_count_facets(stl_file *stl, const char *file, unsigned int // do another null check to be safe if (fp == nullptr) { BOOST_LOG_TRIVIAL(error) << "stl_open_count_facets: Couldn't open " << file << " for reading"; - fclose(fp); return nullptr; } @@ -228,8 +227,8 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, Impor // Read a single facet from an ASCII .STL file // skip solid/endsolid // (in this order, otherwise it won't work when they are paired in the middle of a file) - fscanf(fp, " endsolid%*[^\n]\n"); - fscanf(fp, " solid%*[^\n]\n"); // name might contain spaces so %*s doesn't work and it also can be empty (just "solid") + [[maybe_unused]] auto unused_result = fscanf(fp, " endsolid%*[^\n]\n"); + unused_result = fscanf(fp, " solid%*[^\n]\n"); // name might contain spaces so %*s doesn't work and it also can be empty (just "solid") // Leading space in the fscanf format skips all leading white spaces including numerous new lines and tabs. int res_normal = fscanf(fp, " facet normal %31s %31s %31s", normal_buf[0], normal_buf[1], normal_buf[2]); assert(res_normal == 3); @@ -244,12 +243,12 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, Impor assert(res_vertex3 == 3); // Some G-code generators tend to produce text after "endloop" and "endfacet". Just ignore it. char buf[2048]; - fgets(buf, 2047, fp); + [[maybe_unused]] auto unused_result2 = fgets(buf, 2047, fp); bool endloop_ok = strncmp(buf, "endloop", 7) == 0 && (buf[7] == '\r' || buf[7] == '\n' || buf[7] == ' ' || buf[7] == '\t'); assert(endloop_ok); // Skip the trailing whitespaces and empty lines. - fscanf(fp, " "); - fgets(buf, 2047, fp); + unused_result = fscanf(fp, " "); + unused_result2 = fgets(buf, 2047, fp); bool endfacet_ok = strncmp(buf, "endfacet", 8) == 0 && (buf[8] == '\r' || buf[8] == '\n' || buf[8] == ' ' || buf[8] == '\t'); assert(endfacet_ok); if (res_normal != 3 || res_outer_loop != 0 || res_vertex1 != 3 || res_vertex2 != 3 || res_vertex3 != 3 || ! endloop_ok || ! endfacet_ok) { diff --git a/src/clipper2/Clipper2Lib/include/clipper2/clipper.core.h b/src/clipper2/Clipper2Lib/include/clipper2/clipper.core.h index f8d6b42b78..a02ba63e3d 100644 --- a/src/clipper2/Clipper2Lib/include/clipper2/clipper.core.h +++ b/src/clipper2/Clipper2Lib/include/clipper2/clipper.core.h @@ -114,7 +114,7 @@ struct Point { Point(const T2 x_, const T2 y_) { Init(x_, y_); } template - explicit Point(const Point& p) { Init(p.x, p.y); } + explicit Point(const Point& p) { Init(p.x, p.y); } Point operator * (const double scale) const { diff --git a/src/imgui/imgui_widgets.cpp b/src/imgui/imgui_widgets.cpp index 819a76cdc8..65f0bc5260 100644 --- a/src/imgui/imgui_widgets.cpp +++ b/src/imgui/imgui_widgets.cpp @@ -43,7 +43,6 @@ Index of this file: #include #include // System includes -#include // toupper #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier #include // intptr_t #else @@ -6298,9 +6297,9 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl RenderFrameBorder(bb.Min, bb.Max, rounding); else #ifdef __APPLE__ - window->DrawList->AddRect(bb.Min - ImVec2(3, 3), bb.Max + ImVec2(3, 3), GetColorU32(ImGuiCol_FrameBg), rounding * 2,NULL,4.0f);; // Color button are often in need of some sort of border + window->DrawList->AddRect(bb.Min - ImVec2(3, 3), bb.Max + ImVec2(3, 3), GetColorU32(ImGuiCol_FrameBg), rounding * 2, 0, 4.0f); // Color button are often in need of some sort of border #else - window->DrawList->AddRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2), GetColorU32(ImGuiCol_FrameBg), rounding * 2,NULL,3.0f); // Color button are often in need of some sort of border + window->DrawList->AddRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2), GetColorU32(ImGuiCol_FrameBg), rounding * 2, 0, 3.0f); // Color button are often in need of some sort of border #endif } diff --git a/src/libslic3r/Algorithm/LineSplit.cpp b/src/libslic3r/Algorithm/LineSplit.cpp index 53ef00e0a5..d2e2ff53fd 100644 --- a/src/libslic3r/Algorithm/LineSplit.cpp +++ b/src/libslic3r/Algorithm/LineSplit.cpp @@ -200,7 +200,7 @@ SplittedLine do_split_line(const ClipperZUtils::ZPath& path, const ExPolygons& c // Chain segment back to the original path ClipperZUtils::ZPoint& front = segment.front(); - const ClipperZUtils::ZPoint* previous_src_point; + const ClipperZUtils::ZPoint* previous_src_point = nullptr; if (is_src(front)) { // The segment starts with a point from src path, which means apart from the last point, // all other points on this segment should come from the src path or the clip polygon diff --git a/src/libslic3r/Brim.cpp b/src/libslic3r/Brim.cpp index 06e7b75ea3..e865efc781 100644 --- a/src/libslic3r/Brim.cpp +++ b/src/libslic3r/Brim.cpp @@ -587,9 +587,9 @@ double getadhesionCoeff(const PrintObject* printObject) } double adhesionCoeff = 1; for (const ModelVolume* modelVolume : objectVolumes) { - for (auto iter = extrudersFirstLayer.begin(); iter != extrudersFirstLayer.end(); iter++) + for (auto iter = extrudersFirstLayer.begin(); iter != extrudersFirstLayer.end(); iter++) { if (modelVolume->extruder_id() == *iter) { - if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) + if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) { if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PETG" || Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PCTG") { adhesionCoeff = 2; @@ -597,11 +597,13 @@ double getadhesionCoeff(const PrintObject* printObject) else if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "TPU") { adhesionCoeff = 0.5; } + } } + } } return adhesionCoeff; - /* + /* def->enum_values.push_back("PLA"); def->enum_values.push_back("PET"); def->enum_values.push_back("ABS"); @@ -1653,7 +1655,7 @@ ExtrusionEntityCollection makeBrimInfill(const ExPolygons& singleBrimArea, const Polylines loops_pl = to_polylines(loops); loops_pl_by_levels.assign(loops_pl.size(), Polylines()); tbb::parallel_for(tbb::blocked_range(0, loops_pl.size()), - [&loops_pl_by_levels, &loops_pl, &islands_area](const tbb::blocked_range& range) { + [&loops_pl_by_levels, &loops_pl /*, &islands_area*/](const tbb::blocked_range& range) { for (size_t i = range.begin(); i < range.end(); ++i) { loops_pl_by_levels[i] = chain_polylines({ std::move(loops_pl[i]) }); //loops_pl_by_levels[i] = chain_polylines(intersection_pl({ std::move(loops_pl[i]) }, islands_area)); diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index 41adb363f9..b93f025e73 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -513,7 +513,7 @@ encoding_check(libslic3r) target_compile_definitions(libslic3r PUBLIC -DUSE_TBB -DTBB_USE_CAPTURED_EXCEPTION=0) target_include_directories(libslic3r PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) -target_include_directories(libslic3r PUBLIC ${EXPAT_INCLUDE_DIRS}) +target_include_directories(libslic3r SYSTEM PUBLIC ${EXPAT_INCLUDE_DIRS}) # Find the OCCT and related libraries set(OpenCASCADE_DIR "${CMAKE_PREFIX_PATH}/lib/cmake/occt") diff --git a/src/libslic3r/ClipperUtils.cpp b/src/libslic3r/ClipperUtils.cpp index 1918145c4c..7a871cea90 100644 --- a/src/libslic3r/ClipperUtils.cpp +++ b/src/libslic3r/ClipperUtils.cpp @@ -94,10 +94,10 @@ template inline void clip_clipper_polygon_with_subject_bbox_ } // Never produce just a single point output polygon. - if (!out.empty()) - if(get_entire_polygons){ + if (!out.empty()) { + if (get_entire_polygons) { out=src; - }else{ + } else { if (int sides_next = sides(out.front()); // The last point is inside. Take it. sides_this == 0 || @@ -106,7 +106,7 @@ template inline void clip_clipper_polygon_with_subject_bbox_ (sides_prev & sides_this & sides_next) == 0) out.emplace_back(src.back()); } - + } } void clip_clipper_polygon_with_subject_bbox(const Points &src, const BoundingBox &bbox, Points &out, const bool get_entire_polygons) { clip_clipper_polygon_with_subject_bbox_templ(src, bbox, out, get_entire_polygons); } diff --git a/src/libslic3r/Color.cpp b/src/libslic3r/Color.cpp index 2f593538ac..d7208d40fc 100644 --- a/src/libslic3r/Color.cpp +++ b/src/libslic3r/Color.cpp @@ -257,7 +257,7 @@ ColorRGBA complementary(const ColorRGBA& color) ColorRGB saturate(const ColorRGB& color, float factor) { - float h, s, v; + float h = 0.0, s = 0.0, v = 0.0; RGBtoHSV(color.r(), color.g(), color.b(), h, s, v); s = std::clamp(s * factor, 0.0f, 1.0f); float r, g, b; @@ -272,7 +272,7 @@ ColorRGBA saturate(const ColorRGBA& color, float factor) ColorRGB opposite(const ColorRGB& color) { - float h, s, v; + float h = 0.0, s = 0.0, v = 0.0; RGBtoHSV(color.r(), color.g(), color.b(), h, s, v); h += 65.0f; // 65 instead 60 to avoid circle values diff --git a/src/libslic3r/Fill/FillConcentric.cpp b/src/libslic3r/Fill/FillConcentric.cpp index b5a0c738c9..33863d4575 100644 --- a/src/libslic3r/Fill/FillConcentric.cpp +++ b/src/libslic3r/Fill/FillConcentric.cpp @@ -61,8 +61,8 @@ void FillConcentric::_fill_surface_single( size_t iPathFirst = polylines_out.size(); Point last_pos(0, 0); - double min_nozzle_diameter; - bool dir; + double min_nozzle_diameter = 0.0; + bool dir = false; if (this->print_config != nullptr && params.density >= STAGGER_SEAM_THRESHOLD) { min_nozzle_diameter = *std::min_element(print_config->nozzle_diameter.values.begin(), print_config->nozzle_diameter.values.end()); dir = rand() % 2; diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 08b3ebac52..d56a971ad0 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -845,9 +845,10 @@ static std::vector get_path_of_change_filament(const Print& print) // All G1 commands should be translated and rotated. X and Y coords are // only pushed to the output when they differ from last time. // WT generator can override this by appending the never_skip_tag - if (line.find("G1 ") == 0) { - bool never_skip = false; - auto it = line.find(WipeTower::never_skip_tag()); + if (line.find("G1 ") == 0 || line.find("G2 ") == 0 || line.find("G3 ") == 0) { + std::string cur_gcode_start = line.find("G1 ") == 0 ? "G1 " : (line.find("G2 ") == 0 ? "G2 " : "G3 "); + bool never_skip = false; + auto it = line.find(WipeTower::never_skip_tag()); if (it != std::string::npos) { // remove the tag and remember we saw it never_skip = true; @@ -855,7 +856,7 @@ static std::vector get_path_of_change_filament(const Print& print) } std::ostringstream line_out; std::istringstream line_str(line); - line_str >> std::noskipws; // don't skip whitespace + line_str >> std::noskipws; // don't skip whitespace char ch = 0; while (line_str >> ch) { if (ch == 'X' || ch == 'Y') @@ -869,13 +870,13 @@ static std::vector get_path_of_change_filament(const Print& print) if (transformed_pos != old_pos || never_skip) { line = line_out.str(); std::ostringstream oss; - oss << std::fixed << std::setprecision(3) << "G1 "; + oss << std::fixed << std::setprecision(3) << cur_gcode_start; if (transformed_pos.x() != old_pos.x() || never_skip) oss << " X" << transformed_pos.x() - extruder_offset.x(); if (transformed_pos.y() != old_pos.y() || never_skip) oss << " Y" << transformed_pos.y() - extruder_offset.y(); oss << " "; - line.replace(line.find("G1 "), 3, oss.str()); + line.replace(line.find(cur_gcode_start), 3, oss.str()); old_pos = transformed_pos; } } diff --git a/src/libslic3r/GCode/FanMover.cpp b/src/libslic3r/GCode/FanMover.cpp index b21711b5a7..10ecfd8827 100644 --- a/src/libslic3r/GCode/FanMover.cpp +++ b/src/libslic3r/GCode/FanMover.cpp @@ -421,11 +421,12 @@ void FanMover::_process_gcode_line(GCodeReader& reader, const GCodeReader::GCode current_role = ExtrusionEntity::string_to_role(extrusion_string); } if (line.raw().size() > 16) { - if (line.raw().rfind("; custom gcode", 0) != std::string::npos) + if (line.raw().rfind("; custom gcode", 0) != std::string::npos) { if (line.raw().rfind("; custom gcode end", 0) != std::string::npos) m_is_custom_gcode = false; else m_is_custom_gcode = true; + } } } } diff --git a/src/libslic3r/GCode/WipeTower2.cpp b/src/libslic3r/GCode/WipeTower2.cpp index d9a4a9c0f0..9decfc4c96 100644 --- a/src/libslic3r/GCode/WipeTower2.cpp +++ b/src/libslic3r/GCode/WipeTower2.cpp @@ -24,6 +24,526 @@ namespace Slic3r { + float flat_iron_area = 4.f; +constexpr float flat_iron_speed = 10.f * 60.f; +static const double wipe_tower_wall_infill_overlap = 0.0; +static constexpr double WIPE_TOWER_RESOLUTION = 0.1; +static constexpr double WT_SIMPLIFY_TOLERANCE_SCALED = 0.001f / SCALING_FACTOR_INTERNAL; +static constexpr int arc_fit_size = 20; +#define SCALED_WIPE_TOWER_RESOLUTION (WIPE_TOWER_RESOLUTION / SCALING_FACTOR_INTERNAL) +enum class LimitFlow { None, LimitPrintFlow, LimitRammingFlow }; +static const std::map nozzle_diameter_to_nozzle_change_width{{0.2f, 0.5f}, {0.4f, 1.0f}, {0.6f, 1.2f}, {0.8f, 1.4f}}; + +inline float align_round(float value, float base) { return std::round(value / base) * base; } + +inline float align_ceil(float value, float base) { return std::ceil(value / base) * base; } + +inline float align_floor(float value, float base) { return std::floor((value) / base) * base; } + +static bool is_valid_gcode(const std::string& gcode) +{ + int str_size = gcode.size(); + int start_index = 0; + int end_index = 0; + bool is_valid = false; + while (end_index < str_size) { + if (gcode[end_index] != '\n') { + end_index++; + continue; + } + + if (end_index > start_index) { + std::string line_str = gcode.substr(start_index, end_index - start_index); + line_str.erase(0, line_str.find_first_not_of(" ")); + line_str.erase(line_str.find_last_not_of(" ") + 1); + if (!line_str.empty() && line_str[0] != ';') { + is_valid = true; + break; + } + } + + start_index = end_index + 1; + end_index = start_index; + } + + return is_valid; +} + +Polygon chamfer_polygon(Polygon& polygon, double chamfer_dis = 2., double angle_tol = 30. / 180. * PI) +{ + if (polygon.points.size() < 3) + return polygon; + Polygon res; + res.points.reserve(polygon.points.size() * 2); + int mod = polygon.points.size(); + double cos_angle_tol = abs(std::cos(angle_tol)); + + for (int i = 0; i < polygon.points.size(); i++) { + Vec2d a = unscaled(polygon.points[(i - 1 + mod) % mod]); + Vec2d b = unscaled(polygon.points[i]); + Vec2d c = unscaled(polygon.points[(i + 1) % mod]); + double ab_len = (a - b).norm(); + double bc_len = (b - c).norm(); + Vec2d ab = (b - a) / ab_len; + Vec2d bc = (c - b) / bc_len; + assert(ab_len != 0); + assert(bc_len != 0); + float cosangle = ab.dot(bc); + // std::cout << " angle " << acos(cosangle) << " cosangle " << cosangle << std::endl; + // std::cout << " ab_len " << ab_len << " bc_len " << bc_len << std::endl; + if (abs(cosangle) < cos_angle_tol) { + float real_chamfer_dis = std::min({chamfer_dis, ab_len / 2.1, bc_len / 2.1}); // 2.1 to ensure the points do not coincide + Vec2d left = b - ab * real_chamfer_dis; + Vec2d right = b + bc * real_chamfer_dis; + res.points.push_back(scaled(left)); + res.points.push_back(scaled(right)); + } else + res.points.push_back(polygon.points[i]); + } + res.points.shrink_to_fit(); + return res; +} + +Polygon rounding_polygon(Polygon& polygon, double rounding = 2., double angle_tol = 30. / 180. * PI) +{ + if (polygon.points.size() < 3) + return polygon; + Polygon res; + res.points.reserve(polygon.points.size() * 2); + int mod = polygon.points.size(); + double cos_angle_tol = abs(std::cos(angle_tol)); + + for (int i = 0; i < polygon.points.size(); i++) { + Vec2d a = unscaled(polygon.points[(i - 1 + mod) % mod]); + Vec2d b = unscaled(polygon.points[i]); + Vec2d c = unscaled(polygon.points[(i + 1) % mod]); + double ab_len = (a - b).norm(); + double bc_len = (b - c).norm(); + Vec2d ab = (b - a) / ab_len; + Vec2d bc = (c - b) / bc_len; + assert(ab_len != 0); + assert(bc_len != 0); + float cosangle = ab.dot(bc); + cosangle = std::clamp(cosangle, -1.f, 1.f); + bool is_ccw = cross2(ab, bc) > 0; + if (abs(cosangle) < cos_angle_tol) { + float real_rounding_dis = std::min({rounding, ab_len / 2.1, bc_len / 2.1}); // 2.1 to ensure the points do not coincide + Vec2d left = b - ab * real_rounding_dis; + Vec2d right = b + bc * real_rounding_dis; + // Point r_left = scaled(left); + // Point r_right = scaled(right); + // std::cout << " r_left " << r_left[0] << " " << r_left[1] << std::endl; + // std::cout << " r_right " << r_right[0] << " " << r_right[1] << std::endl; + { + float half_angle = std::acos(cosangle) / 2.f; + // std::cout << " half_angle " << cos(half_angle) << std::endl; + + Vec2d dir = (right - left).normalized(); + dir = Vec2d{-dir[1], dir[0]}; + dir = is_ccw ? dir : -dir; + double dis = real_rounding_dis / sin(half_angle); + // std::cout << " dis " << dis << std::endl; + + Vec2d center = b + dir * dis; + double radius = (left - center).norm(); + ArcSegment arc(scaled(center), scaled(radius), scaled(left), scaled(right), + is_ccw ? ArcDirection::Arc_Dir_CCW : ArcDirection::Arc_Dir_CW); + int n = arc_fit_size; + // std::cout << "start " << arc.start_point[0] << " " << arc.start_point[1] << std::endl; + // std::cout << "end " << arc.end_point[0] << " " << arc.end_point[1] << std::endl; + // std::cout << "start angle " << arc.polar_start_theta << " end angle " << arc.polar_end_theta << std::endl; + for (int j = 0; j < n; j++) { + float cur_angle = arc.polar_start_theta + (float) j / n * arc.angle_radians; + // std::cout << " cur_angle " << cur_angle << std::endl; + if (cur_angle > 2 * PI) + cur_angle -= 2 * PI; + else if (cur_angle < 0) + cur_angle += 2 * PI; + Point tmp = arc.center + Point{arc.radius * std::cos(cur_angle), arc.radius * std::sin(cur_angle)}; + // std::cout << "j = " << j << std::endl; + // std::cout << "tmp = " << tmp[0]<<" "< 0; + if (abs(cosangle) < cos_angle_tol) { + float real_rounding_dis = std::min({rounding, ab_len / 2.1, bc_len / 2.1}); // 2.1 to ensure the points do not coincide + Vec2d left = b - ab * real_rounding_dis; + Vec2d right = b + bc * real_rounding_dis; + // Point r_left = scaled(left); + // Point r_right = scaled(right); + // std::cout << " r_left " << r_left[0] << " " << r_left[1] << std::endl; + // std::cout << " r_right " << r_right[0] << " " << r_right[1] << std::endl; + { + Vec2d center = b; + double radius = real_rounding_dis; + ArcSegment arc(scaled(center), scaled(radius), scaled(left), scaled(right), + is_ccw ? ArcDirection::Arc_Dir_CCW : ArcDirection::Arc_Dir_CW); + int n = arc_fit_size; + // std::cout << "start " << arc.start_point[0] << " " << arc.start_point[1] << std::endl; + // std::cout << "end " << arc.end_point[0] << " " << arc.end_point[1] << std::endl; + // std::cout << "start angle " << arc.polar_start_theta << " end angle " << arc.polar_end_theta << std::endl; + for (int j = 0; j < n; j++) { + float cur_angle = arc.polar_start_theta + (float) j / n * arc.angle_radians; + // std::cout << " cur_angle " << cur_angle << std::endl; + if (cur_angle > 2 * PI) + cur_angle -= 2 * PI; + else if (cur_angle < 0) + cur_angle += 2 * PI; + Point tmp = arc.center + Point{arc.radius * std::cos(cur_angle), arc.radius * std::sin(cur_angle)}; + // std::cout << "j = " << j << std::endl; + // std::cout << "tmp = " << tmp[0]<<" "< ray_intersetion_line(const Vec2f& a, const Vec2f& v1, const Vec2f& b, const Vec2f& c) +{ + const Vec2f v2 = c - b; + double denom = cross2(v1, v2); + if (fabs(denom) < EPSILON) + return {false, Vec2f(0, 0)}; + const Vec2f v12 = (a - b); + double nume_a = cross2(v2, v12); + double nume_b = cross2(v1, v12); + double t1 = nume_a / denom; + double t2 = nume_b / denom; + if (t1 >= 0 && t2 >= 0 && t2 <= 1.) { + // Get the intersection point. + Vec2f res = a + t1 * v1; + return std::pair(true, res); + } + return std::pair(false, Vec2f{0, 0}); +} +Polygon scale_polygon(const std::vector& points) +{ + Polygon res; + for (const auto& p : points) + res.points.push_back(scaled(p)); + return res; +} +std::vector unscale_polygon(const Polygon& polygon) +{ + std::vector res; + for (const auto& p : polygon.points) + res.push_back(unscaled(p)); + return res; +} + +Polygon generate_rectange(const Line& line, coord_t offset) +{ + Point p1 = line.a; + Point p2 = line.b; + + double dx = p2.x() - p1.x(); + double dy = p2.y() - p1.y(); + + double length = std::sqrt(dx * dx + dy * dy); + + double ux = dx / length; + double uy = dy / length; + + double vx = -uy; + double vy = ux; + + double ox = vx * offset; + double oy = vy * offset; + + Points rect; + rect.resize(4); + rect[0] = {p1.x() + ox, p1.y() + oy}; + rect[1] = {p1.x() - ox, p1.y() - oy}; + rect[2] = {p2.x() - ox, p2.y() - oy}; + rect[3] = {p2.x() + ox, p2.y() + oy}; + Polygon poly(rect); + return poly; +}; + +struct Segment +{ + Vec2f start; + Vec2f end; + bool is_arc = false; + ArcSegment arcsegment; + Segment(const Vec2f& s, const Vec2f& e) : start(s), end(e) {} + bool is_valid() const { return start.y() < end.y(); } +}; + +std::vector remove_points_from_segment(const Segment& segment, const std::vector& skip_points, double range) +{ + std::vector result; + result.push_back(segment); + float x = segment.start.x(); + + for (const Vec2f& point : skip_points) { + std::vector newResult; + for (const auto& seg : result) { + if (point.y() + range <= seg.start.y() || point.y() - range >= seg.end.y()) { + newResult.push_back(seg); + } else { + if (point.y() - range > seg.start.y()) { + newResult.push_back(Segment(Vec2f(x, seg.start.y()), Vec2f(x, point.y() - range))); + } + if (point.y() + range < seg.end.y()) { + newResult.push_back(Segment(Vec2f(x, point.y() + range), Vec2f(x, seg.end.y()))); + } + } + } + + result = newResult; + } + + result.erase(std::remove_if(result.begin(), result.end(), [](const Segment& seg) { return !seg.is_valid(); }), result.end()); + return result; +} + +struct IntersectionInfo +{ + Vec2f pos; + int idx; + int pair_idx; // gap_pair idx + float dis_from_idx; + bool is_forward; +}; + +struct PointWithFlag +{ + Vec2f pos; + int pair_idx; // gap_pair idx + bool is_forward; +}; +IntersectionInfo move_point_along_polygon( + const std::vector& points, const Vec2f& startPoint, int startIdx, float offset, bool forward, int pair_idx) +{ + float remainingDistance = offset; + IntersectionInfo res; + int mod = points.size(); + if (forward) { + int next = (startIdx + 1) % mod; + remainingDistance -= (points[next] - startPoint).norm(); + if (remainingDistance <= 0) { + res.idx = startIdx; + res.pos = startPoint + (points[next] - startPoint).normalized() * offset; + res.pair_idx = pair_idx; + res.dis_from_idx = (points[startIdx] - res.pos).norm(); + return res; + } else { + for (int i = (startIdx + 1) % mod; i != startIdx; i = (i + 1) % mod) { + float segmentLength = (points[(i + 1) % mod] - points[i]).norm(); + if (remainingDistance <= segmentLength) { + float ratio = remainingDistance / segmentLength; + res.idx = i; + res.pos = points[i] + ratio * (points[(i + 1) % mod] - points[i]); + res.dis_from_idx = remainingDistance; + res.pair_idx = pair_idx; + return res; + } + remainingDistance -= segmentLength; + } + res.idx = (startIdx - 1 + mod) % mod; + res.pos = points[startIdx]; + res.pair_idx = pair_idx; + res.dis_from_idx = (res.pos - points[res.idx]).norm(); + } + } else { + int next = (startIdx + 1) % mod; + remainingDistance -= (points[startIdx] - startPoint).norm(); + if (remainingDistance <= 0) { + res.idx = startIdx; + res.pos = startPoint - (points[next] - points[startIdx]).normalized() * offset; + res.dis_from_idx = (res.pos - points[startIdx]).norm(); + res.pair_idx = pair_idx; + return res; + } + for (int i = (startIdx - 1 + mod) % mod; i != startIdx; i = (i - 1 + mod) % mod) { + float segmentLength = (points[(i + 1) % mod] - points[i]).norm(); + if (remainingDistance <= segmentLength) { + float ratio = remainingDistance / segmentLength; + res.idx = i; + res.pos = points[(i + 1) % mod] - ratio * (points[(i + 1) % mod] - points[i]); + res.dis_from_idx = segmentLength - remainingDistance; + res.pair_idx = pair_idx; + return res; + } + remainingDistance -= segmentLength; + } + res.idx = startIdx; + res.pos = points[res.idx]; + res.pair_idx = pair_idx; + res.dis_from_idx = 0; + } + return res; +}; + +void insert_points(std::vector& pl, int idx, Vec2f pos, int pair_idx, bool is_forward) +{ + int next = (idx + 1) % pl.size(); + Vec2f pos1 = pl[idx].pos; + Vec2f pos2 = pl[next].pos; + if ((pos - pos1).squaredNorm() < EPSILON) { + pl[idx].pair_idx = pair_idx; + pl[idx].is_forward = is_forward; + } else if ((pos - pos2).squaredNorm() < EPSILON) { + pl[next].pair_idx = pair_idx; + pl[next].is_forward = is_forward; + } else { + pl.insert(pl.begin() + idx + 1, PointWithFlag{pos, pair_idx, is_forward}); + } +} + +Polylines remove_points_from_polygon( + const Polygon& polygon, const std::vector& skip_points, double range, bool is_left, Polygon& insert_skip_pg) +{ + assert(polygon.size() > 2); + Polylines result; + std::vector new_pl; // add intersection points for gaps, where bool indicates whether it's a gap point. + std::vector inter_info; + Vec2f ray = is_left ? Vec2f(-1, 0) : Vec2f(1, 0); + auto polygon_box = get_extents(polygon); + Point anchor_point = is_left ? Point{polygon_box.max[0], polygon_box.min[1]} : polygon_box.min; // rd:ld + std::vector points; + { + points.reserve(polygon.points.size()); + int idx = polygon.closest_point_index(anchor_point); + Polyline tmp_poly = polygon.split_at_index(idx); + for (auto& p : tmp_poly) + points.push_back(unscale(p).cast()); + points.pop_back(); + } + + for (int i = 0; i < skip_points.size(); i++) { + for (int j = 0; j < points.size(); j++) { + Vec2f& p1 = points[j]; + Vec2f& p2 = points[(j + 1) % points.size()]; + auto [is_inter, inter_pos] = ray_intersetion_line(skip_points[i], ray, p1, p2); + if (is_inter) { + IntersectionInfo forward = move_point_along_polygon(points, inter_pos, j, range, true, i); + IntersectionInfo backward = move_point_along_polygon(points, inter_pos, j, range, false, i); + backward.is_forward = false; + forward.is_forward = true; + inter_info.push_back(backward); + inter_info.push_back(forward); + break; + } + } + } + + // insert point to new_pl + for (const auto& p : points) + new_pl.push_back({p, -1}); + std::sort(inter_info.begin(), inter_info.end(), [](const IntersectionInfo& lhs, const IntersectionInfo& rhs) { + if (rhs.idx == lhs.idx) + return lhs.dis_from_idx < rhs.dis_from_idx; + return lhs.idx < rhs.idx; + }); + for (int i = inter_info.size() - 1; i >= 0; i--) { + insert_points(new_pl, inter_info[i].idx, inter_info[i].pos, inter_info[i].pair_idx, inter_info[i].is_forward); + } + + { + // set insert_pg for wipe_path + for (auto& p : new_pl) + insert_skip_pg.points.push_back(scaled(p.pos)); + } + + int beg = 0; + bool skip = true; + int i = beg; + Polyline pl; + + do { + if (skip || new_pl[i].pair_idx == -1) { + pl.points.push_back(scaled(new_pl[i].pos)); + i = (i + 1) % new_pl.size(); + skip = false; + } else { + if (!pl.points.empty()) { + pl.points.push_back(scaled(new_pl[i].pos)); + result.push_back(pl); + pl.points.clear(); + } + int left = new_pl[i].pair_idx; + int j = (i + 1) % new_pl.size(); + while (j != beg && new_pl[j].pair_idx != left) { + if (new_pl[j].pair_idx != -1 && !new_pl[j].is_forward) + left = new_pl[j].pair_idx; + j = (j + 1) % new_pl.size(); + } + i = j; + skip = true; + } + } while (i != beg); + + if (!pl.points.empty()) { + if (new_pl[i].pair_idx == -1) + pl.points.push_back(scaled(new_pl[i].pos)); + result.push_back(pl); + } + return result; +} + +Polylines contrust_gap_for_skip_points( + const Polygon& polygon, const std::vector& skip_points, float wt_width, float gap_length, Polygon& insert_skip_polygon) +{ + if (skip_points.empty()) { + insert_skip_polygon = polygon; + return Polylines{to_polyline(polygon)}; + } + bool is_left = false; + const auto& pt = skip_points.front(); + if (abs(pt.x()) < wt_width / 2.f) { + is_left = true; + } + return remove_points_from_polygon(polygon, skip_points, gap_length, is_left, insert_skip_polygon); +}; + +Polygon generate_rectange_polygon(const Vec2f& wt_box_min, const Vec2f& wt_box_max) +{ + Polygon res; + res.points.push_back(scaled(wt_box_min)); + res.points.push_back(scaled(Vec2f{wt_box_max[0], wt_box_min[1]})); + res.points.push_back(scaled(wt_box_max)); + res.points.push_back(scaled(Vec2f{wt_box_min[0], wt_box_max[1]})); + return res; +} + // Calculates length of extrusion line to extrude given volume static float volume_to_length(float volume, float line_width, float layer_height) { @@ -41,7 +561,12 @@ static float length_to_volume(float length, float line_width, float layer_height class WipeTowerWriter2 { public: - WipeTowerWriter2(float layer_height, float line_width, GCodeFlavor flavor, const std::vector& filament_parameters) : + WipeTowerWriter2(float layer_height, + float line_width, + GCodeFlavor flavor, + const std::vector& filament_parameters, + bool enable_arc_fitting) + : m_current_pos(std::numeric_limits::max(), std::numeric_limits::max()), m_current_z(0.f), m_current_feedrate(0.f), @@ -49,8 +574,8 @@ public: m_extrusion_flow(0.f), m_preview_suppressed(false), m_elapsed_time(0.f), - m_gcode_flavor(flavor), - m_filpar(filament_parameters) + m_gcode_flavor(flavor), m_filpar(filament_parameters) + //m_enable_arc_fitting(enable_arc_fitting) { // ORCA: This class is only used by non BBL printers, so set the parameter appropriately. // This fixes an issue where the wipe tower was using BBL tags resulting in statistics for purging in the purge tower not being displayed. @@ -447,6 +972,162 @@ public: return add_wipe_point(Vec2f(x, y)); } + // Extrude with an explicitely provided amount of extrusion. + WipeTowerWriter2& extrude_arc_explicit(ArcSegment& arc, + float f = 0.f, + bool record_length = false, + LimitFlow limit_flow = LimitFlow::LimitPrintFlow) + { + float x = (float) unscale(arc.end_point).x(); + float y = (float) unscale(arc.end_point).y(); + float len = unscaled(arc.length); + float e = len * m_extrusion_flow; + if (len < (float) EPSILON && e == 0.f && (f == 0.f || f == m_current_feedrate)) + // Neither extrusion nor a travel move. + return *this; + if (record_length) + m_used_filament_length += e; + + // Now do the "internal rotation" with respect to the wipe tower center + Vec2f rotated_current_pos(this->pos_rotated()); + Vec2f rot(this->rotate(Vec2f(x, y))); // this is where we want to go + + if (!m_preview_suppressed && e > 0.f && len > 0.f) { +#if ENABLE_GCODE_VIEWER_DATA_CHECKING + change_analyzer_mm3_per_mm(len, e); +#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING + // Width of a squished extrusion, corrected for the roundings of the squished extrusions. + // This is left zero if it is a travel move. + float width = e * m_filpar[0].filament_area / (len * m_layer_height); + // Correct for the roundings of a squished extrusion. + width += m_layer_height * float(1. - M_PI / 4.); + if (m_extrusions.empty() || m_extrusions.back().pos != rotated_current_pos) + m_extrusions.emplace_back(WipeTower::Extrusion(rotated_current_pos, 0, m_current_tool)); + { + int n = arc_fit_size; + for (int j = 0; j < n; j++) { + float cur_angle = arc.polar_start_theta + (float) j / n * arc.angle_radians; + if (cur_angle > 2 * PI) + cur_angle -= 2 * PI; + else if (cur_angle < 0) + cur_angle += 2 * PI; + Point tmp = arc.center + Point{arc.radius * std::cos(cur_angle), arc.radius * std::sin(cur_angle)}; + m_extrusions.emplace_back(WipeTower::Extrusion(this->rotate(unscaled(tmp)), width, m_current_tool)); + } + m_extrusions.emplace_back(WipeTower::Extrusion(rot, width, m_current_tool)); + } + } + + //if (e == 0.f) { + // m_gcode += set_travel_acceleration(); + //} else { + // m_gcode += set_normal_acceleration(); + //} + + m_gcode += arc.direction == ArcDirection::Arc_Dir_CCW ? "G3" : "G2"; + const Vec2f center_offset = this->rotate(unscaled(arc.center)) - rotated_current_pos; + m_gcode += set_format_X(rot.x()); + m_gcode += set_format_Y(rot.y()); + m_gcode += set_format_I(center_offset.x()); + m_gcode += set_format_J(center_offset.y()); + + if (e != 0.f) + m_gcode += set_format_E(e); + + if (f != 0.f && f != m_current_feedrate) { + if (limit_flow != LimitFlow::None) { + float e_speed = e / (((len == 0.f) ? std::abs(e) : len) / f * 60.f); + float tmp = m_filpar[m_current_tool].max_e_speed; + //if (limit_flow == LimitFlow::LimitRammingFlow) + // tmp = m_filpar[m_current_tool].max_e_ramming_speed; + f /= std::max(1.f, e_speed / tmp); + } + m_gcode += set_format_F(f); + } + + m_current_pos.x() = x; + m_current_pos.y() = y; + + // Update the elapsed time with a rough estimate. + m_elapsed_time += ((len == 0.f) ? std::abs(e) : len) / m_current_feedrate * 60.f; + m_gcode += "\n"; + return *this; + } + + WipeTowerWriter2& extrude_arc(ArcSegment& arc, float f = 0.f, LimitFlow limit_flow = LimitFlow::LimitPrintFlow) + { + return extrude_arc_explicit(arc, f, false, limit_flow); + } + + void generate_path(Polylines& pls, float feedrate, float retract_length, float retract_speed, bool used_fillet) + { + auto get_closet_idx = [this](std::vector& corners) -> int { + Vec2f anchor{this->m_current_pos.x(), this->m_current_pos.y()}; + int closestIndex = -1; + float minDistance = std::numeric_limits::max(); + for (int i = 0; i < corners.size(); ++i) { + float distance = (corners[i].start - anchor).squaredNorm(); + if (distance < minDistance) { + minDistance = distance; + closestIndex = i; + } + } + return closestIndex; + }; + std::vector segments; + if (m_enable_arc_fitting) { + for (auto& pl : pls) + pl.simplify_by_fitting_arc(SCALED_WIPE_TOWER_RESOLUTION); + + for (const auto& pl : pls) { + if (pl.points.size() < 2) + continue; + for (int i = 0; i < pl.fitting_result.size(); i++) { + if (pl.fitting_result[i].path_type == EMovePathType::Linear_move) { + for (int j = pl.fitting_result[i].start_point_index; j < pl.fitting_result[i].end_point_index; j++) + segments.push_back({unscaled(pl.points[j]), unscaled(pl.points[j + 1])}); + } else { + int beg = pl.fitting_result[i].start_point_index; + int end = pl.fitting_result[i].end_point_index; + segments.push_back({unscaled(pl.points[beg]), unscaled(pl.points[end])}); + segments.back().is_arc = true; + segments.back().arcsegment = pl.fitting_result[i].arc_data; + } + } + } + for (auto& pl : pls) + pl.simplify(SCALED_WIPE_TOWER_RESOLUTION); + + } else { + for (const auto& pl : pls) { + if (pl.points.size() < 2) + continue; + for (int i = 0; i < pl.size() - 1; i++) { + segments.push_back({unscaled(pl.points[i]), unscaled(pl.points[i + 1])}); + } + } + } + + int index_of_closest = get_closet_idx(segments); + int i = index_of_closest; + travel(segments[i].start); // travel to the closest points + segments[i].is_arc ? extrude_arc(segments[i].arcsegment, feedrate) : extrude(segments[i].end, feedrate); + do { + i = (i + 1) % segments.size(); + if (i == index_of_closest) + break; + float dx = segments[i].start.x() - m_current_pos.x(); + float dy = segments[i].start.y() - m_current_pos.y(); + float len = std::sqrt(dx * dx + dy * dy); + if (len > EPSILON) { + retract(retract_length, retract_speed); + travel(segments[i].start, 600.); + retract(-retract_length, retract_speed); + } + segments[i].is_arc ? extrude_arc(segments[i].arcsegment, feedrate) : extrude(segments[i].end, feedrate); + } while (1); + } + private: Vec2f m_start_pos; Vec2f m_current_pos; @@ -468,6 +1149,7 @@ private: int current_temp = -1; float m_used_filament_length = 0.f; GCodeFlavor m_gcode_flavor; + bool m_enable_arc_fitting = false; const std::vector& m_filpar; std::string set_format_X(float x) @@ -495,6 +1177,8 @@ private: m_current_feedrate = f; return buf; } + std::string set_format_I(float i) { return " I" + Slic3r::float_to_string_decimal_point(i, 3); } + std::string set_format_J(float j) { return " J" + Slic3r::float_to_string_decimal_point(j, 3); } WipeTowerWriter2& operator=(const WipeTowerWriter2 &rhs); @@ -556,8 +1240,12 @@ WipeTower2::WipeTower2(const PrintConfig& config, const PrintRegionConfig& defau m_infill_speed(default_region_config.sparse_infill_speed), m_perimeter_speed(default_region_config.inner_wall_speed), m_current_tool(initial_tool), - wipe_volumes(wiping_matrix), - m_wipe_tower_max_purge_speed(float(config.wipe_tower_max_purge_speed)) + wipe_volumes(wiping_matrix), m_wipe_tower_max_purge_speed(float(config.wipe_tower_max_purge_speed)), + m_enable_arc_fitting(config.enable_arc_fitting), + m_used_fillet(config.wipe_tower_fillet_wall), + m_rib_width(config.wipe_tower_rib_width), + m_extra_rib_length(config.wipe_tower_extra_rib_length), + m_wall_type((int)config.wipe_tower_wall_type) { // Read absolute value of first layer speed, if given as percentage, // it is taken over following default. Speeds from config are not @@ -676,6 +1364,9 @@ void WipeTower2::set_extruder(size_t idx, const PrintConfig& config) } m_used_filament_length.resize(std::max(m_used_filament_length.size(), idx + 1)); // makes sure that the vector is big enough so we don't have to check later + + m_filpar[idx].retract_length = config.retraction_length.get_at(idx); + m_filpar[idx].retract_speed = config.retraction_speed.get_at(idx); } @@ -714,7 +1405,7 @@ std::vector WipeTower2::prime( for (size_t idx_tool = 0; idx_tool < tools.size(); ++ idx_tool) { size_t old_tool = m_current_tool; - WipeTowerWriter2 writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar); + WipeTowerWriter2 writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar, m_enable_arc_fitting); writer.set_extrusion_flow(m_extrusion_flow) .set_z(m_z_pos) .set_initial_tool(m_current_tool); @@ -809,7 +1500,7 @@ WipeTower::ToolChangeResult WipeTower2::tool_change(size_t tool) (tool != (unsigned int)(-1) ? wipe_area+m_depth_traversed-0.5f*m_perimeter_width : m_wipe_tower_depth-m_perimeter_width)); - WipeTowerWriter2 writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar); + WipeTowerWriter2 writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar, m_enable_arc_fitting); writer.set_extrusion_flow(m_extrusion_flow) .set_z(m_z_pos) .set_initial_tool(m_current_tool) @@ -1237,7 +1928,7 @@ WipeTower::ToolChangeResult WipeTower2::finish_layer() size_t old_tool = m_current_tool; - WipeTowerWriter2 writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar); + WipeTowerWriter2 writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar, m_enable_arc_fitting); writer.set_extrusion_flow(m_extrusion_flow) .set_z(m_z_pos) .set_initial_tool(m_current_tool) @@ -1257,8 +1948,6 @@ WipeTower::ToolChangeResult WipeTower2::finish_layer() m_wipe_tower_width, m_wipe_tower_depth, m_internal_rotation); bool toolchanges_on_layer = m_layer_info->toolchanges_depth() > WT_EPSILON; - WipeTower::box_coordinates wt_box(Vec2f(0.f, (m_current_shape == SHAPE_REVERSED ? m_layer_info->toolchanges_depth() : 0.f)), - m_wipe_tower_width, m_layer_info->depth + m_perimeter_width); // inner perimeter of the sparse section, if there is space for it: if (fill_box.ru.y() - fill_box.rd.y() > m_perimeter_width - WT_EPSILON) @@ -1275,9 +1964,9 @@ WipeTower::ToolChangeResult WipeTower2::finish_layer() if (dy > m_perimeter_width) { writer.travel(fill_box.ld + Vec2f(m_perimeter_width * 2, 0.f)) - .append(";--------------------\n" - "; CP EMPTY GRID START\n") - .comment_with_value(" layer #", m_num_layer_changes + 1); + .append(";--------------------\n" + "; CP EMPTY GRID START\n") + .comment_with_value(" layer #", m_num_layer_changes + 1); // Is there a soluble filament wiped/rammed at the next layer? // If so, the infill should not be sparse. @@ -1285,10 +1974,10 @@ WipeTower::ToolChangeResult WipeTower2::finish_layer() ? false : std::any_of((m_layer_info+1)->tool_changes.begin(), (m_layer_info+1)->tool_changes.end(), - [this](const WipeTowerInfo::ToolChange& tch) { + [this](const WipeTowerInfo::ToolChange& tch) { return m_filpar[tch.new_tool].is_soluble || m_filpar[tch.old_tool].is_soluble; - }); + }); solid_infill |= first_layer && m_adhesion; if (solid_infill) { @@ -1326,118 +2015,23 @@ WipeTower::ToolChangeResult WipeTower2::finish_layer() } const float spacing = m_perimeter_width - m_layer_height*float(1.-M_PI_4); - - // This block creates the stabilization cone. - // First define a lambda to draw the rectangle with stabilization. - auto supported_rectangle = [this, &writer, spacing](const WipeTower::box_coordinates& wt_box, double feedrate, bool infill_cone) -> Polygon { - const auto [R, support_scale] = get_wipe_tower_cone_base(m_wipe_tower_width, m_wipe_tower_height, m_wipe_tower_depth, m_wipe_tower_cone_angle); - - double z = m_no_sparse_layers ? (m_current_height + m_layer_info->height) : m_layer_info->z; // the former should actually work in both cases, but let's stay on the safe side (the 2.6.0 is close) - - double r = std::tan(Geometry::deg2rad(m_wipe_tower_cone_angle/2.f)) * (m_wipe_tower_height - z); - Vec2f center = (wt_box.lu + wt_box.rd) / 2.; - double w = wt_box.lu.y() - wt_box.ld.y(); - enum Type { - Arc, - Corner, - ArcStart, - ArcEnd - }; - - // First generate vector of annotated point which form the boundary. - std::vector> pts = {{wt_box.ru, Corner}}; - if (double alpha_start = std::asin((0.5*w)/r); ! std::isnan(alpha_start) && r > 0.5*w+0.01) { - for (double alpha = alpha_start; alpha < M_PI-alpha_start+0.001; alpha+=(M_PI-2*alpha_start) / 40.) - pts.emplace_back(Vec2f(center.x() + r*std::cos(alpha)/support_scale, center.y() + r*std::sin(alpha)), alpha == alpha_start ? ArcStart : Arc); - pts.back().second = ArcEnd; - } - pts.emplace_back(wt_box.lu, Corner); - pts.emplace_back(wt_box.ld, Corner); - for (int i=int(pts.size())-3; i>0; --i) - pts.emplace_back(Vec2f(pts[i].first.x(), 2*center.y()-pts[i].first.y()), i == int(pts.size())-3 ? ArcStart : i == 1 ? ArcEnd : Arc); - pts.emplace_back(wt_box.rd, Corner); - - // Create a Polygon from the points. - Polygon poly; - for (const auto& [pt, tag] : pts) - poly.points.push_back(Point::new_scale(pt)); - - // Prepare polygons to be filled by infill. - Polylines polylines; - if (infill_cone && m_wipe_tower_width > 2*spacing && m_wipe_tower_depth > 2*spacing) { - ExPolygons infill_areas; - ExPolygon wt_contour(poly); - Polygon wt_rectangle(Points{Point::new_scale(wt_box.ld), Point::new_scale(wt_box.rd), Point::new_scale(wt_box.ru), Point::new_scale(wt_box.lu)}); - wt_rectangle = offset(wt_rectangle, scale_(-spacing/2.)).front(); - wt_contour = offset_ex(wt_contour, scale_(-spacing/2.)).front(); - infill_areas = diff_ex(wt_contour, wt_rectangle); - if (infill_areas.size() == 2) { - ExPolygon& bottom_expoly = infill_areas.front().contour.points.front().y() < infill_areas.back().contour.points.front().y() ? infill_areas[0] : infill_areas[1]; - std::unique_ptr filler(Fill::new_from_type(ipMonotonicLine)); - filler->angle = Geometry::deg2rad(45.f); - filler->spacing = spacing; - FillParams params; - params.density = 1.f; - Surface surface(stBottom, bottom_expoly); - filler->bounding_box = get_extents(bottom_expoly); - polylines = filler->fill_surface(&surface, params); - if (! polylines.empty()) { - if (polylines.front().points.front().x() > polylines.back().points.back().x()) { - std::reverse(polylines.begin(), polylines.end()); - for (Polyline& p : polylines) - p.reverse(); - } - } - } - } - - // Find the closest corner and travel to it. - int start_i = 0; - double min_dist = std::numeric_limits::max(); - for (int i=0; i() - center)); - for (size_t i=0; i() - center)); - } - writer.travel(pts[i].first); - } - } - if (++i == int(pts.size())) - i = 0; - } - writer.extrude(pts[start_i].first, feedrate); - return poly; - }; - feedrate = first_layer ? m_first_layer_speed * 60.f : std::min(m_wipe_tower_max_purge_speed * 60.f, m_perimeter_speed * 60.f); - // outer contour (always) - bool infill_cone = first_layer && m_wipe_tower_width > 2*spacing && m_wipe_tower_depth > 2*spacing; - Polygon poly = supported_rectangle(wt_box, feedrate, infill_cone); - + Polygon poly; + if (m_wall_type == (int)wtwCone) { + WipeTower::box_coordinates wt_box(Vec2f(0.f, (m_current_shape == SHAPE_REVERSED ? m_layer_info->toolchanges_depth() : 0.f)), + m_wipe_tower_width, m_layer_info->depth + m_perimeter_width); + // outer contour (always) + bool infill_cone = first_layer && m_wipe_tower_width > 2 * spacing && m_wipe_tower_depth > 2 * spacing; + poly = generate_support_cone_wall(writer, wt_box, feedrate, infill_cone, spacing); + } else { + WipeTower::box_coordinates wt_box(Vec2f(0.f, 0.f), m_wipe_tower_width, m_layer_info->depth + m_perimeter_width); + poly = generate_support_rib_wall(writer, wt_box, feedrate, first_layer, m_wall_type == (int)wtwRib, true, false); + } // brim (first layer only) if (first_layer) { + writer.append("; WIPE_TOWER_BRIM_START\n"); size_t loops_num = (m_wipe_tower_brim_width + spacing/2.f) / spacing; for (size_t i = 0; i < loops_num; ++ i) { @@ -1452,7 +2046,7 @@ WipeTower::ToolChangeResult WipeTower2::finish_layer() break; } } - + writer.append("; WIPE_TOWER_BRIM_END\n"); // Save actual brim width to be later passed to the Print object, which will use it // for skirt calculation and pass it to GLCanvas for precise preview box m_wipe_tower_brim_width_real = loops_num * spacing; @@ -1659,10 +2253,18 @@ void WipeTower2::generate(std::vector> return; plan_tower(); - for (int i = 0; i<5; ++i) { +#if 1 + for (int i=0;i<5;++i) { save_on_last_wipe(); plan_tower(); } +#endif + + m_rib_length = std::max({m_rib_length, sqrt(m_wipe_tower_depth * m_wipe_tower_depth + m_wipe_tower_width * m_wipe_tower_width)}); + m_rib_length += m_extra_rib_length; + m_rib_length = std::max(0.f, m_rib_length); + m_rib_width = std::min(m_rib_width, std::min(m_wipe_tower_depth, m_wipe_tower_width) / + 2.f); // Ensure that the rib wall of the wipetower are attached to the infill. m_layer_info = m_plan.begin(); m_current_height = 0.f; @@ -1742,4 +2344,190 @@ std::vector> WipeTower2::get_z_and_depth_pairs() const return out; } + +Polygon WipeTower2::generate_rib_polygon(const WipeTower::box_coordinates& wt_box) +{ + + auto get_current_layer_rib_len = [](float cur_height, float max_height, float max_len) -> float { + return std::abs(max_height - cur_height) / max_height * max_len; + }; + coord_t diagonal_width = scaled(m_rib_width) / 2; + float a = this->m_wipe_tower_width, b = this->m_wipe_tower_depth; + Line line_1(Point::new_scale(Vec2f{0, 0}), Point::new_scale(Vec2f{a, b})); + Line line_2(Point::new_scale(Vec2f{a, 0}), Point::new_scale(Vec2f{0, b})); + float diagonal_extra_length = std::max(0.f, m_rib_length - (float) unscaled(line_1.length())) / 2.f; + diagonal_extra_length = scaled(get_current_layer_rib_len(this->m_z_pos, this->m_wipe_tower_height, diagonal_extra_length)); + Point y_shift{0, scaled(this->m_y_shift)}; + + line_1.extend(double(diagonal_extra_length)); + line_2.extend(double(diagonal_extra_length)); + line_1.translate(-y_shift); + line_2.translate(-y_shift); + + Polygon poly_1 = generate_rectange(line_1, diagonal_width); + Polygon poly_2 = generate_rectange(line_2, diagonal_width); + Polygon poly; + poly.points.push_back(Point::new_scale(wt_box.ld)); + poly.points.push_back(Point::new_scale(wt_box.rd)); + poly.points.push_back(Point::new_scale(wt_box.ru)); + poly.points.push_back(Point::new_scale(wt_box.lu)); + + Polygons p_1_2 = union_({poly_1, poly_2, poly}); + // Polygon res_poly = p_1_2.front(); + // for (auto &p : res_poly.points) res.push_back(unscale(p).cast()); + /*if (p_1_2.front().points.size() != 16) + std::cout << "error " << std::endl;*/ + return p_1_2.front(); +}; + +Polygon WipeTower2::generate_support_rib_wall(WipeTowerWriter2& writer, + const WipeTower::box_coordinates& wt_box, + double feedrate, + bool first_layer, + bool rib_wall, + bool extrude_perimeter, + bool skip_points) +{ + + float retract_length = m_filpar[m_current_tool].retract_length; + float retract_speed = m_filpar[m_current_tool].retract_speed * 60; + Polygon wall_polygon = rib_wall ? generate_rib_polygon(wt_box) : generate_rectange_polygon(wt_box.ld, wt_box.ru); + Polylines result_wall; + Polygon insert_skip_polygon; + if (m_used_fillet) { + if (!rib_wall && m_y_shift > EPSILON) // do nothing because the fillet will cause it to be suspended. + { + } else { + wall_polygon = rib_wall ? rounding_polygon(wall_polygon) : wall_polygon; // rectangle_wall do nothing + Polygon wt_box_polygon = generate_rectange_polygon(wt_box.ld, wt_box.ru); + wall_polygon = union_({wall_polygon, wt_box_polygon}).front(); + } + } + if (!extrude_perimeter) + return wall_polygon; + + if (skip_points) { + result_wall = contrust_gap_for_skip_points(wall_polygon, std::vector(), m_wipe_tower_width, 2.5 * m_perimeter_width, + insert_skip_polygon); + } else { + result_wall.push_back(to_polyline(wall_polygon)); + insert_skip_polygon = wall_polygon; + } + writer.generate_path(result_wall, feedrate, retract_length, retract_speed, m_used_fillet); + //if (m_cur_layer_id == 0) { + // BoundingBox bbox = get_extents(result_wall); + // m_rib_offset = Vec2f(-unscaled(bbox.min.x()), -unscaled(bbox.min.y())); + //} + + return insert_skip_polygon; +} + + +// This block creates the stabilization cone. +// First define a lambda to draw the rectangle with stabilization. +Polygon WipeTower2::generate_support_cone_wall( + WipeTowerWriter2& writer, const WipeTower::box_coordinates& wt_box, double feedrate, bool infill_cone, float spacing){ + + const auto [R, support_scale] = get_wipe_tower_cone_base(m_wipe_tower_width, m_wipe_tower_height, m_wipe_tower_depth, + m_wipe_tower_cone_angle); + + double z = m_no_sparse_layers ? + (m_current_height + m_layer_info->height) : + m_layer_info->z; // the former should actually work in both cases, but let's stay on the safe side (the 2.6.0 is close) + + double r = std::tan(Geometry::deg2rad(m_wipe_tower_cone_angle / 2.f)) * (m_wipe_tower_height - z); + Vec2f center = (wt_box.lu + wt_box.rd) / 2.; + double w = wt_box.lu.y() - wt_box.ld.y(); + enum Type { Arc, Corner, ArcStart, ArcEnd }; + + // First generate vector of annotated point which form the boundary. + std::vector> pts = {{wt_box.ru, Corner}}; + if (double alpha_start = std::asin((0.5 * w) / r); !std::isnan(alpha_start) && r > 0.5 * w + 0.01) { + for (double alpha = alpha_start; alpha < M_PI - alpha_start + 0.001; alpha += (M_PI - 2 * alpha_start) / 40.) + pts.emplace_back(Vec2f(center.x() + r * std::cos(alpha) / support_scale, center.y() + r * std::sin(alpha)), + alpha == alpha_start ? ArcStart : Arc); + pts.back().second = ArcEnd; + } + pts.emplace_back(wt_box.lu, Corner); + pts.emplace_back(wt_box.ld, Corner); + for (int i = int(pts.size()) - 3; i > 0; --i) + pts.emplace_back(Vec2f(pts[i].first.x(), 2 * center.y() - pts[i].first.y()), i == int(pts.size()) - 3 ? ArcStart : + i == 1 ? ArcEnd : + Arc); + pts.emplace_back(wt_box.rd, Corner); + + // Create a Polygon from the points. + Polygon poly; + for (const auto& [pt, tag] : pts) + poly.points.push_back(Point::new_scale(pt)); + + // Prepare polygons to be filled by infill. + Polylines polylines; + if (infill_cone && m_wipe_tower_width > 2 * spacing && m_wipe_tower_depth > 2 * spacing) { + ExPolygons infill_areas; + ExPolygon wt_contour(poly); + Polygon wt_rectangle( + Points{Point::new_scale(wt_box.ld), Point::new_scale(wt_box.rd), Point::new_scale(wt_box.ru), Point::new_scale(wt_box.lu)}); + wt_rectangle = offset(wt_rectangle, scale_(-spacing / 2.)).front(); + wt_contour = offset_ex(wt_contour, scale_(-spacing / 2.)).front(); + infill_areas = diff_ex(wt_contour, wt_rectangle); + if (infill_areas.size() == 2) { + ExPolygon& bottom_expoly = infill_areas.front().contour.points.front().y() < infill_areas.back().contour.points.front().y() ? + infill_areas[0] : + infill_areas[1]; + std::unique_ptr filler(Fill::new_from_type(ipMonotonicLine)); + filler->angle = Geometry::deg2rad(45.f); + filler->spacing = spacing; + FillParams params; + params.density = 1.f; + Surface surface(stBottom, bottom_expoly); + filler->bounding_box = get_extents(bottom_expoly); + polylines = filler->fill_surface(&surface, params); + if (!polylines.empty()) { + if (polylines.front().points.front().x() > polylines.back().points.back().x()) { + std::reverse(polylines.begin(), polylines.end()); + for (Polyline& p : polylines) + p.reverse(); + } + } + } + } + + // Find the closest corner and travel to it. + int start_i = 0; + double min_dist = std::numeric_limits::max(); + for (int i = 0; i < int(pts.size()); ++i) { + if (pts[i].second == Corner) { + double dist = (pts[i].first - Vec2f(writer.x(), writer.y())).squaredNorm(); + if (dist < min_dist) { + min_dist = dist; + start_i = i; + } + } + } + writer.travel(pts[start_i].first); + + // Now actually extrude the boundary (and possibly infill): + int i = start_i + 1 == int(pts.size()) ? 0 : start_i + 1; + while (i != start_i) { + writer.extrude(pts[i].first, feedrate); + if (pts[i].second == ArcEnd) { + // Extrude the infill. + if (!polylines.empty()) { + // Extrude the infill and travel back to where we were. + bool mirror = ((pts[i].first.y() - center.y()) * (unscale(polylines.front().points.front()).y() - center.y())) < 0.; + for (const Polyline& line : polylines) { + writer.travel(center - (mirror ? 1.f : -1.f) * (unscale(line.points.front()).cast() - center)); + for (size_t i = 0; i < line.points.size(); ++i) + writer.extrude(center - (mirror ? 1.f : -1.f) * (unscale(line.points[i]).cast() - center)); + } + writer.travel(pts[i].first); + } + } + if (++i == int(pts.size())) + i = 0; + } + writer.extrude(pts[start_i].first, feedrate); + return poly; +} } // namespace Slic3r diff --git a/src/libslic3r/GCode/WipeTower2.hpp b/src/libslic3r/GCode/WipeTower2.hpp index 0f377d00f7..3dbc066634 100644 --- a/src/libslic3r/GCode/WipeTower2.hpp +++ b/src/libslic3r/GCode/WipeTower2.hpp @@ -10,6 +10,7 @@ #include #include "libslic3r/Point.hpp" +#include "libslic3r/Polygon.hpp" #include "WipeTower.hpp" namespace Slic3r { @@ -85,7 +86,8 @@ public: while (!m_plan.empty() && m_layer_info->z < print_z - WT_EPSILON && m_layer_info+1 != m_plan.end()) ++m_layer_info; - m_current_shape = (! this->is_first_layer() && m_current_shape == SHAPE_NORMAL) ? SHAPE_REVERSED : SHAPE_NORMAL; + //m_current_shape = (! this->is_first_layer() && m_current_shape == SHAPE_NORMAL) ? SHAPE_REVERSED : SHAPE_NORMAL; + m_current_shape = SHAPE_NORMAL; if (this->is_first_layer()) { m_num_layer_changes = 0; m_num_tool_changes = 0; @@ -156,6 +158,8 @@ public: bool multitool_ramming; float multitool_ramming_time = 0.f; float filament_minimal_purge_on_wipe_tower = 0.f; + float retract_length; + float retract_speed; }; private: @@ -196,6 +200,14 @@ private: float m_first_layer_speed = 0.f; size_t m_first_layer_idx = size_t(-1); + int m_wall_type; + bool m_used_fillet = true; + float m_rib_width = 10; + float m_extra_rib_length = 0; + float m_rib_length = 0; + + bool m_enable_arc_fitting = false; + // G-code generator parameters. float m_cooling_tube_retraction = 0.f; float m_cooling_tube_length = 0.f; @@ -315,6 +327,24 @@ private: WipeTowerWriter2 &writer, const WipeTower::box_coordinates &cleaning_box, float wipe_volume); + + + Polygon generate_support_rib_wall(WipeTowerWriter2& writer, + const WipeTower::box_coordinates& wt_box, + double feedrate, + bool first_layer, + bool rib_wall, + bool extrude_perimeter, + bool skip_points); + + Polygon generate_support_cone_wall( + WipeTowerWriter2& writer, + const WipeTower::box_coordinates& wt_box, + double feedrate, + bool infill_cone, + float spacing); + + Polygon generate_rib_polygon(const WipeTower::box_coordinates& wt_box); }; diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index a6b4f2bb87..b9d3b7db3e 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -3200,7 +3200,7 @@ double getadhesionCoeff(const ModelVolumePtrs objectVolumes) { double adhesionCoeff = 1; for (const ModelVolume* modelVolume : objectVolumes) { - if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) + if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) { if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PETG" || Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PCTG") { adhesionCoeff = 2; @@ -3208,6 +3208,7 @@ double getadhesionCoeff(const ModelVolumePtrs objectVolumes) else if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "TPU") { adhesionCoeff = 0.5; } + } } return adhesionCoeff; } diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index df54335939..f1c0cf244f 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -830,7 +830,9 @@ static std::vector s_Preset_print_options { "tree_support_brim_width", "gcode_comments", "gcode_label_objects", "initial_layer_travel_speed", "exclude_object", "slow_down_layers", "infill_anchor", "infill_anchor_max","initial_layer_min_bead_width", "make_overhang_printable", "make_overhang_printable_angle", "make_overhang_printable_hole_size" ,"notes", - "wipe_tower_cone_angle", "wipe_tower_extra_spacing","wipe_tower_max_purge_speed", "wipe_tower_filament", "wiping_volumes_extruders","wipe_tower_bridging", "wipe_tower_extra_flow","single_extruder_multi_material_priming", + "wipe_tower_cone_angle", "wipe_tower_extra_spacing","wipe_tower_max_purge_speed", + "wipe_tower_wall_type", "wipe_tower_extra_rib_length", "wipe_tower_rib_width", "wipe_tower_fillet_wall", + "wipe_tower_filament", "wiping_volumes_extruders","wipe_tower_bridging", "wipe_tower_extra_flow","single_extruder_multi_material_priming", "wipe_tower_rotation_angle", "tree_support_branch_distance_organic", "tree_support_branch_diameter_organic", "tree_support_branch_angle_organic", "hole_to_polyhole", "hole_to_polyhole_threshold", "hole_to_polyhole_twisted", "mmu_segmented_region_max_width", "mmu_segmented_region_interlocking_depth", "small_area_infill_flow_compensation", "small_area_infill_flow_compensation_model", diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 1d73cd1fe7..dfc34a850c 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -304,6 +304,10 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "wipe_tower_cone_angle" || opt_key == "wipe_tower_extra_spacing" || opt_key == "wipe_tower_max_purge_speed" + || opt_key == "wipe_tower_wall_type" + || opt_key == "wipe_tower_extra_rib_length" + || opt_key == "wipe_tower_rib_width" + || opt_key == "wipe_tower_fillet_wall" || opt_key == "wipe_tower_filament" || opt_key == "wiping_volumes_extruders" || opt_key == "enable_filament_ramming" diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 9e9b43c61f..5ed428fcf6 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -445,6 +445,13 @@ static const t_config_enum_values s_keys_map_CounterboreHoleBridgingOption{ }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(CounterboreHoleBridgingOption) +static const t_config_enum_values s_keys_map_WipeTowerWallType{ + {"rectangle", wtwRectangle}, + {"cone", wtwCone}, + {"rib", wtwRib}, +}; +CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(WipeTowerWallType) + static void assign_printer_technology_to_unknown(t_optiondef_map &options, PrinterTechnology printer_technology) { for (std::pair &kvp : options) @@ -5394,7 +5401,7 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->min = 0.; def->max = 90.; - def->set_default_value(new ConfigOptionFloat(0.)); + def->set_default_value(new ConfigOptionFloat(30.0)); def = this->add("wipe_tower_max_purge_speed", coFloat); def->label = L("Maximum wipe tower print speed"); @@ -5409,6 +5416,46 @@ void PrintConfigDef::init_fff_params() def->min = 10; def->set_default_value(new ConfigOptionFloat(90.)); + def = this->add("wipe_tower_wall_type", coEnum); + def->label = L("Wall type"); + def->tooltip = L("Wipe tower outer wall type.\n" + "1. Rectangle: The default wall type, a rectangle with fixed width and height.\n" + "2. Cone: A cone with a fillet at the bottom to help stabilize the wipe tower.\n" + "3. Rib: Adds four ribs to the tower wall for enhanced stability."); + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); + def->enum_values.emplace_back("rectangle"); + def->enum_values.emplace_back("cone"); + def->enum_values.emplace_back("rib"); + def->enum_labels.emplace_back("Rectangle"); + def->enum_labels.emplace_back("Cone"); + def->enum_labels.emplace_back("Rib"); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionEnum(wtwRectangle)); + + def = this->add("wipe_tower_extra_rib_length", coFloat); + def->label = L("Extra rib length"); + def->tooltip = L("Positive values can increase the size of the rib wall, while negative values can reduce the size." + "However, the size of the rib wall can not be smaller than that determined by the cleaning volume."); + def->sidetext = L("mm"); + def->max = 300; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(0)); + + def = this->add("wipe_tower_rib_width", coFloat); + def->label = L("Rib width"); + def->tooltip = L("Rib width"); + def->sidetext = L("mm"); + def->mode = comAdvanced; + def->min = 0; + def->set_default_value(new ConfigOptionFloat(8)); + + def = this->add("wipe_tower_fillet_wall", coBool); + def->label = L("Fillet wall"); + def->tooltip = L("The wall of prime tower will fillet."); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionBool(true)); + + def = this->add("wipe_tower_filament", coInt); def->gui_type = ConfigOptionDef::GUIType::i_enum_open; def->label = L("Wipe tower"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index d0566a0b5b..822e7621c4 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -345,6 +345,12 @@ enum CounterboreHoleBridgingOption { chbNone, chbBridges, chbFilled }; + enum WipeTowerWallType { + wtwRectangle = 0, + wtwCone, + wtwRib + }; + static std::string bed_type_to_gcode_string(const BedType type) { std::string type_str; @@ -452,7 +458,9 @@ CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(GCodeThumbnailsFormat) CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(CounterboreHoleBridgingOption) CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PrintHostType) CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(AuthorizationType) +CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(WipeTowerWallType) CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PerimeterGeneratorType) + #undef CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS class DynamicPrintConfig; @@ -1340,6 +1348,10 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionFloat, wipe_tower_cone_angle)) ((ConfigOptionPercent, wipe_tower_extra_spacing)) ((ConfigOptionFloat, wipe_tower_max_purge_speed)) + ((ConfigOptionEnum, wipe_tower_wall_type)) + ((ConfigOptionFloat, wipe_tower_extra_rib_length)) + ((ConfigOptionFloat, wipe_tower_rib_width)) + ((ConfigOptionBool, wipe_tower_fillet_wall)) ((ConfigOptionInt, wipe_tower_filament)) ((ConfigOptionFloats, wiping_volumes_extruders)) ((ConfigOptionInts, idle_temperature)) diff --git a/src/libslic3r/TriangleMeshSlicer.cpp b/src/libslic3r/TriangleMeshSlicer.cpp index c9a59e5b2f..00b37ebdd5 100644 --- a/src/libslic3r/TriangleMeshSlicer.cpp +++ b/src/libslic3r/TriangleMeshSlicer.cpp @@ -2474,7 +2474,7 @@ void cut_mesh(const indexed_triangle_set& mesh, float z, indexed_triangle_set* u // intersect v0-v1 and v2-v0 with cutting plane and make new vertices auto new_vertex = [upper, lower, &upper_slice_vertices, &lower_slice_vertices](const Vec3f &a, const int ia, const Vec3f &b, const int ib, const Vec3f &c, const int ic, const Vec3f &new_pt, bool &is_new_vertex) { - int iupper, ilower; + int iupper = 0, ilower = 0; is_new_vertex = false; if (is_equal(new_pt, a)) iupper = ilower = ia; diff --git a/src/mcut/source/shewchuk.c b/src/mcut/source/shewchuk.c index 3143e40234..b23c3bea9d 100644 --- a/src/mcut/source/shewchuk.c +++ b/src/mcut/source/shewchuk.c @@ -2770,7 +2770,7 @@ REAL permanent; REAL cxtaa[8], cxtbb[8], cytaa[8], cytbb[8]; int cxtaalen, cxtbblen, cytaalen, cytbblen; REAL axtbc[8], aytbc[8], bxtca[8], bytca[8], cxtab[8], cytab[8]; - int axtbclen, aytbclen, bxtcalen, bytcalen, cxtablen, cytablen; + int axtbclen = 0, aytbclen = 0, bxtcalen = 0, bytcalen = 0, cxtablen = 0, cytablen = 0; REAL axtbct[16], aytbct[16], bxtcat[16], bytcat[16], cxtabt[16], cytabt[16]; int axtbctlen, aytbctlen, bxtcatlen, bytcatlen, cxtabtlen, cytabtlen; REAL axtbctt[8], aytbctt[8], bxtcatt[8]; @@ -8679,4 +8679,4 @@ REAL* pe; } #endif -#endif \ No newline at end of file +#endif diff --git a/src/nanosvg/nanosvg.h b/src/nanosvg/nanosvg.h index 32b6bbbe9a..b3aa8b7858 100644 --- a/src/nanosvg/nanosvg.h +++ b/src/nanosvg/nanosvg.h @@ -1661,8 +1661,8 @@ static int nsvg__parseRotate(float* xform, const char* str) static void nsvg__parseTransform(float* xform, const char* str) { - float t[6]; - int len; + float t[6] = {0.0}; + int len; nsvg__xformIdentity(xform); while (*str) { diff --git a/src/platform/unix/BuildLinuxImage.sh.in b/src/platform/unix/build_linux_image.sh.in old mode 100644 new mode 100755 similarity index 93% rename from src/platform/unix/BuildLinuxImage.sh.in rename to src/platform/unix/build_linux_image.sh.in index 77ab1431a7..738f6528eb --- a/src/platform/unix/BuildLinuxImage.sh.in +++ b/src/platform/unix/build_linux_image.sh.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash export ROOT=$(echo $ROOT | grep . || pwd) export NCORES=`nproc --all` @@ -8,7 +8,7 @@ while getopts ":ih" opt; do i ) export BUILD_IMAGE="1" ;; - h ) echo "Usage: ./BuildLinuxImage.sh [-i]" + h ) echo "Usage: ./build_linux_image.sh [-i]" echo " -i: Generate Appimage (optional)" exit 0 ;; @@ -67,9 +67,9 @@ EOF chmod ug+x @SLIC3R_APP_CMD@ cp -f @SLIC3R_APP_CMD@ package/@SLIC3R_APP_CMD@ - pushd package + pushd package > /dev/null tar -cvf ../@SLIC3R_APP_KEY@.tar . &>/dev/null - popd + popd > /dev/null #} &> $ROOT/Build.log # Capture all command output echo "done" @@ -77,10 +77,10 @@ if [[ -n "$BUILD_IMAGE" ]] then echo -n "Creating Appimage for distribution..." #{ - pushd package + pushd package > /dev/null chmod +x ../build_appimage.sh ../build_appimage.sh - popd + popd > /dev/null mv package/"@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage" "@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage" #} &> $ROOT/Build.log # Capture all command output echo "done" diff --git a/src/qhull/CMakeLists.txt b/src/qhull/CMakeLists.txt index 06e430f6f0..573eafc7eb 100644 --- a/src/qhull/CMakeLists.txt +++ b/src/qhull/CMakeLists.txt @@ -145,7 +145,7 @@ endif(UNIX) ################################################## # LIBDIR is defined in the main xs CMake file: -target_include_directories(${qhull_STATIC} BEFORE PUBLIC ${LIBDIR}/qhull/src) +target_include_directories(${qhull_STATIC} SYSTEM BEFORE PUBLIC ${LIBDIR}/qhull/src) target_link_libraries(qhull INTERFACE ${qhull_STATIC}) endif() diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt index 9bf82826f3..3713d41e3a 100644 --- a/src/slic3r/CMakeLists.txt +++ b/src/slic3r/CMakeLists.txt @@ -630,7 +630,7 @@ add_library(libslic3r_gui STATIC ${SLIC3R_GUI_SOURCES}) target_include_directories(libslic3r_gui PRIVATE Utils) if (WIN32) - target_include_directories(libslic3r_gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../deps/WebView2/include) + target_include_directories(libslic3r_gui SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../deps/WebView2/include) endif() source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SLIC3R_GUI_SOURCES}) @@ -647,9 +647,9 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux") FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl) FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client) find_package(CURL REQUIRED) - target_link_libraries(libslic3r_gui ${DBUS_LIBRARIES} OSMesa) target_link_libraries(libslic3r_gui OpenGL::EGL + ${DBUS_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp index badb4a6945..de80f6045f 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp @@ -320,7 +320,7 @@ void CaliPresetCustomRangePanel::create_panel(wxWindow* parent) std::string decimal_point; std::string expression = "^[-+]?[0-9]+([,.][0-9]+)?$"; std::regex decimalRegex(expression); - int decimal_number; + int decimal_number = 0; if (std::regex_match(number, decimalRegex)) { std::smatch match; if (std::regex_search(number, match, decimalRegex)) { diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index f4248baf65..048cb065fe 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -686,10 +686,19 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co for (auto el : {"wipe_tower_rotation_angle", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_max_purge_speed", + "wipe_tower_wall_type", + "wipe_tower_extra_rib_length","wipe_tower_rib_width","wipe_tower_fillet_wall", "wipe_tower_bridging", "wipe_tower_extra_flow", "wipe_tower_no_sparse_layers"}) toggle_line(el, have_prime_tower && !is_BBL_Printer); + WipeTowerWallType wipe_tower_wall_type = config->opt_enum("wipe_tower_wall_type"); + toggle_line("wipe_tower_cone_angle", have_prime_tower && !is_BBL_Printer && wipe_tower_wall_type == WipeTowerWallType::wtwCone); + toggle_line("wipe_tower_extra_rib_length", have_prime_tower && !is_BBL_Printer && wipe_tower_wall_type == WipeTowerWallType::wtwRib); + toggle_line("wipe_tower_rib_width", have_prime_tower && !is_BBL_Printer && wipe_tower_wall_type == WipeTowerWallType::wtwRib); + toggle_line("wipe_tower_fillet_wall", have_prime_tower && !is_BBL_Printer && wipe_tower_wall_type == WipeTowerWallType::wtwRib); + + toggle_line("single_extruder_multi_material_priming", !bSEMM && have_prime_tower && !is_BBL_Printer); toggle_line("prime_volume",have_prime_tower && (!purge_in_primetower || !bSEMM)); diff --git a/src/slic3r/GUI/ConnectPrinter.cpp b/src/slic3r/GUI/ConnectPrinter.cpp index 9ea5d9de89..6564c01dfd 100644 --- a/src/slic3r/GUI/ConnectPrinter.cpp +++ b/src/slic3r/GUI/ConnectPrinter.cpp @@ -160,7 +160,7 @@ void ConnectPrinterDialog::on_button_confirm(wxCommandEvent &event) { wxString code = m_textCtrl_code->GetTextCtrl()->GetValue(); for (char c : code) { - if (!('0' <= c && c <= '9' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z')) { + if (!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) { show_error(this, _L("Invalid input.")); return; } @@ -187,4 +187,4 @@ void ConnectPrinterDialog::on_dpi_changed(const wxRect &suggested_rect) Layout(); this->Refresh(); } -}} // namespace Slic3r::GUI \ No newline at end of file +}} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index b42defb346..6827b28c3d 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -778,7 +778,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_vendor_item() m_filament_custom_vendor_input->SetSize(NAME_OPTION_COMBOBOX_SIZE); textInputSizer->Add(m_filament_custom_vendor_input, 0, wxEXPAND | wxALL, 0); m_filament_custom_vendor_input->GetTextCtrl()->SetHint(_L("Input Custom Vendor")); - m_filament_custom_vendor_input->GetTextCtrl()->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) { + m_filament_custom_vendor_input->GetTextCtrl()->Bind(wxEVT_CHAR, [](wxKeyEvent &event) { int key = event.GetKeyCode(); if (cannot_input_key.find(key) != cannot_input_key.end()) { event.Skip(false); @@ -888,7 +888,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_serial_item() m_filament_serial_input = new TextInput(this, "", "", "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE, wxTE_PROCESS_ENTER); m_filament_serial_input->GetTextCtrl()->SetMaxLength(50); comboBoxSizer->Add(m_filament_serial_input, 0, wxEXPAND | wxALL, 0); - m_filament_serial_input->GetTextCtrl()->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) { + m_filament_serial_input->GetTextCtrl()->Bind(wxEVT_CHAR, [](wxKeyEvent &event) { int key = event.GetKeyCode(); if (cannot_input_key.find(key) != cannot_input_key.end()) { event.Skip(false); @@ -1750,7 +1750,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent) m_custom_vendor_text_ctrl = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE); m_custom_vendor_text_ctrl->SetHint(_L("Input Custom Vendor")); - m_custom_vendor_text_ctrl->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) { + m_custom_vendor_text_ctrl->Bind(wxEVT_CHAR, [](wxKeyEvent &event) { int key = event.GetKeyCode(); if (cannot_input_key.find(key) != cannot_input_key.end()) { // "@" can not be inputed event.Skip(false); @@ -1762,7 +1762,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent) m_custom_vendor_text_ctrl->Hide(); m_custom_model_text_ctrl = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE); m_custom_model_text_ctrl->SetHint(_L("Input Custom Model")); - m_custom_model_text_ctrl->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) { + m_custom_model_text_ctrl->Bind(wxEVT_CHAR, [](wxKeyEvent &event) { int key = event.GetKeyCode(); if (cannot_input_key.find(key) != cannot_input_key.end()) { // "@" can not be inputed event.Skip(false); @@ -3242,8 +3242,8 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con horizontal_sizer->Add(success_bitmap_sizer, 0, wxEXPAND | wxALL, FromDIP(5)); wxBoxSizer *success_text_sizer = new wxBoxSizer(wxVERTICAL); - wxStaticText *success_text; - wxStaticText *next_step_text; + wxStaticText *success_text = nullptr; + wxStaticText *next_step_text = nullptr; bool sync_user_preset_need_enabled = wxGetApp().getAgent() && wxGetApp().app_config->get("sync_user_preset") == "false"; switch (create_success_type) { case PRINTER: diff --git a/src/slic3r/GUI/EditGCodeDialog.cpp b/src/slic3r/GUI/EditGCodeDialog.cpp index c50b86d32a..0afbb18a1e 100644 --- a/src/slic3r/GUI/EditGCodeDialog.cpp +++ b/src/slic3r/GUI/EditGCodeDialog.cpp @@ -15,16 +15,13 @@ #include "format.hpp" #include "Tab.hpp" #include "wxExtensions.hpp" -#include "BitmapCache.hpp" #include "ExtraRenderers.hpp" #include "MsgDialog.hpp" #include "Plater.hpp" #include "Widgets/DialogButtons.hpp" -#include "libslic3r/PlaceholderParser.hpp" #include "libslic3r/Preset.hpp" -#include "libslic3r/Print.hpp" #define BTN_GAP FromDIP(20) #define BTN_SIZE wxSize(FromDIP(58), FromDIP(24)) @@ -61,7 +58,7 @@ EditGCodeDialog::EditGCodeDialog(wxWindow* parent, const std::string& key, const m_search_bar->SetForegroundColour(*wxBLACK); wxGetApp().UpdateDarkUI(m_search_bar); - m_search_bar->Bind(wxEVT_SET_FOCUS, [this](wxFocusEvent&) { + m_search_bar->Bind(wxEVT_SET_FOCUS, [](wxFocusEvent&) { // this->on_search_update(); }); m_search_bar->Bind(wxEVT_COMMAND_TEXT_UPDATED, [this](wxCommandEvent&) { @@ -256,9 +253,9 @@ wxDataViewItem EditGCodeDialog::add_presets_placeholders() const auto& full_config = wxGetApp().preset_bundle->full_config(); const auto& tab_list = wxGetApp().tabs_list; - Tab* tab_print; - Tab* tab_filament; - Tab* tab_printer; + Tab* tab_print = nullptr; + Tab* tab_filament = nullptr; + Tab* tab_printer = nullptr; for (const auto tab : tab_list) { if (tab->m_type == Preset::TYPE_PRINT) tab_print = tab; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index a1e7f55b9c..e02919d9e0 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3511,7 +3511,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) m_dirty = true; #endif } else if ((evt.ShiftDown() && evt.ControlDown() && keyCode == WXK_RETURN) || - evt.ShiftDown() && evt.AltDown() && keyCode == WXK_RETURN) { + (evt.ShiftDown() && evt.AltDown() && keyCode == WXK_RETURN)) { wxGetApp().plater()->toggle_show_wireframe(); m_dirty = true; } @@ -6640,8 +6640,8 @@ bool GLCanvas3D::_init_assemble_view_toolbar() item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLVIEWTOOLBAR_ASSEMBLE)); }; item.left.render_callback = GLToolbarItem::Default_Render_Callback; item.visible = true; - item.visibility_callback = [this]()->bool { return true; }; - item.enabling_callback = [this]()->bool { + item.visibility_callback = []()->bool { return true; }; + item.enabling_callback = []()->bool { return wxGetApp().plater()->has_assmeble_view(); }; if (!m_assemble_view_toolbar.add_item(item)) @@ -6690,7 +6690,7 @@ bool GLCanvas3D::_init_separator_toolbar() sperate_item.name = "start_seperator"; sperate_item.icon_filename = "seperator.svg"; sperate_item.sprite_id = 0; - sperate_item.left.action_callback = [this]() {}; + sperate_item.left.action_callback = []() {}; sperate_item.visibility_callback = []()->bool { return true; }; sperate_item.enabling_callback = []()->bool { return false; }; if (!m_separator_toolbar.add_item(sperate_item)) @@ -7407,7 +7407,7 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with }*/ const Camera& camera = wxGetApp().plater()->get_camera(); //BBS:add assemble view related logic - m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), cvn_size, [this, canvas_type](const GLVolume& volume) { + m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), cvn_size, [canvas_type](const GLVolume& volume) { if (canvas_type == ECanvasType::CanvasAssembleView) { return !volume.is_modifier; } @@ -7783,7 +7783,7 @@ void GLCanvas3D::_render_gizmos_overlay() // m_gizmos.set_overlay_scale(wxGetApp().em_unit()*0.1f); const float size = int(GLGizmosManager::Default_Icons_Size * wxGetApp().toolbar_icon_scale()); m_gizmos.set_overlay_icon_size(size); //! #ys_FIXME_experiment -#endif /* __WXMSW__ */ +#endif */ /* __WXMSW__ */ m_gizmos.render_overlay(); if (m_gizmo_highlighter.m_render_arrow) @@ -8474,7 +8474,7 @@ float GLCanvas3D::_show_assembly_tooltip_information(float caption_max, float x, if (ImGui::IsItemHovered()) { ImGui::BeginTooltip2(ImVec2(x, y)); - auto draw_text_with_caption = [this, &imgui, & caption_max](const wxString &caption, const wxString &text) { + auto draw_text_with_caption = [&imgui, & caption_max](const wxString &caption, const wxString &text) { imgui->text_colored(ImGuiWrapper::COL_ACTIVE, caption); ImGui::SameLine(caption_max); imgui->text_colored(ImGuiWrapper::COL_WINDOW_BG, text); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index fa128a7d27..385adbfa16 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2007,7 +2007,7 @@ void GUI_App::init_app_config() } // Change current dirtory of application - chdir(encode_path((Slic3r::data_dir() + "/log").c_str()).c_str()); + [[maybe_unused]] auto unused_result = chdir(encode_path((Slic3r::data_dir() + "/log").c_str()).c_str()); } else { m_datadir_redefined = true; } diff --git a/src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp b/src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp index 8e15214e2d..2b7e7bc9fe 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp @@ -204,8 +204,8 @@ bool GLGizmoBrimEars::unproject_on_mesh2(const Vec2d &mouse_pos, std::pairobject_clipper()->get_position(); const ClippingPlane *clp = m_c->object_clipper()->get_clipping_plane(); bool mouse_on_object = false; - Vec3f position_on_model; - Vec3f normal_on_model; + Vec3f position_on_model {}; + Vec3f normal_on_model {}; double closest_hit_distance = std::numeric_limits::max(); for (auto item : m_mesh_raycaster_map) { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp index 9645926d7e..139b21edcc 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp @@ -1817,7 +1817,7 @@ void GLGizmoMeasure::show_selection_ui() return text; }; - float selection_cap_length; + float selection_cap_length = 0; if (m_measure_mode == EMeasureMode::ONLY_ASSEMBLY) { if (m_assembly_mode == AssemblyMode::FACE_FACE) { selection_cap_length = ImGui::CalcTextSize((_u8L("Selection") + " 1" + _u8L(" (Moving)")).c_str()).x * 1.2; diff --git a/src/slic3r/GUI/MediaFilePanel.cpp b/src/slic3r/GUI/MediaFilePanel.cpp index 6ac7f89308..612ebb8848 100644 --- a/src/slic3r/GUI/MediaFilePanel.cpp +++ b/src/slic3r/GUI/MediaFilePanel.cpp @@ -395,7 +395,7 @@ void MediaFilePanel::SetSelecting(bool selecting) m_image_grid->SetSelecting(selecting); m_button_management->SetLabel(selecting ? _L("Cancel") : _L("Select")); auto fs = m_image_grid->GetFileSystem(); - bool download_support = fs && fs->GetFileType() < PrinterFileSystem::F_MODEL || m_model_download_support; + bool download_support = (fs && fs->GetFileType() < PrinterFileSystem::F_MODEL) || m_model_download_support; m_manage_panel->GetSizer()->Show(m_button_download, selecting && download_support); m_manage_panel->GetSizer()->Show(m_button_delete, selecting); m_manage_panel->GetSizer()->Show(m_button_refresh, !selecting); diff --git a/src/slic3r/GUI/ObjColorDialog.cpp b/src/slic3r/GUI/ObjColorDialog.cpp index d0200ce8b9..116625e7cc 100644 --- a/src/slic3r/GUI/ObjColorDialog.cpp +++ b/src/slic3r/GUI/ObjColorDialog.cpp @@ -640,7 +640,7 @@ void ObjColorPanel::draw_table() m_color_cluster_icon_list.clear(); m_extruder_icon_list.clear(); - float row_height ; + float row_height = 0; for (size_t ii = 0; ii < row; ii++) { wxPanel *row_panel = new wxPanel(m_scrolledWindow); row_panel->SetBackgroundColour(ii % 2 == 0 ? *wxWHITE : wxColour(238, 238, 238)); diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 0c79b38e38..2a8987bdc0 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -576,7 +576,7 @@ void PartPlate::calc_vertex_for_plate_name_edit_icon(GLTexture *texture, int ind float height = icon_sz; float offset_y = factor * PARTPLATE_TEXT_OFFSET_Y; - float name_width; + float name_width = 0.0; if (texture && texture->get_width() > 0 && texture->get_height()) // original width give correct ratio in here since rendering width can be much higher because of next_highest_power_of_2 for rendering name_width = icon_sz * texture->m_original_width / texture->get_height(); diff --git a/src/slic3r/GUI/PlateSettingsDialog.cpp b/src/slic3r/GUI/PlateSettingsDialog.cpp index 7c15f08fe1..80e17f8fa5 100644 --- a/src/slic3r/GUI/PlateSettingsDialog.cpp +++ b/src/slic3r/GUI/PlateSettingsDialog.cpp @@ -55,8 +55,8 @@ LayerNumberTextInput::LayerNumberTextInput(wxWindow* parent, int layer_number, w // value should not be less than MIN_LAYER_VALUE, and should not be greater than MAX_LAYER_VALUE gui_value = std::clamp(gui_value, MIN_LAYER_VALUE, MAX_LAYER_VALUE); - int begin_value; - int end_value; + int begin_value = 0; + int end_value = 0; LayerNumberTextInput* end_layer_input = nullptr; if (this->m_type == Type::Begin) { begin_value = gui_value; @@ -688,4 +688,4 @@ void PlateNameEditDialog::set_plate_name(const wxString &name) { } -} // namespace Slic3r::GUI \ No newline at end of file +} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index fc95c11100..8a57f74102 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2827,7 +2827,9 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) "brim_width", "wall_loops", "wall_filament", "sparse_infill_density", "sparse_infill_filament", "top_shell_layers", "enable_support", "support_filament", "support_interface_filament", "support_top_z_distance", "support_bottom_z_distance", "raft_layers", - "wipe_tower_rotation_angle", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_extra_flow", "wipe_tower_max_purge_speed", "wipe_tower_filament", + "wipe_tower_rotation_angle", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_extra_flow", "wipe_tower_max_purge_speed", + "wipe_tower_wall_type", "wipe_tower_extra_rib_length","wipe_tower_rib_width","wipe_tower_fillet_wall", + "wipe_tower_filament", "best_object_pos" })) , sidebar(new Sidebar(q)) @@ -3667,7 +3669,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ bool dlg_cont = true; bool is_user_cancel = false; bool translate_old = false; - int current_width, current_depth, current_height; + int current_width = 0, current_depth = 0, current_height = 0; if (input_files.empty()) { return std::vector(); } @@ -9080,7 +9082,7 @@ void Plater::load_project(wxString const& filename2, // if res is empty no data has been loaded if (!res.empty() && (load_restore || !(strategy & LoadStrategy::Silence))) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << load_restore ? originfile : filename; + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << (load_restore ? originfile : filename); p->set_project_filename(load_restore ? originfile : filename); if (load_restore && originfile.IsEmpty()) { p->set_project_name(_L("Untitled")); diff --git a/src/slic3r/GUI/RammingChart.cpp b/src/slic3r/GUI/RammingChart.cpp index 5bf75bbc74..265c4aa4e0 100644 --- a/src/slic3r/GUI/RammingChart.cpp +++ b/src/slic3r/GUI/RammingChart.cpp @@ -14,20 +14,22 @@ wxDEFINE_EVENT(EVT_WIPE_TOWER_CHART_CHANGED, wxCommandEvent); void Chart::draw() { wxAutoBufferedPaintDC dc(this); // unbuffered DC caused flickering on win + // scaling button and tick line from text size gives better result compared to dc.GetContentScale + int text_width, text_height; + dc.GetTextExtent("m",&text_width,&text_height); + side = text_width; + int tick_w = text_width / 2; + dc.SetBrush(GetBackgroundColour()); dc.SetPen(GetBackgroundColour()); dc.DrawRectangle(GetClientRect()); // otherwise the background would end up black on windows -#ifdef _WIN32 - dc.SetPen(wxPen(GetForegroundColour())); - dc.SetBrush(wxBrush(Slic3r::GUI::wxGetApp().get_highlight_default_clr())); -#else - dc.SetPen(*wxBLACK_PEN); - dc.SetBrush(*wxWHITE_BRUSH); -#endif + dc.SetPen( wxPen(StateColor::darkModeColorFor(wxColour("#DBDBDB")), 1)); // input box border color + dc.SetBrush(wxBrush(StateColor::darkModeColorFor(wxColour("#F1F1F1")))); // sidebar titlebar bg color dc.DrawRectangle(m_rect); if (visible_area.m_width < 0.499) { + dc.SetTextForeground(StateColor::darkModeColorFor(wxColour("#FF6F00"))); // Use orange color for warning dc.DrawText(_(L("NO RAMMING AT ALL")),wxPoint(m_rect.GetLeft()+m_rect.GetWidth()/2-legend_side,m_rect.GetBottom()-m_rect.GetHeight()/2)); return; } @@ -35,15 +37,11 @@ void Chart::draw() { if (!m_line_to_draw.empty()) { for (unsigned int i=0;ichamber_light != MachineObject::LIGHT_EFFECT::LIGHT_EFFECT_OFF; - BOOST_LOG_TRIVIAL(trace) << "light: " << light_on ? "on" : "off"; + BOOST_LOG_TRIVIAL(trace) << "light: " << (light_on ? "on" : "off"); if (m_switch_lamp_timeout > 0) m_switch_lamp_timeout--; else { diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index e566b15f00..34b42a8d0a 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2323,10 +2323,14 @@ void TabPrint::build() optgroup->append_single_option_line("prime_tower_brim_width"); optgroup->append_single_option_line("wipe_tower_rotation_angle"); optgroup->append_single_option_line("wipe_tower_bridging"); - optgroup->append_single_option_line("wipe_tower_cone_angle"); optgroup->append_single_option_line("wipe_tower_extra_spacing"); optgroup->append_single_option_line("wipe_tower_extra_flow"); optgroup->append_single_option_line("wipe_tower_max_purge_speed"); + optgroup->append_single_option_line("wipe_tower_wall_type"); + optgroup->append_single_option_line("wipe_tower_cone_angle"); + optgroup->append_single_option_line("wipe_tower_extra_rib_length"); + optgroup->append_single_option_line("wipe_tower_rib_width"); + optgroup->append_single_option_line("wipe_tower_fillet_wall"); optgroup->append_single_option_line("wipe_tower_no_sparse_layers"); optgroup->append_single_option_line("single_extruder_multi_material_priming"); diff --git a/src/slic3r/GUI/Widgets/Scrollbar.cpp b/src/slic3r/GUI/Widgets/Scrollbar.cpp index b71390b833..5b2140c658 100644 --- a/src/slic3r/GUI/Widgets/Scrollbar.cpp +++ b/src/slic3r/GUI/Widgets/Scrollbar.cpp @@ -1,4 +1,3 @@ -#pragma once #include #ifndef WX_PRECOMP #include @@ -311,4 +310,4 @@ void MyScrollbar::OnMouseWheel(wxMouseEvent &event) } Refresh(); Update(); -} \ No newline at end of file +} diff --git a/src/slic3r/GUI/Widgets/SpinInput.cpp b/src/slic3r/GUI/Widgets/SpinInput.cpp index f5dbd92347..ccd7a80447 100644 --- a/src/slic3r/GUI/Widgets/SpinInput.cpp +++ b/src/slic3r/GUI/Widgets/SpinInput.cpp @@ -38,10 +38,10 @@ SpinInput::SpinInput(wxWindow *parent, const wxPoint &pos, const wxSize & size, long style, - int min, int max, int initial) + int min, int max, int initial, const int& step) : SpinInput() { - Create(parent, text, label, pos, size, style, min, max, initial); + Create(parent, text, label, pos, size, style, min, max, initial, step); } void SpinInput::Create(wxWindow *parent, @@ -50,7 +50,7 @@ void SpinInput::Create(wxWindow *parent, const wxPoint &pos, const wxSize & size, long style, - int min, int max, int initial) + int min, int max, int initial, int step) { StaticBox::Create(parent, wxID_ANY, pos, size); SetFont(Label::Body_12); @@ -76,6 +76,7 @@ void SpinInput::Create(wxWindow *parent, if (text.ToLong(&initialFromText)) initial = initialFromText; SetRange(min, max); SetValue(initial); + SetStep(step); messureSize(); } @@ -229,7 +230,7 @@ Button *SpinInput::createButton(bool inc) btn->DisableFocusFromKeyboard(); btn->Bind(wxEVT_LEFT_DOWN, [=](auto &e) { delta = inc ? 1 : -1; - SetValue(val + delta); + SetValue(val + delta * step); text_ctrl->SetFocus(); if (!btn->HasCapture()) btn->CaptureMouse(); @@ -241,7 +242,7 @@ Button *SpinInput::createButton(bool inc) delta = inc ? 1 : -1; if (!btn->HasCapture()) btn->CaptureMouse(); - SetValue(val + delta); + SetValue(val + delta * step); sendSpinEvent(); }); btn->Bind(wxEVT_LEFT_UP, [=](auto &e) { @@ -259,7 +260,7 @@ void SpinInput::onTimer(wxTimerEvent &evnet) { delta /= 2; return; } - SetValue(val + delta); + SetValue(val + delta * step); sendSpinEvent(); } @@ -293,7 +294,7 @@ void SpinInput::onTextEnter(wxCommandEvent &event) void SpinInput::mouseWheelMoved(wxMouseEvent &event) { auto delta = event.GetWheelRotation() < 0 ? 1 : -1; - SetValue(val + delta); + SetValue(val + delta * step); sendSpinEvent(); text_ctrl->SetFocus(); } @@ -305,10 +306,10 @@ void SpinInput::keyPressed(wxKeyEvent &event) case WXK_DOWN: long value; if (!text_ctrl->GetValue().ToLong(&value)) { value = val; } - if (event.GetKeyCode() == WXK_DOWN && value > min) { - --value; - } else if (event.GetKeyCode() == WXK_UP && value + 1 < max) { - ++value; + if (event.GetKeyCode() == WXK_DOWN && value - step >= min) { + value = value - step; + } else if (event.GetKeyCode() == WXK_UP && value + step <= max) { + value = value + step; } if (value != val) { SetValue(value); diff --git a/src/slic3r/GUI/Widgets/SpinInput.hpp b/src/slic3r/GUI/Widgets/SpinInput.hpp index cc342276f9..030eb56942 100644 --- a/src/slic3r/GUI/Widgets/SpinInput.hpp +++ b/src/slic3r/GUI/Widgets/SpinInput.hpp @@ -23,6 +23,7 @@ class SpinInput : public wxNavigationEnabled int min; int max; int delta; + int step; static const int SpinInputWidth = 200; static const int SpinInputHeight = 50; @@ -36,7 +37,7 @@ public: const wxPoint &pos = wxDefaultPosition, const wxSize & size = wxDefaultSize, long style = 0, - int min = 0, int max = 100, int initial = 0); + int min = 0, int max = 100, int initial = 0, const int& step = 1); void Create(wxWindow * parent, wxString text, @@ -46,7 +47,8 @@ public: long style = 0, int min = 0, int max = 100, - int initial = 0); + int initial = 0, + int step = 1); void SetCornerRadius(double radius); @@ -70,6 +72,10 @@ public: int GetValue () const; + void SetStep(int value) { step = value; }; + + int GetStep() { return step; }; + void SetRange(int min, int max); protected: diff --git a/src/slic3r/GUI/Widgets/StateColor.cpp b/src/slic3r/GUI/Widgets/StateColor.cpp index 95cea1882f..f2881b9fa5 100644 --- a/src/slic3r/GUI/Widgets/StateColor.cpp +++ b/src/slic3r/GUI/Widgets/StateColor.cpp @@ -234,7 +234,7 @@ void StateColor::append(unsigned long color, int states) { if ((color & 0xff000000) == 0) color |= 0xff000000; - wxColour cl; cl.SetRGBA(color & 0xff00ff00 | ((color & 0xff) << 16) | ((color >> 16) & 0xff)); + wxColour cl; cl.SetRGBA((color & 0xff00ff00) | ((color & 0xff) << 16) | ((color >> 16) & 0xff)); append(cl, states); } diff --git a/src/slic3r/GUI/Widgets/StateHandler.cpp b/src/slic3r/GUI/Widgets/StateHandler.cpp index 7b2e4cf6e8..75936796ef 100644 --- a/src/slic3r/GUI/Widgets/StateHandler.cpp +++ b/src/slic3r/GUI/Widgets/StateHandler.cpp @@ -51,7 +51,7 @@ void StateHandler::update_binds() int diff = bind_states ^ bind_states_; State states[] = {Enabled, Checked, Focused, Hovered, Pressed}; wxEventType events[] = {EVT_ENABLE_CHANGED, wxEVT_CHECKBOX, wxEVT_SET_FOCUS, wxEVT_ENTER_WINDOW, wxEVT_LEFT_DOWN}; - wxEventType events2[] = {{0}, {0}, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP}; + wxEventType events2[] = {0, 0, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP}; for (int i = 0; i < 5; ++i) { int s = states[i]; if (diff & s) { @@ -74,7 +74,7 @@ void StateHandler::set_state(int state, int mask) { if ((states_ & mask) == (state & mask)) return; int old = states_; - states_ = states_ & ~mask | state & mask; + states_ = (states_ & ~mask) | (state & mask); if (old != states_ && (old | states2_) != (states_ | states2_)) { if (parent_) parent_->changed(states_ | states2_); @@ -94,7 +94,7 @@ void StateHandler::changed(wxEvent &event) { event.Skip(); wxEventType events[] = {EVT_ENABLE_CHANGED, wxEVT_CHECKBOX, wxEVT_SET_FOCUS, wxEVT_ENTER_WINDOW, wxEVT_LEFT_DOWN}; - wxEventType events2[] = {{0}, {0}, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP}; + wxEventType events2[] = {0, 0, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP}; int old = states_; // some events are from another window (ex: text_ctrl of TextInput), save state in states2_ to avoid conflicts for (int i = 0; i < 5; ++i) { diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index babad123d6..de93b3c5ac 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -9,6 +9,7 @@ #include "MsgDialog.hpp" #include "libslic3r/Color.hpp" #include "Widgets/Button.hpp" +#include "Widgets/StaticLine.hpp" #include "Widgets/DialogButtons.hpp" #include "slic3r/Utils/ColorSpaceConvert.hpp" #include "MainFrame.hpp" @@ -49,37 +50,27 @@ static void update_ui(wxWindow* window) RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters) : wxDialog(parent, wxID_ANY, _(L("Ramming customization")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/) { - update_ui(this); + SetBackgroundColour(*wxWHITE); m_panel_ramming = new RammingPanel(this,parameters); - - // Not found another way of getting the background colours of RammingDialog, RammingPanel and Chart correct than setting - // them all explicitely. Reading the parent colour yielded colour that didn't really match it, no wxSYS_COLOUR_... matched - // colour used for the dialog. Same issue (and "solution") here : https://forums.wxwidgets.org/viewtopic.php?f=1&t=39608 - // Whoever can fix this, feel free to do so. -#ifndef _WIN32 - this-> SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK)); - m_panel_ramming->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK)); -#endif m_panel_ramming->Show(true); - this->Show(); auto main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->Add(m_panel_ramming, 1, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5); - main_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxALIGN_CENTER_HORIZONTAL | wxTOP | wxBOTTOM, 10); + auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"}); + main_sizer->Add(dlg_btns, 0, wxEXPAND); SetSizer(main_sizer); main_sizer->SetSizeHints(this); - update_ui(static_cast(this->FindWindowById(wxID_OK, this))); - update_ui(static_cast(this->FindWindowById(wxID_CANCEL, this))); - this->Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent& e) { EndModal(wxCANCEL); }); this->Bind(wxEVT_BUTTON,[this](wxCommandEvent&) { m_output_data = m_panel_ramming->get_parameters(); EndModal(wxID_OK); },wxID_OK); + + wxGetApp().UpdateDlgDarkUI(this); this->Show(); -// wxMessageDialog dlg(this, _(L("Ramming denotes the rapid extrusion just before a tool change in a single-extruder MM printer. Its purpose is to " + Slic3r::GUI::MessageDialog dlg(this, _(L("Ramming denotes the rapid extrusion just before a tool change in a single-extruder MM printer. Its purpose is to " "properly shape the end of the unloaded filament so it does not prevent insertion of the new filament and can itself " "be reinserted later. This phase is important and different materials can require different extrusion speeds to get " @@ -100,6 +91,7 @@ RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters) RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize/*,wxPoint(50,50), wxSize(800,350),wxBORDER_RAISED*/) { + SetBackgroundColour(*wxWHITE); update_ui(this); auto sizer_chart = new wxBoxSizer(wxVERTICAL); auto sizer_param = new wxBoxSizer(wxVERTICAL); @@ -120,48 +112,59 @@ RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters) buttons.push_back(std::make_pair(x, y)); m_chart = new Chart(this, wxRect(scale(10),scale(10),scale(480),scale(360)), buttons, ramming_speed_size, 0.25f, scale(10)); -#ifdef _WIN32 update_ui(m_chart); -#else - m_chart->SetBackgroundColour(parent->GetBackgroundColour()); // see comment in RammingDialog constructor -#endif sizer_chart->Add(m_chart, 0, wxALL, 5); - m_widget_time = new wxSpinCtrlDouble(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH()*2.5, -1),style,0.,5.0,3.,0.5); - m_widget_volume = new wxSpinCtrl(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH()*2.5, -1),style,0,10000,0); - m_widget_ramming_line_width_multiplicator = new wxSpinCtrl(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH()*2.5, -1),style,10,200,100); - m_widget_ramming_step_multiplicator = new wxSpinCtrl(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH()*2.5, -1),style,10,200,100); + m_widget_time = new SpinInput(this, wxEmptyString, _L("ms") , wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 0 , 5000 , 3000, 500); + m_widget_volume = new SpinInput(this, wxEmptyString, _L("mm³"), wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 0 , 10000, 0 ); + m_widget_ramming_line_width_multiplicator = new SpinInput(this, wxEmptyString, _L("%") , wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 10, 200 , 100 ); + m_widget_ramming_step_multiplicator = new SpinInput(this, wxEmptyString, _L("%") , wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 10, 200 , 100 ); -#ifdef _WIN32 - update_ui(m_widget_time->GetText()); - update_ui(m_widget_volume); - update_ui(m_widget_ramming_line_width_multiplicator); - update_ui(m_widget_ramming_step_multiplicator); -#endif + auto add_title = [this, sizer_param](wxString label){ + auto title = new StaticLine(this, 0, label); + title->SetFont(Label::Head_14); + title->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636"))); + sizer_param->Add(title, 0, wxEXPAND | wxBOTTOM, scale(8)); + }; - auto gsizer_param = new wxFlexGridSizer(2, 5, 15); - gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Total ramming time")) + " (" + _(L("s")) + "):")), 0, wxALIGN_CENTER_VERTICAL); - gsizer_param->Add(m_widget_time); - gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Total rammed volume")) + " (" + _(L("mm")) + wxString("³):", wxConvUTF8))), 0, wxALIGN_CENTER_VERTICAL); - gsizer_param->Add(m_widget_volume); - gsizer_param->AddSpacer(20); - gsizer_param->AddSpacer(20); - gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Ramming line width")) + " (%):")), 0, wxALIGN_CENTER_VERTICAL); - gsizer_param->Add(m_widget_ramming_line_width_multiplicator); - gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Ramming line spacing")) + " (%):")), 0, wxALIGN_CENTER_VERTICAL); - gsizer_param->Add(m_widget_ramming_step_multiplicator); + SetFont(Label::Body_14); + wxSize col_size; + for(auto label : {"Time", "Volume", "Width", "Spacing"}) + col_size.IncTo(GetTextExtent(_L(label))); + col_size = wxSize(col_size.x + scale(30) ,-1); - sizer_param->Add(gsizer_param, 0, wxTOP, scale(10)); + auto add_spin = [this, sizer_param, col_size](wxString label, SpinInput* spin){ + spin->Bind(wxEVT_KILL_FOCUS, [this](auto &e) { + e.SetId(GetId()); + ProcessEventLocally(e); + e.Skip(); + }); + auto h_sizer = new wxBoxSizer(wxHORIZONTAL); + auto text = new wxStaticText(this, wxID_ANY, label, wxDefaultPosition, col_size); + text->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636"))); + h_sizer->Add(text, 0, wxALIGN_CENTER_VERTICAL); + h_sizer->Add(spin); + sizer_param->Add(h_sizer, 0, wxEXPAND | wxBOTTOM, scale(2)); + }; - m_widget_time->SetValue(m_chart->get_time()); - m_widget_time->SetDigits(2); + add_title(_L("Total ramming")); + add_spin( _L("Time") , m_widget_time ); + add_spin( _L("Volume"), m_widget_volume); + + sizer_param->AddSpacer(10); + + add_title(_L("Ramming line")); + add_spin( _L("Width") , m_widget_ramming_line_width_multiplicator); + add_spin( _L("Spacing"), m_widget_ramming_step_multiplicator ); + + m_widget_time->SetValue(int(m_chart->get_time() * 1000)); m_widget_volume->SetValue(m_chart->get_volume()); m_widget_volume->Disable(); m_widget_ramming_line_width_multiplicator->SetValue(m_ramming_line_width_multiplicator); - m_widget_ramming_step_multiplicator->SetValue(m_ramming_step_multiplicator); - - m_widget_ramming_step_multiplicator->Bind(wxEVT_TEXT,[this](wxCommandEvent&) { line_parameters_changed(); }); - m_widget_ramming_line_width_multiplicator->Bind(wxEVT_TEXT,[this](wxCommandEvent&) { line_parameters_changed(); }); + m_widget_ramming_step_multiplicator->SetValue(m_ramming_step_multiplicator); + + m_widget_ramming_step_multiplicator->Bind(wxEVT_SPINCTRL,[this](wxCommandEvent&) { line_parameters_changed(); }); + m_widget_ramming_line_width_multiplicator->Bind(wxEVT_SPINCTRL,[this](wxCommandEvent&) { line_parameters_changed(); }); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(sizer_chart, 0, wxALL, 5); @@ -170,10 +173,15 @@ RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters) sizer->SetSizeHints(this); SetSizer(sizer); - m_widget_time->Bind(wxEVT_TEXT,[this](wxCommandEvent&) {m_chart->set_xy_range(m_widget_time->GetValue(),-1);}); + m_widget_time->Bind(wxEVT_SPINCTRL,[this](wxCommandEvent&) { + m_chart->set_xy_range(m_widget_time->GetValue() * 0.001,-1); + }); m_widget_time->Bind(wxEVT_CHAR,[](wxKeyEvent&){}); // do nothing - prevents the user to change the value m_widget_volume->Bind(wxEVT_CHAR,[](wxKeyEvent&){}); // do nothing - prevents the user to change the value - Bind(EVT_WIPE_TOWER_CHART_CHANGED,[this](wxCommandEvent&) {m_widget_volume->SetValue(m_chart->get_volume()); m_widget_time->SetValue(m_chart->get_time());} ); + Bind(EVT_WIPE_TOWER_CHART_CHANGED,[this](wxCommandEvent&) { + m_widget_volume->SetValue(m_chart->get_volume()); + m_widget_time->SetValue(m_chart->get_time() * 1000); + }); Refresh(true); // erase background } @@ -340,7 +348,7 @@ void WipingDialog::on_dpi_changed(const wxRect &suggested_rect) // Parent dialog for purging volume adjustments - it fathers WipingPanel widget (that contains all controls) and a button to toggle simple/advanced mode: WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruders, const std::vector& extruder_colours, const std::vector&extra_flush_volume, float flush_multiplier) - : DPIDialog(parent ? parent : static_cast(wxGetApp().mainframe), + : GUI::DPIDialog(parent ? parent : static_cast(wxGetApp().mainframe), wxID_ANY, _(L("Flushing volumes for filament change")), wxDefaultPosition, diff --git a/src/slic3r/GUI/WipeTowerDialog.hpp b/src/slic3r/GUI/WipeTowerDialog.hpp index 4a1abfaad2..31ffe2f080 100644 --- a/src/slic3r/GUI/WipeTowerDialog.hpp +++ b/src/slic3r/GUI/WipeTowerDialog.hpp @@ -10,6 +10,8 @@ #include #include +#include "Widgets/SpinInput.hpp" + #include "RammingChart.hpp" class Button; class Label; @@ -23,10 +25,10 @@ public: private: Chart* m_chart = nullptr; - wxSpinCtrl* m_widget_volume = nullptr; - wxSpinCtrl* m_widget_ramming_line_width_multiplicator = nullptr; - wxSpinCtrl* m_widget_ramming_step_multiplicator = nullptr; - wxSpinCtrlDouble* m_widget_time = nullptr; + SpinInput* m_widget_volume = nullptr; + SpinInput* m_widget_ramming_line_width_multiplicator = nullptr; + SpinInput* m_widget_ramming_step_multiplicator = nullptr; + SpinInput* m_widget_time = nullptr; int m_ramming_step_multiplicator; int m_ramming_line_width_multiplicator; diff --git a/src/slic3r/GUI/calib_dlg.cpp b/src/slic3r/GUI/calib_dlg.cpp index ee1ce3e23c..92455ec5de 100644 --- a/src/slic3r/GUI/calib_dlg.cpp +++ b/src/slic3r/GUI/calib_dlg.cpp @@ -348,7 +348,7 @@ Temp_Calibration_Dlg::Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plat Layout(); Fit(); - auto validate_text = [this](TextInput* ti){ + auto validate_text = [](TextInput* ti){ unsigned long t = 0; if(!ti->GetTextCtrl()->GetValue().ToULong(&t)) return; @@ -395,7 +395,7 @@ void Temp_Calibration_Dlg::on_start(wxCommandEvent& event) { } m_params.start = start; m_params.end = end; - m_params.mode =CalibMode::Calib_Temp_Tower; + m_params.mode = CalibMode::Calib_Temp_Tower; m_plater->calib_temp(m_params); EndModal(wxID_OK); @@ -403,7 +403,7 @@ void Temp_Calibration_Dlg::on_start(wxCommandEvent& event) { void Temp_Calibration_Dlg::on_filament_type_changed(wxCommandEvent& event) { int selection = event.GetSelection(); - unsigned long start,end; + unsigned long start = 0, end = 0; switch(selection) { case tABS_ASA: @@ -1112,4 +1112,4 @@ void Junction_Deviation_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect) { Fit(); } -}} // namespace Slic3r::GUI \ No newline at end of file +}} // namespace Slic3r::GUI diff --git a/src/slic3r/Utils/NetworkAgent.cpp b/src/slic3r/Utils/NetworkAgent.cpp index eb80e95217..6938ce8ec1 100644 --- a/src/slic3r/Utils/NetworkAgent.cpp +++ b/src/slic3r/Utils/NetworkAgent.cpp @@ -1264,7 +1264,7 @@ std::string NetworkAgent::request_setting_id(std::string name, std::map* values_map, unsigned int* http_code) { - int ret; + int ret = 0; if (network_agent && put_setting_ptr) { ret = put_setting_ptr(network_agent, setting_id, name, values_map, http_code); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" : network_agent=%1%, setting_id=%2%, name=%3%, http_code=%4%, ret=%5%") @@ -1424,7 +1424,7 @@ int NetworkAgent::get_subtask_info(std::string subtask_id, std::string* task_jso int NetworkAgent::get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json) { - int ret; + int ret = 0; if (network_agent && get_slice_info_ptr) { ret = get_slice_info_ptr(network_agent, project_id, profile_id, plate_index, slice_json); BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" : network_agent=%1%, project_id=%2%, profile_id=%3%, plate_index=%4%, slice_json=%5%") @@ -1435,7 +1435,7 @@ int NetworkAgent::get_slice_info(std::string project_id, std::string profile_id, int NetworkAgent::query_bind_status(std::vector query_list, unsigned int* http_code, std::string* http_body) { - int ret; + int ret = 0; if (network_agent && query_bind_status_ptr) { ret = query_bind_status_ptr(network_agent, query_list, http_code, http_body); if (ret)