# Another Space Plan Generator/Space Layout question

**URL:** <https://forum.dynamobim.com/t/another-space-plan-generator-space-layout-question/19164>\
**Category:** Packages\
**Created:** [February 16, 2018, 9:15pm UTC](https://forum.dynamobim.com/t/another-space-plan-generator-space-layout-question/19164 "2018-02-16T21:15:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kristinaEB](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@kristinaEB](https://forum.dynamobim.com/u/kristinaEB)\
**Post date:** [February 16, 2018, 9:15pm UTC](https://forum.dynamobim.com/t/another-space-plan-generator-space-layout-question/19164/1 "2018-02-16T21:15:58Z")

</div>

I see there are several posts about the Space Plan Generator. I’m new to the forum, so apologies if I should only be adding to those threads instead of posting a new question. I am having trouble getting my departments to fill 100% of the given site outline. I’m using my building footprint as the site outline, so there doesn’t need to be any empty space. I can’t find an input that gives me the desired output. When I change the design seed on this node, it fills varying amounts of the site, but nothing that gets me to 100%. I have attached my graph and my sample excel file (will need to link into the file path in the beginning of the graph). You may also need to insert a file path for the SAT file that I am exporting from the dynamo rectangle (just create a test.sat file on the desktop).

FYI - I am using the “Space Layout” package for this, not the “SpacePlanning” Package.  
[SPG\_TEST.dyn](https://forum.dynamobim.com/uploads/short-url/lFJaju04UdBWc5yQTQsERS57wCN.dyn) (39.2 KB)  
[bedTowerSKPU - LVL 2.xlsx](https://forum.dynamobim.com/uploads/short-url/eykibJ39OTaKZBtipGdvUTgVwuX.xlsx) (9.8 KB)  
Since I am new to Dynamo, I’m having a hard time figuring out where in the code this value is coming from.  
Any help is greatly appreciated!

 ![SPG](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/6/c602f90bab7316b943cbe9c5915686e5f7ad10e9.jpg)

---

<div class="post-metadata">

**Author:** ![Greg\_McDowell](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/greg_mcdowell/32/21011_2.png) [@Greg\_McDowell](https://forum.dynamobim.com/u/Greg_McDowell)\
**Post date:** [February 16, 2018, 10:27pm UTC](https://forum.dynamobim.com/t/another-space-plan-generator-space-layout-question/19164/2 "2018-02-16T22:27:48Z")

</div>

Not much help here but this is not where I’d start my Dynamo journey.

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [February 18, 2018, 4:10am UTC](https://forum.dynamobim.com/t/another-space-plan-generator-space-layout-question/19164/3 "2018-02-18T04:10:18Z")

</div>

@kristinaEB Not sure how this package works, but assuming areas of departments are multiples of the area of each cell, I suppose it might be difficult to achieve 100% coverage.

If your objective is just to obtain a graph, as mentioned at [this post](https://forum.dynamobim.com/t/rectangular-voronoi/18913/3), see if the below definition helps instead  
Besides, using the space layout to generate a graph might amount to overkill 🙂

[AreaGraph.dyn](https://forum.dynamobim.com/uploads/short-url/rXOi0NxFHajjFYZFiPF6e9oeKZh.dyn) (4.6 KB)

 ![CodeBlock](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/0/10844888d4a287f6da9506bfa26ac7018921f5ba.gif)

```
sq01 = Math.Sqrt(Math.Sum(a));
sq02 = sq01 % Math.Floor(sq01);
sq03 = 1+sq02/Math.Floor(sq01);
sq04 = Rectangle.ByWidthLength(sq03,sq03);
sq05 = sq04.Translate(Vector.YAxis(),0..#Math.Floor(sq01)..sq03);
sq06 = sq05<1>.Translate(Vector.XAxis(),0..#Math.Floor(sq01)..sq03);
sq07 = List.TakeEveryNthItem(sq06,2,1);
sq08 = List.Reverse(List.TakeEveryNthItem(sq06,2,0)<1>);
sq09 = List.Clean(Flatten(List.Transpose({sq07,sq08})),false);
ct01 = Math.Pow(Math.Floor(sq01),2);
ct02 = Math.Round(a/(Math.Sum(a)/ct01));
ct03 = List.ReplaceItemAtIndex(ct02,-1,List.LastItem(ct02)+(ct01-Math.Sum(ct02)));
sq10 = PolySurface.ByJoinedSurfaces(List.Chop(sq09,ct03).Patch());
clr1 = List.Chop(Math.Floor(Math.RemapRange(Math.RandomList(List.Count(sq10)*3),10,255)),List.Count(sq10));
clr2 = Display.ByGeometryColor(sq10,Color.ByARGB(255,clr1[0],clr1[1],clr1[2]));
```

---

<div class="post-metadata">

**Author:** ![kristinaEB](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@kristinaEB](https://forum.dynamobim.com/u/kristinaEB)\
**Post date:** [February 21, 2018, 2:45am UTC](https://forum.dynamobim.com/t/another-space-plan-generator-space-layout-question/19164/4 "2018-02-21T02:45:38Z")

</div>

Hi Vikram,

Thank you for taking a look, and for putting this graph together! I agree, the space layout package was overkill for what I was _originally_ planning to do, but my original plan was a result of knowing I wouldn’t be able to get much farther with my beginner skills. However, what I _really_ wanted was exactly what the Space Layout Package is intended to do, so I was excited that someone pointed me in the right direction and I am somewhat determined (yet very limited in ability) to make it work. However, since I hit a roadblock with the “site coverage” and most likely won’t be able to figure it out myself, I’ve reverted back to the original, simple goal 🙂 .

What you have would be great for my original goal. However, when I plug my department numbers in, Dynamo crashes. I tried to recreate your graph with nodes (since that is what my beginner brain understands at this point), just to see if I could find where it hangs. Though it seems like I’m able to recreate your code with nodes (some I got stuck on, so just copied your code), it doesn’t produce the same result. The good news is that it doesn’t crash, but the bad news is it looks nothing like what you have shown. Any tips for getting my larger/actual area numbers plugged into this? Or, do you recognize off hand where I am missing the target?

Btw, the Space Layout package is almost identical to the Space Plan Generator, which I believe you are pretty familiar with. I noticed in other posts that you have tried to recreate SPG with DesignScript. Space Layout seems to be a continuation of the deprecated SPG package.

 ![SpaceLayout](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/5/3562bc3ac14c7c7114b42d7cf14a2e9ddcdbc34d.jpg) ![SpaceLayout2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/1/61d6b8c1537aeb60e90862c91b43926609cc9ed8.jpg)[AreaGraph\_TEST.dyn](https://forum.dynamobim.com/uploads/short-url/jtM6amL5G2jFCUXEQvZhLXIWrDs.dyn) (39.9 KB)

---

<div class="post-metadata">

**Author:** ![kristinaEB](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@kristinaEB](https://forum.dynamobim.com/u/kristinaEB)\
**Post date:** [February 21, 2018, 2:49am UTC](https://forum.dynamobim.com/t/another-space-plan-generator-space-layout-question/19164/5 "2018-02-21T02:49:50Z")

</div>

I agree, this is a bit complex, but I have successfully built a few other graphs with parametric department areas and building masses, and am learning A TON by starting out big. It’s been more exciting than frustrating, and with the help of others on this forum, I feel like I’m getting close to my goal. I’m so close, I don’t want to quit now 🙂

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [February 23, 2018, 1:12pm UTC](https://forum.dynamobim.com/t/another-space-plan-generator-space-layout-question/19164/6 "2018-02-23T13:12:49Z")

</div>

> [@kristinaEB](#):
>
> However, when I plug my department numbers in, Dynamo crashes

Would help if you make the numbers smaller. Instead of 1000000 use 1000 (divide all values by 1000)  
Shouldn’t make a difference, istead of _sqmm_, the values would be in _sqm_  
Makes a difference as it would result in creation of fewer unit rectangles to generate similar results.

> [@kristinaEB](#):
>
> Though it seems like I’m able to recreate your code with nodes

Won’t work even if you miss one node or connection, you missed a few 🙂  
See if this helps …  
[AreaGraph\_20180223.dyn](https://forum.dynamobim.com/uploads/short-url/fGuEXXWXRah8fGWf43Ws8h26Bsm.dyn) (40.4 KB)

 ![AreaGraph_20180223](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/d/8d22acbdedcc7699c8d0e91c83bcceb29a0b1ae2.png)

> [@kristinaEB](#):
>
> I noticed in other posts that you have tried to recreate SPG with DesignScript.

Currently my focus is on retail space design with Design Script.  
Not a cell based approach like the SPG, though.

---

<div class="post-metadata">

**Author:** ![esra.abumounshar](https://avatars.discourse-cdn.com/v4/letter/e/54ee81/32.png) [@esra.abumounshar](https://forum.dynamobim.com/u/esra.abumounshar)\
**Post date:** [August 4, 2020, 2:08am UTC](https://forum.dynamobim.com/t/another-space-plan-generator-space-layout-question/19164/7 "2020-08-04T02:08:21Z")

</div>

Vikram,

Any idea why I keep getting this error:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/3/33c5de9a069b227812fd03e7a681092c79eee883.png)

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [August 4, 2020, 9:13am UTC](https://forum.dynamobim.com/t/another-space-plan-generator-space-layout-question/19164/8 "2020-08-04T09:13:42Z")

</div>

> [@esra.abumounshar](#):
>
> Any idea why I keep getting this error

There have been a few changes in the language syntax since that post.  
Below is an updated version

 ![areaGraph_2020-08-04_02-43-21](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/5/5512bc346ed75c63e4b3746250f12bf2dfd8d8f9.png)  
[areaGraph.dyn](https://forum.dynamobim.com/uploads/short-url/igueplhJpleFc9TNFOk9p3YkE3u.dyn) (11.6 KB)

```
sq01 = Math.Sqrt(Math.Sum(a));
sq02 = sq01 % Math.Floor(sq01);
sq03 = 1+sq02/Math.Floor(sq01);
sq04 = Rectangle.ByWidthLength(sq03,sq03);
sq05 = sq04.Translate(Vector.YAxis(),0..#Math.Floor(sq01)..sq03);
sq06 = sq05<1>.Translate(Vector.XAxis(),0..#Math.Floor(sq01)..sq03);
sq07 = List.TakeEveryNthItem(sq06,2,1);
sq08 = List.Reverse(List.TakeEveryNthItem(sq06,2,0)<1>);
sq09 = List.Clean(Flatten(List.Transpose([sq07,sq08])),false);
ct01 = Math.Pow(Math.Floor(sq01),2);
ct02 = Math.Round(a/(Math.Sum(a)/ct01));
ct03 = List.ReplaceItemAtIndex(ct02,-1,List.LastItem(ct02)+(ct01-Math.Sum(ct02)));
sq10 = PolySurface.ByJoinedSurfaces(List.Chop(sq09,ct03).Patch());
clr1 = List.Chop(Math.Floor(Math.RemapRange(Math.RandomList(List.Count(sq10)*3),10,255)),List.Count(sq10));
clr2 = GeometryColor.ByGeometryColor(sq10,Color.ByARGB(255,clr1[0],clr1[1],clr1[2]));

```
