I’m writing a graph to lay out seating along a curve.
Without getting into too much detail, I select an element and use Curve.PointAtParameter to divide it up.
Then I use FamilyInstance.ByPoint to place chairs along the curve.
The weird thing is that if I run the graph a second time using a different curve, Dynamo deletes the first run families and places only the families from the second run.
Even if I close Revit completely, re-Open the project and re-run the Graph, it moves the Instances from the previous run.
I check the Element IDs, and it turns out the the second run creates the same IDs as the first run.
So, am I missing something with the FamilyInstance.ByPoint node? Am I doing something else wrong?
How do I get subsequent runs to create new Instances without overwriting the old?
I posted whole this code somewhere else in aanother post, but cannot find it.
Basically you need to open & close transaction for every change, that’s why it’s inside ‘for’ loop. Or mby I’m totally wrong, but at least it works this way Marking solution for dynamo player is kinda wrong, cause u won’t run dynamo player in revit 14/15/16
Hmmmm…
I’m going to have to re-work a few things.
I’ve got two inputs in my original - one to pick the family and another to pick the path.
First time I tried to run it with Player, it just spun away & I had to use Task Manager to kill it.
So I’ll have to either give up on selecting the family, or pipe that in some other way.
Thanks, John.
Perhaps you know why I have to bother with this, though. I asked over here
about why the FamilyInstance.ByPoint node bonds itself to the Instances & haven’t gotten an answer.
I’m sure there’s some logic but I can’t think of why you would want to always use the same Family for every subsequent run.
However, might I be so bold as to make one more request? (I know, I’m greedy)
Can you do the same thing for FamilyInstance.SetRotation?
Apparently, all of the FamilyInstance nodes bind to the initial element, so I had to Freeze that node in my graph.
I’ve been struggling with the similar problem for a bit, and here’s what I came up with:
Using the ‘Family Instance By Point in Transaction’ node from the Bakery package (authored by @Luke_Johnson), solves the problem with disappearing elements each time you run the graph;
Then I modified this custom node to add an activation for the family symbol: # Make sure the familysymbol is active if famtype.IsActive == False: famtype.Activate() doc.Regenerate()
This ensures that your family, that you have just loaded to the project, will be ‘recognized’ by Revit.
Placed the ‘FamilyInstance.SetRotation’ at the end of the graph, so that Dynamo firstly places my family instances, and then rotates them.
So each time I run the graph, it places new instances of chairs and rotates them:
Using ‘FamilyInstance.SetRotation’ becomes tricky when you need to place families by curve (dynamo ‘curve’ == revit ‘line’). This is because each curve has its direction (oops ), and so does the tangent vector ('Curve.TangentAtParameter) at each point of this curve. And when you try to get rotation angle between tangent vector and i.e. YAxis, you’ll probably get some negative values;
Of course, the way your family is built (in terms of directions inside the family editor) will also affect rotation. My graph is still work in progress, and I suppose that it won’t be universal as I previously planned;
Instead of using lines, you can get the curves from in-place family by selecting one of its edges. But the problem is that these edges may be cut by walls or other intersecting elements.
How would this be modified for placing instances in the view, instead of a level? I’m having a hard time figuring out how to convert revit api notes into python code.
Best to start a new topic with the usual ‘this is where I am’ and ‘this is where I want to be’ content and link back here as this is a fairly significant departure and will likely be useful to others in the future.