I created a script with a teacher that places point-based families in a project. Now I’m trying to change this to place a line-based family, but I don’t understand how I should do this.
In the test file is the script that places point-based families.
Who could help me with this? I’m trying very hard, but I can’t get it to work.
You have to have a first of all a line based family. In Dynamo if you have a straight line, you can place it with FamilyInstance.ByCurve from Clockwork package
I know, I have that family, but my problem is that I don’t know how I should select the lines in my walls where the family should be placed. If I use this script for the line-based family, it places the family at the wrong places and with incorrect lengths.
This sounds like an issue with getting the correct lines from Dynamo, not an issue with your family. Can you show your graph and explain what you’re wanting to do?
Yeah, I think youre right. What I’m trying to do is to place this linebased family above the windows. But my selection is based on an point based family. That’s why you see the points in this screenshot.
You’ll need to determine the orientation of the window to know where to place the line. You can get this from the window itself using python or custom nodes, or you can get it from the host wall.
Yeah, in my script I’ve selected all the windows to find out the length of each family, but I can’t write python. I’m using the outside face of the wall to select the face.
Find the location of the window. Find thevfacing orientation, rotate that vector by 90 degrees. Move the location point along the rotated vector by (1/2)*(windowWidth);. Draw a line from that point along the rotated vector by a distance of (-1)*(windowWidth);.
First we get the window location. That will be a point at the center of the window.
Then we get window facing orientation. It will be a vector perpendicular to a window.
Then we get window width, and divide it by 2. We only need half the width since our location point is in the center, so we are going to move that point by half in each direction.
Rotate the facing orientation vector to point to the left/right of the window and move the point in each direction.
Create a line from these two new points.
Once we have the line, we can create the line based family.
It will by default be placed at 0 elevation so you can set its offset if you need to move it to sill/head height. Simply get the desired parameter value from the window and feed that into the offset.
Wooow, many thanks @Konrad_K_Sobon. Thanks for your effort in helping me. This is what I’m searching for.
Of course I’m now facing a new problem:sweat_smile:
Can I rotate my placed family? The family I’m using (I can’t share it because we use it for our company) is placed on the wrong side (see picture). I would like to rotate it 180 degrees. Should I get another face in dynamo or is it better to rotate all the families 180 degrees?
The blue line that you see in the screenshot, is the line that dynamo made. How can I move this line to the front of the wall. Is there a option with select faces of the wall to let dynamo know where the lines should be placed?
Why rotate? I think you can get the desired effect by drawing the line from End to Start ie. flip the start point with the end point in a node that draws the line.
Regarding the question about moving the line to face of the wall, I think you have all of the pieces you need already in the definition that I have posted. You would be doing exactly what I did to find the two points at each side of the window, but this time you would not rotate the facing orientation vector, instead reverse it so one vector points inside and one vector points outside. Then use half the wall width as distance to translate the point by.
Cheers!
Ps. I could just do it for you, but it’s so much better to figure it out on your own.