82 Commits

Author SHA1 Message Date
digitalfrost
afb90b4b2e Move initialization of found_solution_for_all
Initialize the variable found_solution_for_all with False and
 don't set it a the exception block.
2022-08-24 19:52:26 +02:00
digitalfrost
c3833c2ff8 ArrangeObjectsJob.py: Refactor run method
arrange from Nest2DArrange will return a boolean so we can simplify
2022-08-18 12:22:07 +02:00
digitalfrost
54b9ed97ae Use is not operator rather than not ... is
This is advocated by both PEP8 and the Google Python Style Guide
2022-08-08 10:04:46 +02:00
digitalfrost
ff07129f2c Use is not operator rather than not ... is
This is advocated by both PEP8 and the Google Python Style Guide
2022-08-08 10:04:46 +02:00
digitalfrost
06e61a3129 Use is not operator rather than not ... is
This is advocated by both PEP8 and the Google Python Style Guide
2022-08-08 10:04:46 +02:00
Jaime van Kessel
e925f07aad Remove old arranger code
Major vesion upgrade, time to clean some stuff up!

CURA-7810
2022-03-24 13:37:29 +01:00
Ghostkeeper
652043e1d8
Cast bounding box to ints
The version of Sip we're using now cares about this more than the previous one, apparently.

Contributes to issue CURA-8592.
2022-01-03 17:32:33 +01:00
Ghostkeeper
d6f8984cf0
Use integer positions for fixed items too
Pynest2d requires it. It seems the SIP version we're using is lenient for this, but newer SIP versions are not.

Fixes #10801.
2021-11-18 11:44:09 +01:00
Jaime van Kessel
61c43fb765 Only show "can't find location message" when it couldn't find location
Bit of a silly mistake, but easy enough to fix!

CURA-8649
2021-10-28 13:53:52 +02:00
Konstantinos Karmas
e793eac425 Push the grouped operation instead of redoing it
CURA-7851
2021-10-06 16:46:20 +02:00
Jaime van Kessel
96d381a895
Apply suggestions from code review
CURA-7851

Co-authored-by: Konstantinos Karmas <konskarm@gmail.com>
2021-10-06 15:45:07 +02:00
Jaime van Kessel
44eb3201a9 Fix duplicating / multiplicating support blockers
CURA-7851
2021-10-04 15:52:08 +02:00
jelle Spijker
b6665f1142
Applied review comments
Contributes to CURA-8418
2021-07-28 11:32:29 +02:00
Jelle Spijker
2263969d5f
Updated message with message types
Contributes to CURA-8418
2021-07-28 08:45:42 +02:00
Jaime van Kessel
900db57f0f
Update messages to use the message_types
CURA-8418
2021-07-27 11:54:43 +02:00
Ghostkeeper
ff7b2a673f
Add experimental warning and error message types to two messages
These are for our testers to be able to test the new message types. Later they will be added to all messages that need them.

Contributes to issue CURA-7278.
2021-07-26 15:17:54 +02:00
Ghostkeeper
83767764db
Slightly increase spacing when arranging models
This is closer to the behaviour in Cura 4.7 and earlier. It makes it easier to pull objects apart, and to break them off from a raft.
2021-04-21 15:56:59 +02:00
Ghostkeeper
9dba4d554f
Fix segfault when arranging without any disallowed areas
So libnest2d is giving a segfault when it's being triggered without any disallowed areas. This is because we then give a single disallowed area for the border around the build plate, and give this disallowed area 0 vertices. Because libnest2d doesn't do defensive coding here, it's going to crash, taking Cura along with it. The crash is in libnest2d's function 'libnest2d::_Item<ClipperLib::Polygon>::rightmostTopVertex()'.

This segfault started happening recently in Cura. However it only happens when there are no disallowed areas. Steps to reproduce the error are:
- Use Custom FFF Printer.
- Set the Adhesion Type setting to 'None'.
- Load any two models.

I tracked the segfault down to this commit: 74ddbaab4b . That commit by itself is slightly mysterious but looks fine to me. It did give the hint that this segfault might be caused by empty polygons though. So for that reason, I figured that filtering out the empty polygons here in the arranger might fix it; and indeed it does. Passing empty polygons as fixed/disallowed areas is useless and invalid anyway. Apparently libnest2d doesn't deal well with it, but we might as well not send those polygons over then.
2021-04-14 00:32:50 +02:00
Jaime van Kessel
82ffdccac2
Added type ignore since it does accept it 2021-04-07 17:15:22 +02:00
Jaime van Kessel
3432720f7c
Fix mypy issues caused by numpy upgrade 2021-04-07 11:47:52 +02:00
Ghostkeeper
39287264d9
Pynest2d.Point requires integer coordinates
These were floats. Rounding numpy-floats still results in floats so I'm just using int(). The result is rounded down instead of nearest, but the difference is at most 50 nanometres anyway.

Contributes to issue CURA-7501.
2020-10-30 18:12:18 +01:00
Jaime van Kessel
5109bd3684
Fix crash when duplicating node with support blocker
Suggested & reported by smartavonics.

