Jump to content
hudejo

How to debug plugins during development?

Recommended Posts

Posted · How to debug plugins during development?

I am trying to develop a new plugin for the latest Cura (4.3 currently)

 

I've found the wiki page with some basic information (https://github.com/Ultimaker/Cura/wiki/Plugin-Directory) but could not find any info on how to debug/log during plugin development. 

How do I place breakpoints? How do I log to a console?

Thanks!

Share this post


Link to post
Share on other sites
Posted · How to debug plugins during development?

What OS are you developing on?

Share this post


Link to post
Share on other sites
Posted · How to debug plugins during development?

Windows, but can switch to Linux

Share this post


Link to post
Share on other sites
Posted · How to debug plugins during development?

Unfortunately, the --debug mode that shows the console output is broken on Windows. So to see the console output you need to run Cura from source. This is a bit involved, but here's my shortcut.

 

In a project folder, check out Cura (from https://github.com/ultimaker/cura.git), Uranium (from https://github.com/ultimaker/uranium.git) and libCharon (from https://github.com/ultimaker/libcharon.git), each in thier own folder. Also create a folder named "bin". In that folder, you need to copy a number of files from the Cura 4.3 that you have installed:

 

project\
	Cura\
		... files from Cura.git ...
	Uranium\
		... files from Uranium.git ...
	libCharon\
		... files from libCharon.git ...
	bin\
		CuraEngine.exe
		Arcus.pyd
		Savitar.pyd
		libgcc_s_seh-1.dll
		libgomp-1.dll
		libifcoremd.dll
		libimalloc.dll
		libiomp5md.dll
		libmmd.dll
		libstdc++-6.dll
		libwinpthread-1.dll

Add the full path to the Uranium, libCharon and bin folders to your PYTHONPATH environment variable.

 

Then you need to install a couple of python modules through pip or otherwise: colorlog, numpy, pyqt5, pyserial, scipy, trimesh, zeroconf.

 

With all that done, you should finally be able to launch cura with ````````````"python cura_app.py" from the Cura folder and get all the console output as Cura starts. With "python -m pdb cura_app.py" you should be able to use the python debugger, but I don't use it much.

  • Thanks 1

Share this post


Link to post
Share on other sites
Posted · How to debug plugins during development?

Thanks, this is great help! 

I was worried that I need to execute those 100+ steps to fully compile Cura. 

Perhaps someone should post this to the wiki on GitHub.

Share this post


Link to post
Share on other sites
Posted · How to debug plugins during development?

I'm not sure if I missed any steps; it has been >4 years since I have set up my development environment, but it is still what I use to develop my plugins. It skips compiling CuraEngine, so logically you can't make change to CuraEngine this way.

Share this post


Link to post
Share on other sites
Posted · How to debug plugins during development?

OK, I managed to run it following the instructions from @ahoeben. There were some extra steps needed:

 

- It needs Python 3.5.x, 64bit with Python 3.8 I could not install PyQT5.10, just a newer one, that wont work (note that the install page at https://github.com/Ultimaker/Cura/wiki/Running-Cura-from-Source-on-Windows mentions 32 bit python, but I think one of the .pyd files was 64bits.).

-These dependencies were enough: 

numpy scipy colorlog zeroconf pyserial PyQt5==5.10 requests

- Also i needed to install Shapely as described here: https://github.com/Ultimaker/Cura/wiki/Running-Cura-from-Source-on-Windows#python-352

  • Like 1

Share this post


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

×
×
  • Create New...

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!