# Align bounding boxes

**URL:** <https://discourse.mcneel.com/t/align-bounding-boxes/201484>\
**Category:** Grasshopper\
**Tags:** windows, human, shapediver, pufferfish\
**Created:** [March 17, 2025, 4:19pm UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484 "2025-03-17T16:19:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lobo96](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lobo96/32/657935_2.png) [@Lobo96](https://discourse.mcneel.com/u/Lobo96)\
**Post date:** [March 17, 2025, 4:19pm UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/1 "2025-03-17T16:19:47Z")

</div>

Hi guys, I need your help with a Grasshopper script I’m working on. I have 151 elements enclosed by bounding boxes, and I want to arrange them so that their vertical edges are precisely aligned.

---

<div class="post-metadata">

**Author:** ![Eef\_Weenink](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eef_weenink/32/764753_2.png) [@Eef\_Weenink](https://discourse.mcneel.com/u/Eef_Weenink)\
**Post date:** [March 17, 2025, 10:40pm UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/2 "2025-03-17T22:40:10Z")

</div>

Please read this: [Help us Help you, Before you call or email tech support](https://discourse.mcneel.com/t/help-us-help-you-before-you-call-or-email-tech-support/108557)

and then ask again, so we can help you better.

Regards, Eef

---

<div class="post-metadata">

**Author:** ![Lobo96](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lobo96/32/657935_2.png) [@Lobo96](https://discourse.mcneel.com/u/Lobo96)\
**Post date:** [March 18, 2025, 8:11am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/3 "2025-03-18T08:11:04Z")

</div>

thanks, eef weenink, i will be more clear. This is the situation I was talking about. Right now, I have bounding boxes that I can’t align correctly because some are closer and others are farther away. I tried using Grasshopper, as you can see in the picture below, but I still can’t align them properly.

 ![boxes](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/0/6/9/0698396951101a47128e4d93e4834cf4bcc3b3f1.png)  
 ![Screenshot 2025-03-18 090719](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/4/7/e/47eb9dcdf896dfedb5b2b8d30839a51575a11ef5.png)  
I’ll also upload the Grasshopper file just to be safe.  
[coll-nome-v910-rh8.gh](https://discourse.mcneel.com/uploads/short-url/89jJ88SxJEs4eJoqTGMfuVqbvt.gh) (1.7 MB)

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/772775_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [March 18, 2025, 8:12am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/4 "2025-03-18T08:12:04Z")

</div>

Have you tried the move to plane component yet?

---

<div class="post-metadata">

**Author:** ![Lobo96](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lobo96/32/657935_2.png) [@Lobo96](https://discourse.mcneel.com/u/Lobo96)\
**Post date:** [March 18, 2025, 8:14am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/5 "2025-03-18T08:14:34Z")

</div>

Hi Martin, yes, I’ve already tried that, but I still can’t align them correctly. Do you have any solution in mind?

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/772775_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [March 18, 2025, 8:16am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/6 "2025-03-18T08:16:02Z")

</div>

> [@Lobo96](#):
>
> vertical edges are precisely aligned

Which of the vertical edges do you want to align? The left side on the YZ plane?

---

<div class="post-metadata">

**Author:** ![Lobo96](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lobo96/32/657935_2.png) [@Lobo96](https://discourse.mcneel.com/u/Lobo96)\
**Post date:** [March 18, 2025, 8:18am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/7 "2025-03-18T08:18:06Z")

</div>

![boxes](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/d/b/8/db828183a2c7f8470a6d33ffacee6b91f63ec5db.png)  
These ones marked in blue.

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/772775_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [March 18, 2025, 8:19am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/8 "2025-03-18T08:19:34Z")

</div>

![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/2/a/5/2a51b6ba4f0b9b903de5975bc747cf9f4ba71151.png)

This and some more pufferfish. I can’t help you with that file.

The blue lines are horizontal. You want to make the gaps even? Basically distribute the objects?

---

<div class="post-metadata">

**Author:** ![Lobo96](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lobo96/32/657935_2.png) [@Lobo96](https://discourse.mcneel.com/u/Lobo96)\
**Post date:** [March 18, 2025, 8:22am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/9 "2025-03-18T08:22:15Z")

</div>

I’m extracting the problem from that file. The components it asks you to download are not essential for solving the issue.  
[Problem 01.gh](https://discourse.mcneel.com/uploads/short-url/2YlRv2RNUqkXvUmpCMRf6VXt4ak.gh) (360.1 KB)  
this file sould be ok

I would like the lines marked in the picture to be attached to each other uniformly.

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/772775_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [March 18, 2025, 8:43am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/10 "2025-03-18T08:43:01Z")

</div>

> [@Lobo96](#):
>
> attached to each other uniformly.

= no gaps?

I’m not sure what’s up with the empty groups.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/6/f/8/6f8b5320db3641d65dc6caa5741b61aa5e8a8b7a.png)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/d/0/3/d0389674685ca4cc7af0c70502391ddc8e5a5890.png)

[Problem 01.gh](https://discourse.mcneel.com/uploads/short-url/czt2vajrAnYsQLS2xyqfGbaMTRs.gh) (371.6 KB)

---

<div class="post-metadata">

**Author:** ![Lobo96](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lobo96/32/657935_2.png) [@Lobo96](https://discourse.mcneel.com/u/Lobo96)\
**Post date:** [March 18, 2025, 8:48am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/11 "2025-03-18T08:48:11Z")

</div>

no gaps yes, I think you solved the problem in 5 minutes hahaha, thank you very much!

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/772775_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [March 18, 2025, 8:50am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/12 "2025-03-18T08:50:13Z")

</div>

It can be confusing.

---

<div class="post-metadata">

**Author:** ![Adam\_M](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/adam_m/32/769331_2.png) [@Adam\_M](https://discourse.mcneel.com/u/Adam_M)\
**Post date:** [March 18, 2025, 8:52am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/13 "2025-03-18T08:52:40Z")

</div>

Here is a slightly different approach to @martinsiegrist:

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/0/1/0/010724127cab4f18f6d49ffdbcc76dce9e750bc3.png)  
[Problem 01\_v2.gh](https://discourse.mcneel.com/uploads/short-url/uuxWS2kcI2dNkj3IKxUQsitUrs1.gh) (382.2 KB)

---

<div class="post-metadata">

**Author:** ![Lobo96](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lobo96/32/657935_2.png) [@Lobo96](https://discourse.mcneel.com/u/Lobo96)\
**Post date:** [March 18, 2025, 9:20am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/14 "2025-03-18T09:20:17Z")

</div>

Thank you very much, Adam! Your approach is also very interesting. If someone wanted to delve a bit deeper into the problem, I continued the script so that they align based on the choice of letters, but they still remain disconnected. @martinsiegrist@Adam_M  
[Problem02.gh](https://discourse.mcneel.com/uploads/short-url/bouFP5R1PCR8JddHans1T2l82CL.gh)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/4/c/3/4c32a10a600e8600fd26db533bde9e440bc6e0ca.png)  
(470.1 KB)

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/772775_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [March 18, 2025, 9:41am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/15 "2025-03-18T09:41:43Z")

</div>

You messed with the logic.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/6/9/3/6939508ea72a1004004051d761a7f65021623acf.png)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/4/0/c/40c0d4b62c7d8a1831de7775e31ff4800ca2d44a.png)

To have the letters go downwards, align the characters below the X axis.

[Problem02.gh](https://discourse.mcneel.com/uploads/short-url/jwneJkCHviZkc6eFHzDiNyIcvye.gh) (477.8 KB)

---

<div class="post-metadata">

**Author:** ![Lobo96](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lobo96/32/657935_2.png) [@Lobo96](https://discourse.mcneel.com/u/Lobo96)\
**Post date:** [March 18, 2025, 10:00am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/16 "2025-03-18T10:00:17Z")

</div>

Ah, ok ok, now it’s much clearer. Let me ask you a question: why do you think the letters in the movement are not centered? As shown in the picture red for how they are now, blue for how they should be.

 ![Screenshot 2025-03-18 105854](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/b/f/f/bff9a5443ab443db5f4d1183dfa182b7dc6d5cbb.png)

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/772775_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [March 18, 2025, 10:02am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/17 "2025-03-18T10:02:58Z")

</div>

You can extract the center of the bounding boxes of the stacked letters and move those to an axis / calculate the distance to an axis. Then use that transformation to move the letters.

---

<div class="post-metadata">

**Author:** ![Lobo96](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lobo96/32/657935_2.png) [@Lobo96](https://discourse.mcneel.com/u/Lobo96)\
**Post date:** [March 18, 2025, 10:25am UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/18 "2025-03-18T10:25:42Z")

</div>

> [@martinsiegrist](#):
>
> You can extract the center of the bounding boxes of the stacked letters and move those to an axis / calculate the distance to an axis. Then use that transformation to move the letters.

Thank you so much for your help! I really appreciate it.

---

<div class="post-metadata">

**Author:** ![Lobo96](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/lobo96/32/657935_2.png) [@Lobo96](https://discourse.mcneel.com/u/Lobo96)\
**Post date:** [March 18, 2025, 2:59pm UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/19 "2025-03-18T14:59:22Z")

</div>

Here we are with problem number 3 😂 : I need to assign a specific distance to uppercase letters and a different distance to lowercase letters. Any ideas or suggestions on how to do it? I need the script to recognize which letters are uppercase and which are lowercase

---

<div class="post-metadata">

**Author:** ![ftzuk](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ftzuk/32/689170_2.png) [@ftzuk](https://discourse.mcneel.com/u/ftzuk)\
**Post date:** [March 18, 2025, 3:04pm UTC](https://discourse.mcneel.com/t/align-bounding-boxes/201484/20 "2025-03-18T15:04:30Z")

</div>

Use the width of your bounding box to find them. Uppercase all have a wider box.
