Bootstrap

Cura gui 代码编译流程

cura安装流程

安装教程:https://github.com/Ultimaker/Cura/wiki/Running-Cura-from-Source-on-Windows

  • 安装的cura为4.4版本,后续的各个包都按4.4版本的需求进行

  • 设置anaconda新环境,python设置为3.8

pip install scipy cryptography colorlog netifaces zeroconf trimesh sentry_sdk pyserial PyQt5==5.15.2 keyring requests pywin32 

安装相应的包

  • 使用开始目录下的Developer Command Prompt for VS 2019并激活activate相应的python环境
  • 所有的包安装都需要在上述的Command中通过命令行的形式完成
protobuf
  • Download Protobuf 3.15.7 from here.
  • Extract it to C:/dev so that you then have a C:/dev/protobuf-3.15.7 directory.
  • Navigate to the protobuf-3.15.7 directory:
cd C:/dev/protobuf-3.15.7
  • Create the build and install directories.
  • Build and install Protobuf
cmake -DCMAKE_INSTALL_PREFIX=../install_dir -DCMAKE_INSTALL_LIBDIR=lib -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" ../cmake
nmake
nmake install
sip
  • Download SIP 4.19.25 from here.
  • Extract it to C:/dev so it creates a C:/dev/sip-4.19.25 directory. The last part of the version should be removed from the name.
  • Navigate to the sip-4.19.25 directory:
cd C:/dev/sip-4.19.25
  • Build and install SIP (again making sure to use the command prompt provided by Visual Studio):
python configure.py
nmake
nmake install
arcus

一开始这个库的python版本老是安装在c盘的一个python3.9路径下,把该python3.9移开后可正常安装在anaconda的环境中

同时报错找不到pyhon3.8.lib也是由于上面找不到正常的安装路径导致

  • Clone the libArcus repository
git clone -b "build_from_source_windows" https://github.com/Ultimaker/libArcus.git C:\dev\libArcus

此处若后续编译出现python版本不匹配的情况,通过git checkout命令将包切换至远端origin/4.4

  • Navigate to the libArcus directory
cd C:\dev\libArcus
  • Create the build directory:
mkdir install_dir
mkdir build && cd build
  • Set the environment variables for Protobuf:
set PROTOBUF_SRC=J:\code\software_lib\cura\cura_4.4_related\protobuf-3.15.7
set PROTOBUF_INSTALL=%PROTOBUF_SRC%\install_dir
  • Build and install libArcus (again making sure to use the command prompt provided by visual studio):
cmake -DCMAKE_INSTALL_PREFIX=../install_dir -DPROTOBUF_SRC_ROOT_FOLDER=%PROTOBUF_SRC% -DPROTOBUF_LIBRARY=%PROTOBUF_INSTALL%/lib/libprotobuf.lib  -DPROTOBUF_INCLUDE_DIR=%PROTOBUF_INSTALL%/include -DPROTOBUF_PROTOC_EXECUTABLE=%PROTOBUF_INSTALL%/bin/protoc.exe -DBUILD_EXAMPLES=OFF -DBUILD_STATIC=ON -DMSVC_STATIC_RUNTIME=ON -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" ..
nmake
nmake install
Savitar

按照说明安装即可

Charon

按照说明安装即可

pynest2d

此处坑比较多,详细操作如下:

  • git clone Ultimaker的libnest2d库
  • 将库切换到分支CURA-7754_add_disallowed_areas
    • 此处切换分支是因为主分支不包含external文件夹,cmake不会自动下载boost,clipper,NLopt库
    • 该分支包含external文件夹
  • 将分支中external中的boost库cmakelist中的下载地址更换为:https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.gz
    • 此处是安装libnest原项目中的boost库下载地址设置的
    • libnest库必须使用Ultimaker fork后的库,否则编译时会报错

按照说明安装即可

CuraEngine

此处参考官方文档即可
但在最后编译CuraEngin.exe时会报错,是编译的makefile中路径出现错误

g++.exe: error: J:codesoftware_libcuraCuraEngine4.4relatedprotobuf-3.15.7-mingw/install_dir/lib/libprotobuf.a: No such file or directory

通过vscode直接查找cmak_build文件夹中包含libprotobuf.a的路径,把路径中的斜杠全部改为反斜杠\即可
实际修改了build.make和linklibs.rsp
image-20220512111617235

Cura

按照说明将CuraEngine.exe复制到Cura的文件夹下运行cura_app.py即可

报错缺少shapely,pip install shapely即可

image-20220511223742523
目前发现存在bug,slice切片无法使用
尚未解决

;