Hello! I am creating a study where you input a line and it creates an apartment layout. This is for a socialized housing project
I am having difficulty when the input line is not just a mere horizontal line anymore, when it draw vertically to y axis that is where the orientation messes up.
I need the orientation of objects be rotated to face the hallway, just like the floorplan highlighted in green.
attaching here the grasshopper scripts. the components grouped in yellow is the one I am working on.
4PH.gh (101.9 KB)
I excluded the objects in the corner because I don’t know how they should be arranged.
4PH a.gh (119.6 KB)
1 Like
thank you for this! it is working well. is there any way that even if I do 45 degree angle of the line, the doors will still face the corridor?
this should get you started
The orient component needs a plane - when you pass it a point it simply constructs a plane with standard orientation.
So i constructed one with the origin at the point you provided, and oriented it’s x-axis with the tangent. like so
note: the direction of the curve matters so you might want to add a flip curve component in case you get errors
to get full control you’d need to also deduct the y-axis, but we’ll deal with that as need arises
1 Like
this is nice! however, when I make an L type of curve, it does not orient the plans
Thus it should not be necessary to reverse the direction of the curve which is still possible.
4PH b.gh (118.4 KB)
2 Likes
It worked in my case, but @leopoldomonzani 's second solution is easier to understand, and more complete since it accounts for the orientation of the plan group.
if, however, you want to be able to flip the plan (mirror it) or change which side of the curve the plan orients itself, spending some time understanding the tangent and normal vectors to construct a plane to control the exact orientation of an object would be worthwhile.
1 Like
wow this is much simpler, thank you for this! I am now just formulating to reflect it on the other side of the plan
ohh I see, I haven’t utilize much the other uses of tangents and vectors yet. I will study it. thank you for the advice 
may I know how to do it on the other side of the corridor, 'cause what I did is just rotate it so that the door will face the corridor
like so?
I used the curve you created for that side of the corridor as the input to the divide curve component. I then constructed a plane using the division point as the origin, the tangent as the x-axis and for the y-axis i rotated the tangent -90 degrees (equivalent to -0.5*Pi)
note: the vector display component is just to visualize the direction. in green you see the direction of the y-axis of the construction plane.
Lastly i oriented your plan using the construction plane.
here’s the file for your study.
4PH_aa_1.gh (104.5 KB)
p.s. of course you need to iron out the kinks
p.s.2 sorry i forgot to internalize the data. i re-uploaded the gh file.