Commit graph

114 commits

Author SHA1 Message Date
c.lamboo
053aaad16f Don't place objects near the boarder in grid arrange
CURA-11189
2023-10-20 17:11:40 +02:00
Erwan MATHIEU
1b9ad84115 Improve code readability
CURA-10403
2023-10-20 12:05:19 +02:00
Erwan MATHIEU
0d0375d5e0 Retry auto-arrange with a few different strategies
CURA-10403
2023-10-19 16:36:19 +02:00
Erwan MATHIEU
1509e27983 Removed unused variable
CURA-10403
2023-10-19 16:03:14 +02:00
Erwan MATHIEU
1949d315e3 Minor auto-arrange improvements
CURA-10403
2023-10-19 16:02:08 +02:00
c.lamboo
4eb0ba9861 re-add functions for arrange
To avoid api break
new functions are added with the depricated decorator
2023-10-10 11:39:06 +02:00
Remco Burema
c20b227e5f Prevent 'major' API/SDK version break. 2023-10-10 11:15:57 +02:00
c.lamboo
71dc8e22a6
Allow objects to be placed near border
Issue before was the following: when placing objects within a grid cell there is a margin around the object. This margin comes from both the integer rounding of the cell and the defined min distance between objects. When trying to place object near the buildplate border we marked any cell that is not fully within the buildplate area as an invalid cell to place objects in. This was however too strict; there is the aforementioned margin around the object, and if only this margin would be outside the buildplate it is perfectly fine to place object in that cell.

CURA-7951
2023-09-06 16:53:02 +02:00
c.lamboo
586739c547 Avoid bool-trap
CURA-7951
2023-08-30 13:06:19 +02:00
c.lamboo
afc1ba78f5 Remove debugging utility function
CURA-7951
2023-08-30 12:52:27 +02:00
c.lamboo
3e39bbdabd Typo
CURA-7951
2023-08-30 12:51:03 +02:00
c.lamboo
38a5754c6f Mark method functions as private
CURA-7951
2023-08-30 12:47:56 +02:00
c.lamboo
b3b5ffbf55 Put try catch around actual arranging
`arrange` is the function that _could_ fail

CURA-7951
2023-08-30 12:45:34 +02:00
c.lamboo
cfc4db00a5 Use descriptive variable name
instead of magic number

CURA-7951
2023-08-30 12:41:53 +02:00
saumya.jain
e8c06ec783 grid arrange adjusted for disallowed area
CURA-7951
2023-08-24 16:34:34 +02:00
c.lamboo
ac78de1227 Updated comments
CURA-7951
2023-08-24 11:55:25 +02:00
Saumya Jain
1e7c975929
Merge branch 'CURA-7951_lock_rotation' into optimal_offset 2023-08-24 11:54:19 +02:00
saumya.jain
1591a2a0c3 ctrl+z for grid
CURA-7951
2023-08-24 11:48:43 +02:00
c.lamboo
719b11655c Fix ctrl+z issues
CURA-7951`
2023-08-24 11:24:21 +02:00
c.lamboo
f67a6970dd Find optimal offset for grid arrange
CURA-7951
2023-08-24 08:33:59 +02:00
c.lamboo
668038c59f Implement factory for Arrange
CURA-7951
2023-08-23 17:58:00 +02:00
saumya.jain
118f49a052 review comments fixed
Co-authored-by: Casper Lamboo <c.lamboo@ultimaker.com>

CURA-7951
2023-08-23 15:39:23 +02:00
saumya.jain
4096fc864b grid placement available for elliptical buildplates
Co-authored-by: Casper Lamboo <c.lamboo@ultimaker.com>

CURA-7951
2023-08-22 15:06:17 +02:00
saumya.jain
b662da732e review comments fixed
Co-authored-by: Casper Lamboo <c.lamboo@ultimaker.com>

CURA-7951
2023-08-22 11:51:30 +02:00
saumya.jain
7449e2137c objects placed with an offset to the grid
Co-authored-by: Casper Lamboo <c.lamboo@ultimaker.com>

CURA-7951
2023-08-22 11:26:43 +02:00
saumya.jain
2089462cd8 place objects outside grid
Co-authored-by: Casper Lamboo <c.lamboo@ultimaker.com>

CURA-7951
2023-08-22 11:16:02 +02:00
saumya.jain
b62725b4f0 copy_paste in a grid
arrange all objects in grid
place in grid

Co-authored-by: Casper Lamboo <c.lamboo@ultimaker.com>

CURA-7951
2023-08-22 10:30:51 +02:00
saumya.jain
b91ebcbb36 multiplying objects place them in a grid
Co-authored-by: Casper Lamboo <c.lamboo@ultimaker.com>

CURA-7951
2023-08-21 18:51:08 +02:00
saumya.jain
df69ccadb5 Revert "multiplying objects place them in a grid"
This reverts commit 209162fbce.
2023-08-21 18:45:40 +02:00
saumya.jain
209162fbce multiplying objects place them in a grid
CURA-7951
2023-08-21 17:31:29 +02:00
c.lamboo
4f9d041ae8 Add rotation lock in arrange and multiply objects
Add rotation lock in
- context menu item arrange and
- checkbox in multiply objects dialog

CURA-7951
2023-05-11 16:14:38 +02:00
Remco Burema
6a5a9e70af Fix whole output of nest2d was translated.
By default, the alignment would cause the entire mass of objects to have its center of gravity to be at the origin, including any fixed object. So there was an unwanted 'whole space' translation that we didn't take into account could occur beforehand. Fortunately, there's an option to just set it not to re-translate the whole space. It's unlcear to me how this would've worked in 5.2.2 and prior (and it did ... somehow), since we didn't change anything, including that default, as far as I can see. Anyway, the arrange function can handle 'fixed' objects again (as in loading them in one by one, or loading in a whole bunch of files instead of just 'arrange all').

CURA-10476 -- should fix #14838
2023-05-09 15:44:59 +02:00
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