Use Dynamo Player.
Use Dynamo Player.
I need to have input - Select an Element for the Path - so I can’t run it automatically
Also, just found this thread
But their “Close and re-open” solution didn’t work for me
Use “Pick Model Elements” Custom node from Rhythm package to select elements in each run. Hope that makes sense!
Thanks for the quick responses
Found another thread the has a link to GitHub. (Which you were an active participant on ! )
It says that this is “working as intended” for that node.
I’ll try the Rhythm node / Player trick after lunch
I am actually going through this same thing now. Does my node really allow this?
rewrite code from the first post.
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
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.
Running through this problem my self.
My solution is:
Run in Dynamo
Cut/Paste in place elements in Revit
Run again in Dynamo
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.
Here is the code:
import clr clr.AddReference("RevitServices") clr.AddReference("RevitNodes") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument import Revit clr.ImportExtensions(Revit.Elements) clr.ImportExtensions(Revit.GeometryConversion) clr.AddReference("RevitAPI") from Autodesk.Revit.DB import * def ptslist(obj1): if hasattr(obj1,"__iter__"): return obj1 else: return [obj1] famType = UnwrapElement(IN) pts = ptslist(IN) lvl = UnwrapElement(IN) elems =  for pt in pts: TransactionManager.Instance.EnsureInTransaction(doc) elems.append(doc.Create.NewFamilyInstance(pt.ToRevitType(True), famType, lvl, Structure.StructuralType.NonStructural)) TransactionManager.Instance.TransactionTaskDone() OUT = elems
Works great! Thank you sir.
This is fantastic! Ditto @DaveP question on FamilyInstance.SetRotation. Is this something that has been picked up in the past few weeks?
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:
And here are the caveats:
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.
Ok, I’ve done so here: Close transaction with each run of the script using place instance per view
2 posts were split to a new topic: Replacing Family Instances with new Family