Dear everyone:
I am a freshman and I am not familiar with the python language, I just want to know where the models layout source code, does any body can answer me?
Not sure what you mean exactly here. Do you mean the auto-arrange algorithm?
Images, videos, or filling out the issue template will always help us understand and solve your issue faster. I've pasted the issue template below for you to try again:
Please fill in the issue template so we are able to help you:
Application version
(The version of the application this issue occurs with.)
Platform
(Information about the operating system the issue occurs on. Include at least the operating system and maybe GPU.)
Printer
(Which printer was selected in Cura?)
Reproduction steps
Screenshot(s)
(Image showing the problem, perhaps before/after images.)
Actual results
(What happens after the above steps have been followed.)
Expected results
(What should happen after the above steps have been followed.)
Project file
(For slicing bugs, provide a project which clearly shows the bug, by going to File->Save. For big files you may need to use WeTransfer or similar file sharing sites.)
Log file
(See https://github.com/Ultimaker/Cura#logging-issues to find the log file to upload, or copy a relevant snippet from it.)
Additional information
(Extra information relevant to the issue.)
Here is the implementation of how Cura decides on a position for a model on the build plate: https://github.com/Ultimaker/Cura/blob/master/cura/Arranging/Arrange.py
Deciding on the position of multiple models at the same time is currently just a repeated iteration of that, positioning all models on the build plate one by one.
In broad strokes, the algorithm works like this:
Dear Ghostkeeper:
thank you very much! your answer is very helpful for me. my friends told me that Cura call the API of qhull-master(a c program library) to do the models layout algorithm, my friend is right? and where the cura project call these API? can you tell me?
waiting for your favourable reply!
qhull-master c program library download address is "https://github.com/qhull/qhull"
We're calling upon QHull not directly but through Scipy, a library for scientific calculations. It's used in two places:
Note that this is not in Cura itself but in the framework called Uranium upon which Cura is built (intended for any 3D application with a backend to do calculations).
The 3D convex hull is used to create the collision areas underneath each model (which is used for that arrange algorithm). The shadow is 2D, but we're calculating a 3D convex hull because the 3D convex hull doesn't need to be recalculated when the user rotates the model. It can just rotate again. To get the collision area from that, we just project that hull to the build plate. The 2D convex hull is used to combine multiple objects if the user groups them.