Using Grasshopper to automate window modelling

Hi,
For interior design purposes we are trying to see if Rhino is a viable product for 2D modelling of our plans. In our apartment/ house plans we model windows in a simplified way - 50 by 50 mm frame and inside is the window. In cases there are door we put an intermediate frame, that joins to the frame around the perimeter as shown in the picture. I haven’t used GH before, but I managed to get a I guess very simple definition for a simple windows. From top view the frame is viewed as a 50 by 50 mm square with a cross.
My question is can GH definition be made to produce top and side view, especially considering the door scenario?

Regards,

Pete

Screenshot (16)

Of course, make sure the appropriate relationships are set and you can do any kind of drawing you want. Here is a simple example of setting up relationships between drawings.


SimpleWindow.gh (12.6 KB)

2 Likes

The top and side views should probably be sections though, since you’d only see those when cutting through the wall the window would sit in.

You can chose whether to offset the view lines from the sections lines by a certain distance (cf. number slider), or not. Offsetting should allow you to give more depth to the drawing.

SimpleWindow2.gh (21.6 KB)

2 Likes

The top and side views should probably be sections though

Mine is intended to be sections yes, however I do not know their details (number of panes, sills, frame material, etc.) so I leave it to them to fill the rectangle in with their specifics. Hopefully they understand from our definitions the possibilities of parametric relationships :smiley:

1 Like

Thanks for the quick response. I will have a look at the second definition - look quite complicated.

You’re welcome!
Haha, don’t be discouraged by the look of the definition. The top and bottom parts I added to Michael’s solution, do practically the same thing.
Here’s an explanation of what happens, let’s say for the Top Drawing:

First, a new rectangle, representing the sections of the window frame, is created at the origin of the scene (GH/Rhino document) and moved to the two right places in the drawing (thus creating two rectangles, or one that exists in two places).
Then a (poly)line is drawn between the center points of these left and right frame section rectangles. In order to find the section curve of the window in between them, the line is intersected with the frame section rectangles. The two intersection points represent the end points of the window section line, and we can draw a new (poly)line in between.
Now we can use the new line to also get the view lines of the window frame. We simply move/copy it in two directions by half the depth of the window frame.
In order to implement the offsetting of view from section lines, we simply move the end points of each line towards the line center. Each line/curve has a normalised domain from 0.0 to 1.0, 0.5 being a point at its center, and 0.0 as well as 1.0 representing the end points. Knowing this we can remap a value from metric (or imperial units), the desired offset value from its current domain (0.0 to line length), and remap it to the normalised line domain (0.0 to 1.0), to find our new end points. Now two new (poly)lines can be drawn representing the new frame view lines.

1 Like

Hi,
I spend some time figuring out your definition. I have build on your definition as a exercise to get the hang of grasshopper.
Only if you have time can you give some critique as I think that there are more complex functions than just multiply, move, divide, etc. to build something like what I have done. I think what I have done can be made with much less effort if you know what you are doing :D.
I do hope an architectural student to find this useful.doors_and_windows.gh (58.6 KB)

Just to add something to that. Do you have a simple example on how to use toggle functions. Opening of doors is marked as in the screenshot, dashed means it opens towards you and solid means away from you. How can a toggle be used to select if a door opens to the left or to the right and does it open towards or away from you?

Here’s a simple example on how to implement the left and right directional indicator, as well as how to switch between different display modes (i.e. color, linetypes, etc.):

I don’t think that displaying a dotted curve or any line type is possible (?) in vanilla Grasshopper. You could however come up with a geometrical solution, for instance by dividing a curve, shattering it and culling every second segment.

SimpleWindow3.gh (32.9 KB)

2 Likes

Thanks for that. Im so lost with the data tree structures and what you did manipulates the structure of the rectangle quite heavily. I will have to dive deeper into what you did. I think understanding this data structure will be fundamental to understanding GH.

Yes, understanding lists and trees is essential for complex Grasshopper workflows.

Essentially a list is a flat data structure, a sequence of data items with a certain order that can be altered.

Example:

  • apples
  • tuna
  • cat food
  • chocolate
  • bread

In pseudo-code, you’d write the same shopping list like this:
["apples", "tuna", "cat food", "chocolate", "bread"]
Or like this:
{"apples", "tuna", "cat food", "chocolate", "bread"}

Don’t worry about the " ! They just mean that the items are text strings, which is relevant in programming.
Now each list items has a numbered position in the list, which can be changed. The position is called index and the list indexing starts at 0 (not 1). "apples" sits at index 0, "tuna" at index 1, and so fourth. You can fetch individual items with these indices. An index of 0 gives you the first (i.e. "apples"), and an index of -1 the last item (i.e. "bread") from the list.
Lists can be re-arranged (i.e. Jitter), items deleted (i.e. CullIndex), two or more lists can be merges, etc.

Trees on the other hand can viewed as multidimensional data structures, but they basically work similar to lists.

Example:

  • produce
    – apples
    – salad
  • canned goods
    – tuna
    – beans
    – cat food
  • dry goods
    – chocolate
    – granola
  • bakery
    – bread

Now to represent this multidimensional data in pseudo-code would look similar to this:

{
  ["apples", "salad"], // produce
  ["tuna", "beans", "cat food"], // canned goods
  ["chocolate", "granola"], // dry goods
  ["bread"] // bakery
}

You can think of this as a nested list, a list of lists, a two-dimensional data tree…
At index or branch {0} we now have produce, at {1} canned goods. At index {0;1} we have salad. Whole branches can be extracted by index or path just like items in a list.
Most other manipulations also still apply.

1 Like

Very detailed explanation. Thank you!