Jump to content

Activating Conan run environment and running CuraEngine from command line


Recommended Posts

Posted · Activating Conan run environment and running CuraEngine from command line

I apologize first if this is a super basic question to most, I am currently a computer science student in my last semester before an associate's degree with little knowledge with the command line and python download environments. I also primarily work with Java but have an internship using Python.


I have written a program that is able to take a GCode file and convert it into an SBP file with a python script through a click of a button within a GUI. I have now been tasked with taking in an STL file and using a slicer (Cura) to convert that file into GCode.


I am currently trying to get the CuraEngine (without Cura) to work VIA command line in order to use the subprocess library within Python to do all of theses conversions within my personal GUI. However, the wiki on downloading CuraEngine isn't helping much.


I have been able to achieve installing and building the CuraEngine release, but cannot activate the Conan run environment through the walkthrough of the wiki (https://github.com/Ultimaker/CuraEngine/wiki/Building-CuraEngine-From-Source).


I am getting the error that the pathway (\build\generators\conanrun.sh) is not a recognized internal/external command, operable program, or batch file. When looking up the files within the generators folder, the conanrun file is actually an extension of .bat (conanrun.bat).


So a few questions I have:


  • What do I do to get the CuraEngine running on the command line at this point?
  • Would it be easier to just download/run the entire Cura application through the source? I've noticed a lot of others have done that, but I don't want the GUI that goes along with it. I've also had trouble downloading the Cura application from the command line, with ERROR: pynest2d/5.3.0-alpha+testing_0@ultimaker/testing: Error in generate() method showing up in the install.
  • As an extension of the above question, it seems the build instructions for CuraEngine has had a lot of complaints from others. As a result, is there a better way to get a slicer engine to work through a self-made GUI? Either from the command line or another way.

Thank you in advance for the help!


Also, I did post this question on StackEchange.com and StackOverflow.com as well, incase you run into it there.

  • Like 1
Link to post
Share on other sites

Posted · Activating Conan run environment and running CuraEngine from command line

Since you mention the .BAT file, I assume you are using Windows. If so, is there a reason you cannot "extract" the CuraEngine.exe from a normal Cura installation?

  • Link to post
    Share on other sites

    Posted · Activating Conan run environment and running CuraEngine from command line

    Assuming you are working on Windows and you have the following external build dependencies installed: Visual Studio 2022 C++, Python 3.6 or higher, sip 6.6.x or higher, CMake 3.23.x or higher, Ninja 1.10 or higher, Conan 1.52 or higher.

    Getting to build and use CuraEngine should work with the following commands which are all run from Powershell as a normal user:

    First we're gonna make sure that you start from a fresh situation, by updating Conan and making sure that you have SIP installed 6.6.2 (6.7.x seems to have a bug)

    pip install conan --upgrade --force
    pip install sip==6.6.2
    conan remove "*" -f
    conan config install https://github.com/ultimaker/conan-config.git
    conan profile new default --detect

    Then we're gonna clone CuraEngine and install the dependencies with the help of Conan. Notice the:  -c tools.env.virtualenv:powershell=True  argument, Since it is rather difficult to to determine in which shell the commands are run and which environment Conan needs to generate we need to explicitly set that to the Powershell environment. Normally we would have set this globally by default but the Conan recipes, for OpenSSL and CPython don't play nice with this yet.

    git clone https://github.com/Ultimaker/CuraEngine
    cd CuraEngine
    conan install . --build=missing --update -c tools.env.virtualenv:powershell=True
    conan install . --build=missing --update -s build_type=Debug -c tools.env.virtualenv:powershell=True


    This should download and build all dependencies, both release and debug and also create a build directory with a folder named generators in there, these contain the CMake modules with the information needed to link and build CuraEngine with the dependencies.

    We can now generate the Ninja build files with CMake for each build type:

    cmake --preset release
    cmake --preset debug



    and build CuraEngine for the build_type you want (note I'm not sure about the order of the --build and --preset release flag, if it fails try switching those)

    cmake --build --preset release

    The above command should build CuraEngine.exe in the directory: build/Release folder.

    We can now activate the environment containing the Environmental paths for Windows, defined in the conanrun.ps1 which can be found in build/generator folder. This should add the location of the shared dependencies to the PATH.


    Alternatively you can also try to add the Conan deploy generator https://docs.conan.io/en/latest/reference/generators/deploy.html#deploy-generator to the install command:  -g deploy

    This will copy all shared dll to the user space. If you then copy these dll's over to the Build folder next to CuraEngine.exe Windows will find these and use them.

  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • Introducing the UltiMaker Factor 4
        We are happy to announce the next evolution in the UltiMaker 3D printer lineup: the UltiMaker Factor 4 industrial-grade 3D printer, designed to take manufacturing to new levels of efficiency and reliability. Factor 4 is an end-to-end 3D printing solution for light industrial applications
          • Thanks
          • Like
        • 3 replies
      • UltiMaker Cura 5.7 stable released
        Cura 5.7 is here and it brings a handy new workflow improvement when using Thingiverse and Cura together, as well as additional capabilities for Method series printers, and a powerful way of sharing print settings using new printer-agnostic project files! Read on to find out about all of these improvements and more. 
          • Like
        • 27 replies
    • Create New...