24 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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