I am placing this desk family at the corners of the wall (Family origin point is the bottom left point of the Desk) with the help of dynamo. I placed it correctly as shown in the picture 1
I want to rotate it and align the longer side of the desk with the horizontal walls(Sometimes to the vertical walls). Can you please tell me how to do this. Manually i used the mirror command to make it look right.
i want to filter the walls if this a Bottom left corner, Top left corner, Right top corner or Right bottom corner. and then i can apply the mirror commands on that.
But i dont know how to filter the 4 types of corners. Or there is another easy way to do that?
This problem is a little bit more difficult than first meets the eye, lets say for example you have walls in a ‘8’-shape, on which side of the wall should the desk then be placed?
Could you please share what you have created in Dynamo so far? Please share some files from dynamo and the host aswel
To rotate an element use Element.SetRotation after the FamilyInstance creation node. This node expects a rotation value as double.
To get the necessary rotation value you need to know which grid is the one you want to base your direction/ rotation value of. You could just pick one grid and use Line.Direction to get a vector or you could determine which (vertical) grid is the closest if they have different vectors (using Geometry.DistanceTo, List.MinimumItem, List.IndexOf and List.GetItemAtIndex, in that order with some list level management.).
From there using the AngleAboutAxis node you can transform that vector/ those vectors into a rotation value which you can use for the Element.SetRotation node.
From there I would bring in the walls to determine which of the 4 rotation/ mirrored states the element should be in.