一 环境安装
本次安装过程参考官方wiki: https://github.com/Ultimaker/Cura/wiki/Running-Cura-from-Source
-
Windows 10 or higher
笔者使用的是 win11 -
Visual Studio with MSVC 2022 or higher
https://visualstudio.microsoft.com/zh-hans/thank-you-downloading-visual-studio/?sku=Community&channel=Release&version=VS2022&source=VSLandingPage&cid=2030&passive=false
下载并安装社区版,注意在安装时候需要勾选“使用C++的桌面开发”选项 -
Python 3.10.4 or higher
https://www.python.org/downloads/
下载python3.11.3 版本
python安装好后,使用pip安装一些工具,打开powershell(win+x组合键,选择终端管理员),运行一下指令
#venv (Python)
pip3 install virtualenv
#sip (Python)官方要求 6.5.1,但是笔者亲测至少5.4版本必须高于6.5.1
pip install sip
#官方要求CMake 3.23 or higher,所以:
Pip install cmake
#Ninja 1.10 or higher
pip install ninja
#Conan 1.56.0注意必须是1.56.0
pip insall conan==1.56.0
另外官方的wiki推荐使用pychaim:
pycharm : https://www.jetbrains.com/zh-cn/pycharm/download/#section=windows 选择社区版下载
二、 安装环境
!!注意,接下来需要一个好点的梯子了
-
打开powershell
win+x组合键,选择终端管理员,点击powersheel的顶部下三角,选择Developer PowerShell for VS2022.(实际上亲测其实就使用powershell默认界面也行,但是有些文档推荐使用Developer PowerShell for VS2022) -
配置conan
``` conan remote remove cura conan config install https://github.com/ultimaker/conan-config.git conan profile new default --detect --force ```
三、 下载源码
新建cura_workspase文件夹
3.1 下载cura源码
在cura_workspase文件夹下
git clone https://github.com/Ultimaker/Cura.git
截至本文档生成之日,github上版本为5.4版本的,所以未来由于版本更新原因无法编译成功,可以尝试将版本切换到5.4版本,后面几个源码同样的操作。
git checkout 5.4
3.2下载Uranium源码
在cura_workspase文件夹下
git clone https://github.com/Ultimaker/Uranium.git
为了修改源码,必须使用本地的uranium,所以将uranium指向本地的源码,也可以不执行,使用conan下载的源码。
(meng修改成自己的名字)
cd uranium
conan editable add . uranium/5.4.0@meng/testing
3.3下载CuraEngine源码
在cura_workspase文件夹下
git clone https://github.com/Ultimaker/CuraEngine.git
使用git检查版本,如果不是5.4版本则:
git checkout 5.4
为了修改源码,必须使用本地的uranium,所以将uranium指向本地的源码,也可以不执行,使用conan下载的源码。
(meng修改成自己的名字)
cd curaEngine
conan editable add . curaEngine@meng/test
四、 配置环境并编译依赖项
使用conan下载并安装依赖项
cd cura
conan install . --build=missing --update -o cura:devtools=True -g VirtualPythonEnv -g PyCharmRunEnv --require-override=uranium/5.4.0@meng/testing --require-override=curaEngine/5.4.0-alpha+testing_54@meng/test
如果成功安装,则显示如下:
conanfile.py (cura/5.4.0-alpha): Generator 'MSBuildDeps' calling 'generate()'
conanfile.py (cura/5.4.0-alpha): Calling generate()
conanfile.py (cura/5.4.0-alpha): Copied 1 '.py' file: cura_app.py
conanfile.py (cura/5.4.0-alpha): Aggregating env generators
conanfile.py (cura/5.4.0-alpha): Generated conaninfo.txt
conanfile.py (cura/5.4.0-alpha): Generated graphinfo
conanfile.py (cura/5.4.0-alpha) imports(): Copied 243 '.fdm_material' files
conanfile.py (cura/5.4.0-alpha) imports(): Copied 3 '.pyd' files: pynest2d.pyd, pyArcus.pyd, pySavitar.pyd
conanfile.py (cura/5.4.0-alpha) imports(): Copied 21 '.hex' files
conanfile.py (cura/5.4.0-alpha) imports(): Copied 10 '.dll' files
conanfile.py (cura/5.4.0-alpha) imports(): Copied 1 '.gif' file: 1.gif
conanfile.py (cura/5.4.0-alpha) imports(): Copied 1 file: MarlinUltimaker-COPYING
conanfile.py (cura/5.4.0-alpha) imports(): Copied 3 '.png' files: 3.png, 0.png, 2.png
conanfile.py (cura/5.4.0-alpha) imports(): Copied 1 '.exe' file: CuraEngine.exe
conanfile.py (cura/5.4.0-alpha) imports(): Copied 4 '.html' files: 1.html, 0.html, 3.html, 2.html
conanfile.py (cura/5.4.0-alpha) imports(): Copied 4 '.txt' files: Attribution.txt, commit-ids.txt, sha1hashes.txt, hashes.txt
五、运行cura
- 打开pychaim
使用pychaim打开cura文件夹 - 配置运行
在pychaim右上角选择cura_app.py
然后将cura_app进行如下配置
使得cura使用外部的curaEngine.exe而不是使用本文件夹下的curaEngine.exe。
点击apply退出。
六、编译curaengine
-
使用vs2022打开curaengine文件夹。
-
配置cmake ,编译。
-
并修改launch.vs.json。
curaengine工程中launch.vs.json配置如下。
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-yr0AzXWE-1685699941469)(pic/%E9%85%8D%E7%BD%AEvs.png “运行设置”)]
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "CuraEngine.exe",
"name": "CuraEngine.exe",
"args": [
"connect",
"127.0.0.1:49674"
]
}
]
}
七、运行
在phchaim中,点击运行。
导入一个3D模型,点击切片按钮。
这时,切片进度条不会动,会等待外部curaengine软件的返回
在vs2022中开启调试
在vs cmd界面中显示切片进度。
在cura界面中显示切片完成