Fit objects into rectangle with spacing

Post questions on how to use or achieve an effect in Inkscape.
hwalseng
Posts: 2
Joined: Wed Sep 14, 2016 7:35 pm

Fit objects into rectangle with spacing

Postby hwalseng » Wed Sep 14, 2016 7:48 pm

Hi everyone.

I'm currently working on a Christmas calendar and I have stumbled upon a problem:

I have 24 objects (rectangular slots) that i need to arrange within a rectangle (calendar base), with spacing of min 15mm between all objects.

Is there a plugin or tool that will calculate positions and move the objects automatically? Arrange and Align and distribute doesn't quite do the trick.

I can do it manually with a grid and by playing around with the objects but it takes a long time, and has to be repeated if the size of the slots changes.

Any advice and idea is welcome :)

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Fit objects into rectangle with spacing

Postby Moini » Wed Sep 14, 2016 9:54 pm

How about adding a background object (invisible) to the group that contains the rectangular slot, and then arranging them in a grid?

You'd only need to add one to one of the objects, if you use 'rows and columns' and check the little checkboxes below them (Same Height, Same Width) to arrange the objects.

Oh, I just noticed you can also set a distance (which is what the invisible object would have been for). What is it about the dialog that 'doesn't quite do the trick'? You need to repeat it when something changes, yes, but what would you expect instead?
What am I missing?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

hwalseng
Posts: 2
Joined: Wed Sep 14, 2016 7:35 pm

Re: Fit objects into rectangle with spacing

Postby hwalseng » Wed Sep 14, 2016 11:12 pm

I forgot the most important information: All 24 slots are of different sizes, and need to fit into a 281x404mm rectangle.
The spacing between all slots and the border of the rectangle needs to be minimum 15mm (possibly 10mm).
After a little research it seems the problem is of this type: https://en.wikipedia.org/wiki/Bin_packing_problem

To illustrate, a link to a picture (the pink rectangle is 15x15mm) and the svg file:
https://82bf08923587d00b5b6d5ddc58322c0 ... hkdW9iNEU/

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Fit objects into rectangle with spacing

Postby Moini » Wed Sep 14, 2016 11:54 pm

Aha :) There's a thread for this somewhere on the forum... It has been mentioned only recently... Don't remember the search term to use, though :/ - probably someone else here will.

I think the general solution was to use some kind of online service that did the arranging for you. Not sure if there's an extension somewhere that can do this, at least I never installed one and tried it (and I tried many ;-) )
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Fit objects into rectangle with spacing

Postby tylerdurden » Thu Sep 15, 2016 12:15 am

Maybe...
cleversomeday wrote:Just ran across this free online tool, and its open source as well http://svgnest.com
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/


Return to “Help with using Inkscape”