Fixes #8581
2020-10-20 14:19:33 +02:00
Kostas Karmas
8c1cf89d45 Skip arranging objects that have no convex hull
CURA-7780
2020-10-16 11:31:00 +02:00
Kostas Karmas
148dd26b67 Close "Finding Location" message if arrange crashes
CURA-7780
2020-10-16 11:10:02 +02:00
Kostas Karmas
c54605a134 Transfer deprecated decorator on __init__ of Arrange
As it cannot decorate a class.

Also, the deprecated decorator has to be applied before the @classmethod.

CURA-7440
2020-10-13 18:06:44 +02:00
Kostas Karmas
a0e4e4325d Add missing documentation
CURA-7440
2020-10-12 17:57:00 +02:00
Kostas Karmas
972e2f6716 Fix crash when arranging objects in one-at-a-time mode
Crashing was occuring because node.getPoints() can return None.

CURA-7440
2020-10-12 16:28:28 +02:00
Remco Burema
9f929298d7
Merge pull request #8510 from Ultimaker/CURA-7754_add_disallowed_areas
Mark disallowed areas as disallowed areas
2020-10-09 19:27:26 +02:00
Kostas Karmas
a94ebc6261 Don't arrange locked objects when arrangeAll is called
CURA-7440
2020-10-09 18:09:40 +02:00
Kostas Karmas
d47623d58a Remove duplicate addition of items in the node_items list
CURA-7440
2020-10-09 17:19:53 +02:00
Kostas Karmas
f9bd5e3dcd Modify arrange() to optionally create AddSceneNodeOperations
Then the MultiplyObjectsJob can use the arrange function instead of duplicating the code

CURA-7440
2020-10-09 17:12:59 +02:00
Kostas Karmas
eedbcb6a2d Fix z position of objects that end outside the buildplate
When multiplying objects or inserting objects in the scene that do not fit in the buildplate, those
objects would correctly end up outside the buildplate, but their Z position would be aligned at the
absolute Z=0 of the buildplate.

This commit fixes that by compensating in the z-axis, properly moving the object outside the
buildplate in the correct z-position so that it's bottom is aligned with the original object.

CURA-7440
2020-10-09 15:59:50 +02:00
Kostas Karmas
8678682d94 Reformat file and remove unused import
CURA-7440
2020-10-08 16:27:36 +02:00
Ghostkeeper
6bfa24686f
Mark disallowed areas as disallowed areas
Also improve the filtering a bit so that it's no longer dependent on the order. Doesn't really matter in this case but it should be more robust.

Contributes to issue CURA-7754.
2020-10-08 11:10:24 +02:00
Jaime van Kessel
a46bf8d6fa
Apply suggestions from code review
CURA-7440

Co-authored-by: Konstantinos Karmas <konskarm@gmail.com>
2020-10-08 09:43:22 +02:00
Jaime van Kessel
d801f9838a
Fix mypy issues
It doesn't seem to like blanket imports

CURA-7440
2020-10-05 14:52:50 +02:00
Jaime van Kessel
a14135be5e
Add some documentation to the arrange nest algorithm
CURA-7440
2020-10-05 14:24:34 +02:00
Jaime van Kessel
9312dc5c07
Add deprecated tag to arranger
CURA-7440
2020-10-05 14:15:49 +02:00
Jaime van Kessel
30966beed2
Let autoplacement also take the existing nodes into account
CURA-7440
2020-10-05 13:37:57 +02:00
Jaime van Kessel
274dc8d06c
Split up arrange
This splits up the finding of new positions with the actual move. This is needed
for when we want to place new nodes on model load.

CURA-7440
2020-10-02 11:21:57 +02:00
Jaime van Kessel
c25351c98a
Remove unused imports
CURA-7440
2020-10-02 10:06:41 +02:00
Jaime van Kessel
8c1985cdb3
Move nest2darrange to it's own function
This makes it a lot easier to re-use it

CURA-7440
2020-10-02 10:06:09 +02:00
Jaime van Kessel
e0e65b91b5
Take disallowed areas into account when arranging
CURA-7440
2020-09-30 10:34:35 +02:00
Jaime van Kessel
73289b2a77
Place objects that we couldn't fit next to the buildplate
CURA-7440
2020-09-28 16:21:47 +02:00
Jaime van Kessel
b0a8a5ccab
Switch out the arranger algorithm for arrange all
CURA-7440
2020-09-28 16:16:47 +02:00
Jaime van Kessel
1505d59f4b
Add extra process events to arrange job
Doesn't actually speed up something, but it does prevent the GUI from
freezing, so it looks less laggy.

CURA-7106
2020-06-23 10:38:21 +02:00
Jaime van Kessel
61def4ba25
Prevent crash when requested polygon is too large
CURA-6P
2020-06-19 16:59:27 +02:00
Nino van Hooff
89f0970a88 Remove trailing whitespace from Python files 2020-05-29 14:30:33 +02:00
Nino van Hooff
176919eee0 Merge branch 'master' into doxygen_to_restructuredtext_comments
# Conflicts:
#	plugins/CuraEngineBackend/CuraEngineBackend.py
#	plugins/CuraEngineBackend/StartSliceJob.py
2020-05-08 15:31:23 +02:00
Jelle Spijker
679739d09d
Applied requested changes proposed by @ninovanhooff
Fixed a couple of missed double quotes, trailing and leading spaces, to long comment lines
2020-04-27 20:09:00 +02:00