Update dependency

This commit is contained in:
QIDI TECH
2024-11-28 14:53:09 +08:00
parent 506ff7ad8c
commit db50a0814e
17 changed files with 250 additions and 26 deletions

View File

@@ -119,7 +119,7 @@ fi
if ! [[ -n "${DISABLE_PARALLEL_LIMIT}" ]] if ! [[ -n "${DISABLE_PARALLEL_LIMIT}" ]]
then then
FREE_MEM_GB=$(free -g -t | grep 'Mem' | rev | cut -d" " -f1 | rev) FREE_MEM_GB=$(free -g -t | grep 'Mem' | rev | cut -d" " -f1 | rev)
MAX_THREADS=$(echo "scale=0; $FREE_MEM_GB / 2.5" | bc) MAX_THREADS=$((FREE_MEM_GB * 10 / 25))
if [ "$MAX_THREADS" -lt 1 ]; then if [ "$MAX_THREADS" -lt 1 ]; then
export CMAKE_BUILD_PARALLEL_LEVEL=1 export CMAKE_BUILD_PARALLEL_LEVEL=1
else else

View File

@@ -42,6 +42,7 @@ set(SLIC3R_GTK "2" CACHE STRING "GTK version to use with wxWidgets on Linux")
set(IS_CROSS_COMPILE FALSE) set(IS_CROSS_COMPILE FALSE)
set(FLATPAK FALSE CACHE BOOL "Not copy FFMPEG file")
if (APPLE) if (APPLE)
set(CMAKE_FIND_FRAMEWORK LAST) set(CMAKE_FIND_FRAMEWORK LAST)
@@ -54,6 +55,8 @@ if (APPLE)
set(CMAKE_INSTALL_RPATH @executable_path/../Frameworks) set(CMAKE_INSTALL_RPATH @executable_path/../Frameworks)
endif() endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_INSTALL_RPATH "$ORIGIN")
endif () endif ()
# Proposal for C++ unit tests and sandboxes # Proposal for C++ unit tests and sandboxes
@@ -167,6 +170,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# WIN10SDK_PATH is used to point CMake to the WIN10 SDK installation directory. # WIN10SDK_PATH is used to point CMake to the WIN10 SDK installation directory.
# We pick it from environment if it is not defined in another way # We pick it from environment if it is not defined in another way
if(WIN32) if(WIN32)
find_package(PkgConfig REQUIRED)
if(NOT DEFINED WIN10SDK_PATH) if(NOT DEFINED WIN10SDK_PATH)
if(DEFINED ENV{WIN10SDK_PATH}) if(DEFINED ENV{WIN10SDK_PATH})
set(WIN10SDK_PATH "$ENV{WIN10SDK_PATH}") set(WIN10SDK_PATH "$ENV{WIN10SDK_PATH}")
@@ -619,6 +623,10 @@ function(qidistudio_copy_dlls target config postfix output_dlls)
${CMAKE_PREFIX_PATH}/bin/occt/TKXDESTEP.dll ${CMAKE_PREFIX_PATH}/bin/occt/TKXDESTEP.dll
${CMAKE_PREFIX_PATH}/bin/occt/TKXSBase.dll ${CMAKE_PREFIX_PATH}/bin/occt/TKXSBase.dll
${CMAKE_PREFIX_PATH}/bin/freetype.dll ${CMAKE_PREFIX_PATH}/bin/freetype.dll
${CMAKE_PREFIX_PATH}/bin/avcodec-61.dll
${CMAKE_PREFIX_PATH}/bin/swresample-5.dll
${CMAKE_PREFIX_PATH}/bin/swscale-8.dll
${CMAKE_PREFIX_PATH}/bin/avutil-59.dll
DESTINATION ${_out_dir}) DESTINATION ${_out_dir})
set(${output_dlls} set(${output_dlls}
@@ -654,11 +662,50 @@ function(qidistudio_copy_dlls target config postfix output_dlls)
${_out_dir}/TKXSBase.dll ${_out_dir}/TKXSBase.dll
${_out_dir}/freetype.dll ${_out_dir}/freetype.dll
${_out_dir}/avcodec-61.dll
${_out_dir}/swresample-5.dll
${_out_dir}/swscale-8.dll
${_out_dir}/avutil-59.dll
PARENT_SCOPE PARENT_SCOPE
) )
endfunction() endfunction()
function(qidistudio_copy_sos target config postfix output_sos)
set(_out_dir "${CMAKE_CURRENT_BINARY_DIR}")
message ("set out_dir to CMAKE_CURRENT_BINARY_DIR: ${_out_dir}")
file(COPY ${CMAKE_PREFIX_PATH}/lib/libavcodec.so
${CMAKE_PREFIX_PATH}/lib/libavcodec.so.61
${CMAKE_PREFIX_PATH}/lib/libavcodec.so.61.3.100
${CMAKE_PREFIX_PATH}/lib/libavutil.so
${CMAKE_PREFIX_PATH}/lib/libavutil.so.59
${CMAKE_PREFIX_PATH}/lib/libavutil.so.59.8.100
${CMAKE_PREFIX_PATH}/lib/libswscale.so
${CMAKE_PREFIX_PATH}/lib/libswscale.so.8
${CMAKE_PREFIX_PATH}/lib/libswscale.so.8.1.100
${CMAKE_PREFIX_PATH}/lib/libswresample.so
${CMAKE_PREFIX_PATH}/lib/libswresample.so.5
${CMAKE_PREFIX_PATH}/lib/libswresample.so.5.1.100
DESTINATION ${_out_dir})
set(${output_dlls}
${_out_dir}/libavcodec.so
${_out_dir}/libavcodec.so.61
${_out_dir}/libavcodec.so.61.3.100
${_out_dir}/libavutil.so
${_out_dir}/libavutil.so.59
${_out_dir}/libavutil.so.59.8.100
${_out_dir}/libswscale.so
${_out_dir}/libswscale.so.8
${_out_dir}/libswscale.so.8.1.100
${_out_dir}/libswresample.so
${_out_dir}/libswresample.so.5
${_out_dir}/libswresample.so.5.1.100
PARENT_SCOPE
)
endfunction()
# libslic3r, QIDIStudio GUI and the QIDIStudio executable. # libslic3r, QIDIStudio GUI and the QIDIStudio executable.
add_subdirectory(src) add_subdirectory(src)
@@ -714,4 +761,18 @@ else ()
install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${CMAKE_INSTALL_PREFIX}/resources") install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${CMAKE_INSTALL_PREFIX}/resources")
endif () endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT FLATPAK)
set(LIBRARY_FILES
${LIBDIR_BIN}/libavcodec.so.61
${LIBDIR_BIN}/libavcodec.so.61.3.100
${LIBDIR_BIN}/libavutil.so.59
${LIBDIR_BIN}/libavutil.so.59.8.100
${LIBDIR_BIN}/libswresample.so.5
${LIBDIR_BIN}/libswresample.so.5.1.100
${LIBDIR_BIN}/libswscale.so.8
${LIBDIR_BIN}/libswscale.so.8.1.100
)
install(FILES ${LIBRARY_FILES} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
endif ()
configure_file(${LIBDIR}/platform/unix/fhs.hpp.in ${LIBDIR_BIN}/platform/unix/fhs.hpp) configure_file(${LIBDIR}/platform/unix/fhs.hpp.in ${LIBDIR_BIN}/platform/unix/fhs.hpp)

View File

@@ -11,7 +11,7 @@
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string> <string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>com.qidilab.qidi-studio</string> <string>com.qiditech.qidi-studio</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleLongVersionString</key> <key>CFBundleLongVersionString</key>
@@ -129,5 +129,10 @@
<true/> <true/>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string> <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict> </dict>
</plist> </plist>

View File

@@ -1,5 +1,5 @@
From 1d6cd7c2f8640db3cda194c1b9b82f1e4b321395 Mon Sep 17 00:00:00 2001 From 1d6cd7c2f8640db3cda194c1b9b82f1e4b321395 Mon Sep 17 00:00:00 2001
From: "chunmao.guo" <chunmao.guo@qidilab.com> From: "chunmao.guo" <chunmao.guo@qiditech.com>
Date: Thu, 5 Jan 2023 15:55:57 +0800 Date: Thu, 5 Jan 2023 15:55:57 +0800
Subject: [PATCH] FIX: limit_handles Subject: [PATCH] FIX: limit_handles

View File

@@ -129,7 +129,7 @@ list(APPEND _patch_command COMMAND git init && ${PATCH_CMD} ${CMAKE_CURRENT_LIST
ExternalProject_Add( ExternalProject_Add(
dep_Boost dep_Boost
#URL "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.zip" #URL "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.zip"
URL "https://github.com/qidilab/boost/releases/download/1.78.0/boost_1_78_0.zip" URL "https://github.com/qiditech/boost/releases/download/1.78.0/boost_1_78_0.zip"
URL_HASH SHA256=f22143b5528e081123c3c5ed437e92f648fe69748e95fa6e2bd41484e2986cc3 URL_HASH SHA256=f22143b5528e081123c3c5ed437e92f648fe69748e95fa6e2bd41484e2986cc3
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/Boost DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/Boost
CONFIGURE_COMMAND "${_bootstrap_cmd}" CONFIGURE_COMMAND "${_bootstrap_cmd}"

7
deps/CMakeLists.txt vendored
View File

@@ -39,6 +39,7 @@ option(DEP_BUILD_OPENSSL "Compile openssl" ON)
option(DEP_BUILD_GLFW "Compile GLFW" ON) option(DEP_BUILD_GLFW "Compile GLFW" ON)
option(DEP_BUILD_FREETYPE "Compile freetype" ON) option(DEP_BUILD_FREETYPE "Compile freetype" ON)
option(DEP_BUILD_WXWIDGETS "Compile wxWidgets" ON) option(DEP_BUILD_WXWIDGETS "Compile wxWidgets" ON)
option(DEP_BUILD_FFMPEG "Compile ffmpeg" ON)
set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory") set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory")
set(DEP_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Path for downloaded source packages.") set(DEP_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Path for downloaded source packages.")
@@ -229,6 +230,11 @@ if (DEP_BUILD_FREETYPE)
endif () endif ()
include(OCCT/OCCT.cmake) include(OCCT/OCCT.cmake)
include(OpenCV/OpenCV.cmake) include(OpenCV/OpenCV.cmake)
set(FFMPEG_PKG "")
if (DEP_BUILD_FFMPEG)
include(FFMPEG/FFMPEG.cmake)
set(FFMPEG_PKG dep_FFMPEG)
endif ()
set(_dep_list set(_dep_list
${BOOST_PKG} ${BOOST_PKG}
@@ -247,6 +253,7 @@ set(_dep_list
${ZLIB_PKG} ${ZLIB_PKG}
${EXPAT_PKG} ${EXPAT_PKG}
${FREETYPE_PKG} ${FREETYPE_PKG}
${FFMPEG_PKG}
) )
if (MSVC) if (MSVC)

60
deps/FFMPEG/FFMPEG.cmake vendored Normal file
View File

@@ -0,0 +1,60 @@
set(_conf_cmd ./configure)
if (MSVC)
set(_dstdir ${DESTDIR}/usr/local)
set(_source_dir "${CMAKE_BINARY_DIR}/dep_FFMPEG-prefix/src/dep_FFMPEG")
ExternalProject_Add(dep_FFMPEG
URL https://github.com/qiditech/ffmpeg_prebuilts/releases/download/7.0.2/7.0.2_msvc.zip
URL_HASH SHA256=DF44AE6B97CE84C720695AE7F151B4A9654915D1841C68F10D62A1189E0E7181
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/FFMPEG
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND
# COMMAND ${CMAKE_COMMAND} -E make_directory "${_dstdir}/bin"
# COMMAND ${CMAKE_COMMAND} -E make_directory "${_dstdir}/lib"
# COMMAND ${CMAKE_COMMAND} -E make_directory "${_dstdir}/include"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${_source_dir}/bin" "${_dstdir}/bin"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${_source_dir}/lib" "${_dstdir}/lib"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${_source_dir}/include" "${_dstdir}/include"
)
else ()
set(_extra_cmd "--pkg-config-flags=\"--static\"")
string(APPEND _extra_cmd "--extra-cflags=\"-I ${DESTDIR}/usr/local/include\"")
string(APPEND _extra_cmd "--extra-ldflags=\"-I ${DESTDIR}/usr/local/lib\"")
string(APPEND _extra_cmd "--extra-libs=\"-lpthread -lm\"")
string(APPEND _extra_cmd "--ld=\"g++\"")
string(APPEND _extra_cmd "--bindir=\"${DESTDIR}/usr/local/bin\"")
string(APPEND _extra_cmd "--enable-gpl")
string(APPEND _extra_cmd "--enable-nonfree")
ExternalProject_Add(dep_FFMPEG
URL https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n7.0.2.tar.gz
URL_HASH SHA256=5EB46D18D664A0CCADF7B0ADEE03BD3B7FA72893D667F36C69E202A807E6D533
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/FFMPEG
CONFIGURE_COMMAND ${_conf_cmd}
"--prefix=${DESTDIR}/usr/local"
"--enable-shared"
"--disable-doc"
"--enable-small"
"--disable-outdevs"
"--disable-filters"
"--enable-filter=*null*,afade,*fifo,*format,*resample,aeval,allrgb,allyuv,atempo,pan,*bars,color,*key,crop,draw*,eq*,framerate,*_qsv,*_vaapi,*v4l2*,hw*,scale,volume,test*"
"--disable-protocols"
"--enable-protocol=file,fd,pipe,rtp,udp"
"--disable-muxers"
"--enable-muxer=rtp"
"--disable-encoders"
"--disable-decoders"
"--enable-decoder=*aac*,h264*,mp3*,mjpeg,rv*"
"--disable-demuxers"
"--enable-demuxer=h264,mp3,mov"
"--disable-zlib"
"--disable-avdevice"
BUILD_IN_SOURCE ON
BUILD_COMMAND make -j
INSTALL_COMMAND make install
)
endif()

2
deps/GMP/GMP.cmake vendored
View File

@@ -43,7 +43,7 @@ else ()
endif () endif ()
ExternalProject_Add(dep_GMP ExternalProject_Add(dep_GMP
URL https://github.com/qidilab/gmp/archive/refs/tags/6.2.1.tar.gz URL https://github.com/qiditech/gmp/archive/refs/tags/6.2.1.tar.gz
URL_HASH SHA256=705ae57ee2014b2c6fc0f572c85ee43276b99b6b256ee16c1a9d3a8c4e3609d5 URL_HASH SHA256=705ae57ee2014b2c6fc0f572c85ee43276b99b6b256ee16c1a9d3a8c4e3609d5
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/GMP DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/GMP
BUILD_IN_SOURCE ON BUILD_IN_SOURCE ON

View File

@@ -23,7 +23,7 @@ endif ()
# endif () # endif ()
qidistudio_add_cmake_project(wxWidgets qidistudio_add_cmake_project(wxWidgets
GIT_REPOSITORY "https://github.com/bambulab/wxWidgets" GIT_REPOSITORY "https://github.com/qiditech/wxWidgets"
GIT_TAG master GIT_TAG master
DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} ${TIFF_PKG} ${JPEG_PKG} DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} ${TIFF_PKG} ${JPEG_PKG}
CMAKE_ARGS CMAKE_ARGS

View File

@@ -13,7 +13,7 @@ Full manual for GNUgettext can be seen here: http://www.gnu.org/software/gettext
### Scenario 1. How do I add a translation or fix an existing translation ### Scenario 1. How do I add a translation or fix an existing translation
1. Get PO-file 'QIDIStudio_xx.pot' from corresponding sub-folder here: 1. Get PO-file 'QIDIStudio_xx.pot' from corresponding sub-folder here:
https://github.com/qidilab/QIDIStudio/tree/master/qdt/i18n https://github.com/qiditech/QIDIStudio/tree/master/qdt/i18n
2. Open this file in PoEdit as "Edit a translation" 2. Open this file in PoEdit as "Edit a translation"
3. Apply your corrections to the translation 3. Apply your corrections to the translation
4. Push changed QIDIStudio_xx.po into the original folder 4. Push changed QIDIStudio_xx.po into the original folder
@@ -21,14 +21,14 @@ https://github.com/qidilab/QIDIStudio/tree/master/qdt/i18n
### Scenario 2. How do I add a new language support ### Scenario 2. How do I add a new language support
1. Get file QIDIStudio.pot here : 1. Get file QIDIStudio.pot here :
https://github.com/qidilab/QIDIStudio/tree/master/qdt/i18n https://github.com/qiditech/QIDIStudio/tree/master/qdt/i18n
2. Open it in PoEdit for "Create new translation" 2. Open it in PoEdit for "Create new translation"
3. Select Translation Language (for example French). 3. Select Translation Language (for example French).
4. As a result you will have fr.po - the file containing translation to French. 4. As a result you will have fr.po - the file containing translation to French.
Notice. When the translation is complete you need to: Notice. When the translation is complete you need to:
- Rename the file to QIDIStudio_fr.po - Rename the file to QIDIStudio_fr.po
- Click "Save file" button. QIDIStudio_fr.mo will be created immediately - Click "Save file" button. QIDIStudio_fr.mo will be created immediately
- QIDI_Studio_fr.po needs to be copied into the sub-folder fr of https://github.com/qidilab/QIDIStudio/tree/master/qdt/i18n, and be pushed - QIDI_Studio_fr.po needs to be copied into the sub-folder fr of https://github.com/qiditech/QIDIStudio/tree/master/qdt/i18n, and be pushed
- copy QIDIStudio_xx.mo into resources/i18n/xx and rename it to QIDIStudio.mo, then push the changed file. - copy QIDIStudio_xx.mo into resources/i18n/xx and rename it to QIDIStudio.mo, then push the changed file.
( name of folder "fr" means "French" - the translation language). ( name of folder "fr" means "French" - the translation language).
@@ -43,7 +43,7 @@ If you add new file resource, add it to the list of files containing macro `L()`
### Scenario 4. How do I use GNUgettext to localize my own application taking QIDI Studio as an example ### Scenario 4. How do I use GNUgettext to localize my own application taking QIDI Studio as an example
1. For convenience create a list of files with this macro `L(s)`. We have 1. For convenience create a list of files with this macro `L(s)`. We have
https://github.com/qidilab/QIDIStudio/blob/master/qdt/i18n/list.txt. https://github.com/qiditech/QIDIStudio/blob/master/qdt/i18n/list.txt.
2. Create template file(*.POT) with GNUgettext command: 2. Create template file(*.POT) with GNUgettext command:
``` ```

View File

@@ -15,4 +15,4 @@
7. 支持匈牙利语 7. 支持匈牙利语
8. 一些关键问题修复 8. 一些关键问题修复
详细信息请查看https://github.com/qidilab/QIDIStudio/releases 详细信息请查看https://github.com/qiditech/QIDIStudio/releases

View File

@@ -15,4 +15,4 @@
7. Added Magyar translations 7. Added Magyar translations
8. Fixed some known bugs 8. Fixed some known bugs
For details, please check https://github.com/qidilab/QIDIStudio/releases For details, please check https://github.com/qiditech/QIDIStudio/releases

View File

@@ -27,16 +27,19 @@ REQUIRED_DEV_PACKAGES=(
libunwind-dev libunwind-dev
libfuse2 libfuse2
texinfo texinfo
nasm
yasm
libx264-dev
) )
if [[ -n "$UPDATE_LIB" ]] if [[ -n "$UPDATE_LIB" ]]
then then
# for ubuntu 22+ and 23+: # for ubuntu 22+ and 23+:
ubu_major_version="$(grep VERSION_ID /etc/os-release | cut -d "=" -f 2 | cut -d "." -f 1 | tr -d /\"/)" ubu_major_version="$(grep VERSION_ID /etc/os-release | cut -d "=" -f 2 | cut -d "." -f 1 | tr -d /\"/)"
if [ $ubu_major_version == "22" ] || [ $ubu_major_version == "23" ] if [ $ubu_major_version = "22" ] || [ $ubu_major_version = "23" ]
then then
REQUIRED_DEV_PACKAGES+=(libwebkit2gtk-4.0-dev curl libfuse-dev libssl-dev libcurl4-openssl-dev m4) REQUIRED_DEV_PACKAGES+=(libwebkit2gtk-4.0-dev curl libfuse-dev libssl-dev libcurl4-openssl-dev m4)
elif [ $ubu_major_version == "24" ] elif [ $ubu_major_version = "24" ]
then then
REQUIRED_DEV_PACKAGES+=(libwebkit2gtk-4.1-dev) REQUIRED_DEV_PACKAGES+=(libwebkit2gtk-4.1-dev)
else else

View File

@@ -35,6 +35,9 @@ REQUIRED_DEV_PACKAGES=(
wget wget
libcurl-devel libcurl-devel
libquadmath-devel libquadmath-devel
nasm
yasm
x264-devel
) )
if [[ -n "$UPDATE_LIB" ]] if [[ -n "$UPDATE_LIB" ]]
@@ -52,6 +55,8 @@ then
done done
if [ -n "${NEEDED_PKGS}" ]; then if [ -n "${NEEDED_PKGS}" ]; then
sudo dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf -y update
sudo dnf install -y ${NEEDED_PKGS} sudo dnf install -y ${NEEDED_PKGS}
fi fi
echo -e "done\n" echo -e "done\n"

View File

@@ -17,9 +17,12 @@ const std::string Extrusion_Role_Tag = " FEATURE: ";
const std::string Width_Tag = " LINE_WIDTH: "; const std::string Width_Tag = " LINE_WIDTH: ";
const std::string Wipe_Start_Tag = " WIPE_START"; const std::string Wipe_Start_Tag = " WIPE_START";
const std::string Wipe_End_Tag = " WIPE_END"; const std::string Wipe_End_Tag = " WIPE_END";
const std::string Wipe_Tower_Start_Tag = " WIPE_TOWER_START";
const std::string Wipe_Tower_End_Tag = " WIPE_TOWER_END";
const std::string Layer_Change_Tag = " CHANGE_LAYER"; const std::string Layer_Change_Tag = " CHANGE_LAYER";
const std::string Height_Tag = " LAYER_HEIGHT: "; const std::string Height_Tag = " LAYER_HEIGHT: ";
const std::string filament_flow_ratio_tag = " filament_flow_ratio"; const std::string filament_flow_ratio_tag = " filament_flow_ratio";
const std::string has_scarf_joint_seam_tag = " has_scarf_joint_seam";
const std::string nozzle_temperature_Tag = " nozzle_temperature ="; const std::string nozzle_temperature_Tag = " nozzle_temperature =";
const std::string nozzle_temperature_initial_layer_Tag = " nozzle_temperature_initial_layer"; const std::string nozzle_temperature_initial_layer_Tag = " nozzle_temperature_initial_layer";
const std::string Z_HEIGHT_TAG = " Z_HEIGHT: "; const std::string Z_HEIGHT_TAG = " Z_HEIGHT: ";
@@ -130,6 +133,12 @@ GCodeCheckResult GCodeChecker::parse_comment(GCodeLine& line)
m_wiping = true; m_wiping = true;
} else if (starts_with(comment, Wipe_End_Tag)) { } else if (starts_with(comment, Wipe_End_Tag)) {
m_wiping = false; m_wiping = false;
}
else if (starts_with(comment, Wipe_Tower_Start_Tag)) {
is_wipe_tower = true;
}
else if (starts_with(comment, Wipe_Tower_End_Tag)) {
is_wipe_tower = false;
} else if (starts_with(comment, Height_Tag)) { } else if (starts_with(comment, Height_Tag)) {
std::string str = comment.substr(Height_Tag.size()); std::string str = comment.substr(Height_Tag.size());
if (!parse_double_from_str(str, m_height)) { if (!parse_double_from_str(str, m_height)) {
@@ -162,6 +171,11 @@ GCodeCheckResult GCodeChecker::parse_comment(GCodeLine& line)
return GCodeCheckResult::ParseFailed; return GCodeCheckResult::ParseFailed;
} }
} }
else if (starts_with(comment, has_scarf_joint_seam_tag))
{
std::string str = comment.substr(has_scarf_joint_seam_tag.size() + 3);
has_scarf_joint_seam = (str == "1");
}
else if (starts_with(comment, nozzle_temperature_Tag)) { else if (starts_with(comment, nozzle_temperature_Tag)) {
std::string str = comment.substr(nozzle_temperature_Tag.size() + 1); std::string str = comment.substr(nozzle_temperature_Tag.size() + 1);
if (!parse_double_from_str(str, nozzle_temperature)) { if (!parse_double_from_str(str, nozzle_temperature)) {
@@ -232,6 +246,10 @@ GCodeCheckResult GCodeChecker::parse_command(GCodeLine& gcode_line)
ret = parse_M104_M109(gcode_line); ret = parse_M104_M109(gcode_line);
break; break;
} // Set to nozzle temperature } // Set to nozzle temperature
case 1020: {
ret = parse_M1020(gcode_line);
break;
}
default: { break; } default: { break; }
} }
break; break;
@@ -407,20 +425,31 @@ GCodeCheckResult GCodeChecker::parse_G92(GCodeLine& gcode_line)
return GCodeCheckResult::ParseFailed; return GCodeCheckResult::ParseFailed;
} }
if (gcode_line.has(X)) bool any_found = false;
if (gcode_line.has(X)){
m_origin[X] = m_end_position[X] - gcode_line.get(X); m_origin[X] = m_end_position[X] - gcode_line.get(X);
any_found = true;
}
if (gcode_line.has(Y)) if (gcode_line.has(Y)){
m_origin[Y] = m_end_position[Y] - gcode_line.get(Y); m_origin[Y] = m_end_position[Y] - gcode_line.get(Y);
any_found = true;
}
if (gcode_line.has(Z)) if (gcode_line.has(Z)){
m_origin[Z] = m_end_position[Z] - gcode_line.get(Z); m_origin[Z] = m_end_position[Z] - gcode_line.get(Z);
any_found = true;
}
if (gcode_line.has(E)) if (gcode_line.has(E)){
m_end_position[E] = gcode_line.get(E); m_end_position[E] = gcode_line.get(E);
any_found = true;
}
for (unsigned char a = X; a <= E; ++a) { if (!any_found) {
m_origin[a] = m_end_position[a]; for (unsigned char a = X; a <= E; ++a) {
m_origin[a] = m_end_position[a];
}
} }
return GCodeCheckResult::Success; return GCodeCheckResult::Success;
@@ -469,6 +498,46 @@ GCodeCheckResult GCodeChecker::parse_M104_M109(const GCodeLine &gcode_line)
return GCodeCheckResult::Success; return GCodeCheckResult::Success;
} }
GCodeCheckResult GCodeChecker::parse_M1020(const GCodeLine& gcode_line)
{
const char* c = gcode_line.m_raw.c_str();
const char* rs = strchr(c, 'S');
if (rs != nullptr) {
std::string str = rs;
str = str.substr(1);
for (int i = 0; i < str.size(); i++) {
if (str[i] == ' ')
str = str.substr(0, i);
}
try {
int value = std::stoi(str);
if (value >= 0 && value <= filament_flow_ratio.size() - 1) {
filament_id = value;
flow_ratio = filament_flow_ratio[value];
return GCodeCheckResult::Success;
}
else {
return GCodeCheckResult::ParseFailed;
}
}
catch (std::invalid_argument&) {
std::cout << "Invalid argument: not a valid integer" << std::endl;
return GCodeCheckResult::ParseFailed;
}
catch (std::out_of_range&) {
std::cout << "Out of range: number is too large" << std::endl;
return GCodeCheckResult::ParseFailed;
}
}
else
{
std::cout << "Missing 'S' character in the G-code line!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
}
double GCodeChecker::calculate_G1_width(const std::array<double, 3>& source, double GCodeChecker::calculate_G1_width(const std::array<double, 3>& source,
const std::array<double, 3>& target, const std::array<double, 3>& target,
double e, double height, bool is_bridge) const double e, double height, bool is_bridge) const
@@ -593,8 +662,21 @@ GCodeCheckResult GCodeChecker::check_G0_G1_width(const GCodeLine& line)
std::array<double, 3> target = { m_end_position[X], m_end_position[Y], m_end_position[Z] }; std::array<double, 3> target = { m_end_position[X], m_end_position[Y], m_end_position[Z] };
bool is_bridge = m_role == erOverhangPerimeter || m_role == erBridgeInfill; bool is_bridge = m_role == erOverhangPerimeter || m_role == erBridgeInfill;
if (!is_bridge) { if (!is_bridge && !is_wipe_tower) {
double width_real = calculate_G1_width(source, target, delta_pos[E], m_height, is_bridge); double real_height = m_height;
if (line.has(Z) && has_scarf_joint_seam && line.get(Z) != 0)
{
if (line.get(Z) == z_height)
{
return GCodeCheckResult::Success;
}
if (line.get(Z) && line.get(E))
{
return GCodeCheckResult::Success;
}
real_height = line.get(Z) - (z_height - m_height);
}
double width_real = calculate_G1_width(source, target, delta_pos[E], real_height, is_bridge);
if (fabs(width_real - m_width) > WIDTH_THRESHOLD) { if (fabs(width_real - m_width) > WIDTH_THRESHOLD) {
std::cout << "Invalid G0_G1 because has abnormal line width." << std::endl; std::cout << "Invalid G0_G1 because has abnormal line width." << std::endl;
std::cout << "Width: " << m_width << " Width_real: " << width_real << std::endl; std::cout << "Width: " << m_width << " Width_real: " << width_real << std::endl;

View File

@@ -109,6 +109,7 @@ private:
GCodeCheckResult parse_M82(const GCodeLine& gcode_line); GCodeCheckResult parse_M82(const GCodeLine& gcode_line);
GCodeCheckResult parse_M83(const GCodeLine& gcode_line); GCodeCheckResult parse_M83(const GCodeLine& gcode_line);
GCodeCheckResult parse_M104_M109(const GCodeLine &gcode_line); GCodeCheckResult parse_M104_M109(const GCodeLine &gcode_line);
GCodeCheckResult parse_M1020(const GCodeLine& gcode_line);
GCodeCheckResult parse_comment(GCodeLine& gcode_line); GCodeCheckResult parse_comment(GCodeLine& gcode_line);
@@ -167,7 +168,7 @@ public:
std::string cmd=input; std::string cmd=input;
size_t read = 0; size_t read = 0;
while (cmd.size() >= 5) while (cmd.find(',') != std::string::npos)
{ {
int pt = 0; int pt = 0;
for (pt = 0; pt < cmd.size(); pt++) { for (pt = 0; pt < cmd.size(); pt++) {
@@ -217,6 +218,8 @@ private:
std::vector<double> filament_flow_ratio; std::vector<double> filament_flow_ratio;
std::vector<double> nozzle_temperature; std::vector<double> nozzle_temperature;
std::vector<double> nozzle_temperature_initial_layer; std::vector<double> nozzle_temperature_initial_layer;
bool has_scarf_joint_seam = false;
bool is_wipe_tower = false;
}; };
} }

View File

@@ -7,8 +7,6 @@ set(SLIC3R_APP_KEY "QIDIStudio")
if(NOT DEFINED QDT_RELEASE_TO_PUBLIC) if(NOT DEFINED QDT_RELEASE_TO_PUBLIC)
set(QDT_RELEASE_TO_PUBLIC "0") set(QDT_RELEASE_TO_PUBLIC "0")
endif() endif()
# Note that defining QDT_INTERNAL_TESTING will create a beta version
# not an "internal testing" version (the default)
if(NOT DEFINED QDT_INTERNAL_TESTING) if(NOT DEFINED QDT_INTERNAL_TESTING)
set(QDT_INTERNAL_TESTING "1") set(QDT_INTERNAL_TESTING "1")
endif() endif()