Placing line based family

Hi guys,

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.

test.dyn (162.0 KB)

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.

Here is the line-based family I’m using. I’m trying to place them above the windows.LineBased Family.rfa (644 KB)

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.

How can I do something like that? Im prefer to get it from the host wall

This could help.

https://dictionary.dynamobim.com/#/Revit/Elements/FamilyInstance/Query/FacingOrientation

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);.

Try this:

If I was to describe the steps here:

  1. Get all windows.
  2. Construct a line that runs parallel to window:
    • 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.
  3. Once we have the line, we can create the line based family.
  4. 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.

Here’s the definition:

2_LineAboveWindow.dyn (59.9 KB)

Here’s the result:

Cheers!

3 Likes

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?

Thanks in advance guys!!

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.

2 Likes

Okay lmao, the first part was not hard at all.

But should I try changing the familyinstance.location? So put some nodes after the point to change it?

Or should I change the line?

Thanks again, I’m still not good at it

I’ve managed to get it work!

I add the point.add with a value off 0,05 (because in all of our projects the walls are 100 millimeters).

Let me now if I could do this smarter or that this is the best way.

Thank you very much guys!!

1 Like

1 Like

You could get the host from each window, find the type for each of those, and get the total thickness and divide by two, then offset by that distance.

1 Like

You can do it like so:

Here’s the Dynamo definition:

2_LineAboveWindow.dyn (72.4 KB)

1 Like

When I’m running this script it doesn’t make the right length. I don’t have time right now to find out, but I will look at it next week.

Thanks for all your help. I wouldn’t be able to do this with your help!