Divide a box into equal parts?

Post questions on how to use or achieve an effect in Inkscape.
mahela007
Posts: 2
Joined: Thu Jul 19, 2012 7:16 pm

Divide a box into equal parts?

Postby mahela007 » Thu Jul 19, 2012 7:32 pm

Hello everyone.
This is my first post on these forums. :D

How can I draw a box (a long horizontal rectangle) and then divide that rectangle into 10 equally sized boxes along it's length?
It should look like the attached picture..
Attachments
Untitled.png
Untitled.png (1.91 KiB) Viewed 19145 times

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Divide a box into equal parts?

Postby brynn » Fri Jul 20, 2012 2:21 am

Image
Welcome to InkscapeForum!

Hhmmm.....I don't know if there's a way to do that automatically.....I don't think so. But I'm not clear what you're asking. Well, first, the spaces between the vertical lines in your illustration are not equal. But assuming you want them to be equal.... Do you want the outer rectangle, with 9 vertical lines, equally spaced, creating 10 spaces in between? Or do you actually want 10 rectangles all in a line? Those 2 scenarios would look identical. It would only be when you start selecting things, to do whatever else you're going to do, that it would matter how it's made.

If it's the 1st one, then draw the rectangle and 9 lines. Use the various values on Selection tool control bar, and simple math, to place the lines. Or you could use Align and Distribute dialog, rather than control bar values.

For the 2nd one, you'll also need to know the width of the outside rectangle, and divide by 10. Now draw a new rectangle with a width equal to the result of the division. Enable snapping, duplicate, move it over (snapping left side of duplicate to right side of original). Repeat until you have 10 in a row.

Or maybe someone else knows a different way to do it?

mahela007
Posts: 2
Joined: Thu Jul 19, 2012 7:16 pm

Re: Divide a box into equal parts?

Postby mahela007 » Fri Jul 20, 2012 2:49 am

Thanks for the reply..
and I apologize for the confusion. I was referring to the first scenario.. that is to draw the outer rectangle and then divide it with 9 vertical lines. (The boxes in the figure aren't equal because I sketched them manually--and hastily. :D)

User avatar
Xav
Posts: 1209
Joined: Fri May 08, 2009 1:18 am
Location: UK
Contact:

Re: Divide a box into equal parts?

Postby Xav » Fri Jul 20, 2012 4:14 pm

Here's one approach that should work, using the Align and Distribute dialogue to do the heavy lifting:

1) Draw your rectangle. While it's selected, copy it to the clipboard.
2) Draw a vertical line using :tool_pen: just above or below the rectangle - use the CTRL key to ensure it's vertical.
3) Edit > Paste Size > Paste Height to make your line the same height as the rectangle.
4) Duplicate your line 10 times, to give you 11 copies in total. You can simply press CTRL-D 10 times as one option.
5) Select the rectangle, hold shift and select one of the lines (check the status bar to see that you've got 2 objects of type Rectangle and Path).
6) Objects > Align and Distribute. Set the "Relative to:" popup to "First selected".
7) Click the "Align left edges" button (first row, second icon). Leave the dialogue open.
8 ) Select the rectangle and another line. Click the "Align right edges" button (first row, fourth icon).
9) Select all the lines, but not the rectangle, then click the "Distribute the centres equidistantly horizontally" button (in the Distribute section, second icon).
10) Delete the first and last lines to leave you with your 9 equally spaced vertical lines.
11) Select the rectangle first, then add all the lines to the selection.
12) Click the "Centre on horizontal axis" button (second row, third icon).

Do those steps one at a time, making sure you understand what's happening at each step, and I think you'll find that it's quite straightforward. There are ways to reduce some of the steps, but probably at the expense of clarity, so this is an instructional set of steps, not an optimal set.
Co-creator of The Greys and Monsters, Inked - Inkscape drawn webcomics
Web SiteFacebookTwitter

User avatar
shawnhcorey
Posts: 149
Joined: Mon Jan 07, 2008 12:17 pm

Re: Divide a box into equal parts?

Postby shawnhcorey » Sat Jul 21, 2012 12:33 am

Another method:
  1. Draw two lines over the two ends of the box.
  2. Select them both but not the box.
  3. Select: Extensions -> Generate from Path -> Interpolate...
  4. Set the Interpolate Steps to 9 (one less than you want).
  5. Click Apply.
A group will appear with 11 lines. Note that the two end lines will be duplicated in the group.

User avatar
flamingolady
Posts: 687
Joined: Wed Jun 10, 2009 1:40 pm

Re: Divide a box into equal parts?

Postby flamingolady » Sun Jul 22, 2012 6:32 am

While my first thought was the same as XAVs (make vertical lines, then use align, then add a rectangle on top of them), another method would be simple as well: draw the first vertical line, then duplicate it (Ctrl + D), then use Shift + space bar and hit it say 6 times (however much space you want), then create the next line (repeat the process), duplicate it, then hit Shift + space bar 6 times, do this until you have completed your 10 boxes, then add a rectangle to box them in, or add more lines. (of course you will need to group them together, or combine them when done).

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Divide a box into equal parts?

Postby ~suv » Sun Jul 22, 2012 7:12 am

Why not use the Construct Grid path effect with size X =1 and size Y = 10 (draw the initial path as big as an approximated single cell, then apply the path effect, adjust the parameters, and then resize (with node snapping) the resulting grid itself to match the required size of the original rectangle).

User avatar
shawnhcorey
Posts: 149
Joined: Mon Jan 07, 2008 12:17 pm

Re: Divide a box into equal parts?

Postby shawnhcorey » Sun Jul 22, 2012 7:29 am

If you're going to use a grid, any grid will do. Draw a rectangle ten units wide and draw the lines to divide it into sections. Group them all together, remove the grid, and resize the group to the size you want.


Return to “Help with using Inkscape”