Skip to content

Getting Started

Erwan MATHIEU edited this page Sep 6, 2024 · 9 revisions

The instructions on this page will get you started developing Cura.

⚠️ ANNOUNCEMENT TO ALL CURA CONTRIBUTORS

⚠️ We are currently in the process of migrating all the workflows from Cura and it related repositories

⚠️ in order to use Conan V2 instead of Conan V1, which is now deprecated. Be aware that at some point

⚠️ around September/October 2024, the following procedure will be updated and your current development

⚠️ environment based on Conan V1 will stop working.

⚠️ We will try to keep you posted a best as possible about this change, and to provide a comprehensive documentation.

Developing Cura

We advise using PyCharm, we have preset run configurations that will make getting started easier. There is a free community version available.

  1. First install the build requirements listed here.
    1. You only have to install these build requirements. All dependencies will be handled by Conan.
  2. Then configure Conan
    1. This step only needs to be done once, unless you clear your conan cache. You can skip this step for Uranium/CuraEngine.
  3. Then clone Cura.
    1. If you plan to work with Uranium and CuraEngine clone them all in the same root folder. You can find more information about the responsibilities of CuraEngine/Uranium here.
  4. Now run conan install
    1. This will install all dependencies required for Cura including CuraEngine, Uranium. This will take over 30 minutes on the first run.
    2. We advise using the -g PyCharmRunEnv argument here to get the PyCharm run configurations.

If you are using PyCharm you are ready to go, otherwise you must activate the virtual environment each time you would like to start development and run cura from the command line.

Gif of Cura starting

You can now make changes to you Cura project and test them by running Cura. If you would like to change the slicing process, follow these steps.

Troubleshooting Conan

Here are some tips if you run into issues with conan.

  • Make sure you have the correct conan version installed. You can check this with conan --version.
    • Try to force installing the correct version pip install --force-reinstall -v "conan==X.XX.X". Where X.XX.X is the version specified in the requirements
  • Try deleting your local conan cache. You can do this with conan remove "*" -f
  • Do not run conan install using sudo. This will mess up the permissions in your cache.
    • If you have installed using sudo, delete your cache.
  • Make sure you are not using our internal conan repository.
    • Run this conan remote remove cura

Developing Uranium in Parallel to Cura

  1. First install the build requirements listed here.
    1. If you have done this for Cura you should have all of the requirements already.
  2. Then clone Uranium.

Before you can run Cura using your development version of Uranium you must put Uranium into editable mode. Conan stores local copies of all dependencies in ~/.conan. Editable mode links the Uranium dependency in ~/.conan/data/uranium/... to the development copy we cloned in step 2.

  1. Inside your Uranium folder add conan as editable
    1. What you fill in here does not matter for local development.
    2. Example: conan editable add . uranium/5.4.0@jeff/testing
  2. Inside your Cura folder run conan install again with this flag --require-override=uranium/<version>@<username>/<channel>
    1. Example: conan install . --build=missing --update -o cura:devtools=True -g VirtualPythonEnv -g PyCharmRunEnv --require-override=uranium/5.4.0@jeff/testing
    2. Store this command somewhere, you will need to use this everytime you run conan install on Cura.
  3. To test if this worked, delete Uranium/UM/Application.py. Cura should fail to start because this file is missing.

PyCharm Setup

We advise using PyCharm to develop Cura and Uranium in parallel. It offers excellent support for multi repository projects.

  1. With the Cura Project open, navigate to File > Open.
  2. Click Attach on the popup Dialog
  3. Now you should have both Cura and Uranium open in the same window.

  1. Using the built-in git plugin, you can create branches for both projects simultaniously

Developing CuraEngine in Parallel with Cura

This section covers developing CuraEngine and Cura simultaneously.

  1. First install the build requirements listed here.
  2. Then clone CuraEngine.
  3. Build CuraEngine
    1. Most of the time you want to use Debug mode for the debugger.
  4. Run cura with the argument --external-backend or use the external backend run configuration in PyCharm.

5. Start a slice in Cura
6. Run curaengine connect 127.0.0.1:49674

Troubleshooting Tips

  • If you are getting this error [ERROR] Could not connect to the given address the port may have changed due to a failed slice.
    • Try incrementing the port number curaengine connect 127.0.0.1:49675.
    • You can find the port in the Cura logs [MainThread] UM.Backend.Backend._onSocketStateChanged [185]: Backend connected on port 49674
  • If you are getting this error [ERROR] Trying to retrieve setting with no value given: 'setting_name_here' you are using a branch of Cura that is out of sync with CuraEngine.
    • Make sure you are on the main branch for both projects or merge main into your working branches on both projects.
Clone this wiki locally