# Draw/place rectangles along a curve

Hello everyone,
I am currently working on a study of an office block. I have a list of rooms (with defined sizes) in the form of an Excel file and I have my building outlines per each floor. I also have each room already drawn as separate blocks.

The pseudocode, as I imagine it, would be as follows:>

select all curves as Facades and store/sort them in a list
select all Blocks and store them in a list
open the Excel file
for every line in the Excel file that is a Room:
---- read its Name, Size, Width
---- compare the size and pick the suitable Block from the list (or draw a rectangle using Size & Width)
---- get Current Point on the Facade line
---- if there is enough space for the Block to fit:
-------- place Block on the point and align it with the Facade line
---- else
-------- move on to the next curve in the Facades list
-------- place Block on the point and align it with the Facade line
---- move Current Point by Width along the Facade line

Currently I am struggling even with the very basic step of “draw a rectangle and place it along a curve” Perhaps the GH logic and components offer a different way of doing this as well.

I’ll be thankful for any pointers, tutorials, keywords to research etc.
Thanks!

Seems like a big bite of the pie to me. My advice would be to break this problem into much smaller “bites”. Maybe try to place an Office where you want it. Set aside the Excel spread sheet and “solve” your challenge with just one “office”, then expand to the bigger question. Just my 2 cents. (Thinking…How do I place a series of “boxes” with in a defined space, using all of that space but not having any of the “boxes” crash into any other “box”?) Here is an example of a rectangle along a curve. I don’t think this is the answer to your bigger problem, but it is what you asked for.
Bill

Rec_along crv.gh (8.2 KB)

Hi all,

Although the competition is now over, I still think it is an interesting challenge to solve and I have some updates

So for the basic version I managed to extract and construct the data i needed for further work in AutoCAD - reading the excel file and drawing the corresponding rectangles with their text information.

Now as step 2 I managed to draw them not as separate rectangles with an arbitrary offset, but in a single line without overlap and holes. Step 3 - I managed to align them to the first curve that I needed.

Currently I am struggling how to make the list ‘hop’ between the disjointed curves. If I have a set of curves that I can join, the rectangles follow the geometry of this polyline quite nicely. When they reach the end however, I would like them to continue on the other, distant curve (which i cannot Join). Any tips? As you can see in the screenshot, the rooms just begin from the start again.

hey,

another update I managed the hop! Basically I realized that the rectangles are drawn on the respective curves already; I just needed to manage where each rectangle is being drawn. I acheived this with a little Python script with the following logic:

``````for item in listOfRoomWidths:
keep adding & summing to the current Curve until its end is reached
hop on to another Curve
``````

Et voila.

Now I need to sort the input; I need to not draw the Rooms that need no daylight (just draw them somewhere else, do not discard), I need to keep the Rooms inside the building footprint and I need to somehow sort the Curves so that neighboring Rooms stay that way.