As it turns out, everything you want to transfer is a revit element and can thus be associated with a unique ID. So if you are trying to transfer project stanards, try this one on for size:
This workflow links a project (ideally your template.rte saved as a .rvt), pulls the known Elevation Type by ID and loads it into the host project. The associated names, tags, etc are all preserved!
This will probably work for materials, railing types, and well - just about everything else.
Its not just a nice way to transfer project standards - but also the view types that don’t want to transfer - and uh family types too!
All you have to do is obtain the list of every element ID that you want to transfer.
They do not need to be placed in the template file.
After some experimentation, I’ve found that this approach works really well specifically for the title of this topic - transferring project standards. As for copying views, schedules & sheets, well that doesn’t seem to work out nearly as good. And there’s the other obvious caveats; you actually have to link a project, know the element IDs and the project cannot be in template format. So with that, here’s the Rhythm approach:
Rhythm’s nodes also allow you to successfully search the parameters of an unopened document which means that filtering specific elements is not an issue. This also works for drafting views:
Fair point.
It seems like that issue should be solvable with a pass-through node; you get the schedules first - then transfer the schedule with the new Id and place it on the sheet. I think that copying schedules from other projects is possible with Python, but no nodes for it currently exist - at least none that I am aware of.
Thanks @Marcel_Rijsmus. This seems useful for copying sheets and schedules that already exist in the parent document. Have you had success with these nodes for copying them from another document?
I suppose that if you were trying to rebuild schedules with Dynamo, then this might be useful. But there are simpler ways to that than cueing up another schedule, let alone from another project. If you know the category and fields you need, ootb nodes are pretty good at that.
Good to hear that.
I abandoned copying from linked files when i found out that all related project parameters are copied too.
I guess i can make use of that some time or another.
So when i copied something with parameters and all, i found i got two parameters with the same name, if they were not shared parameters.
Do any of these methods, or any others, work for copying model views from a linked file yet? Looking to copy a sheet with all views from a linked architectural model to quickly make an HVAC sheet in an MEP model. Thanks!
I am not positive this would work, but you could try using what I “didn’t” want from the post and see if you could filter out ONLY the ViewExtent element.
Thanks @SeanP! I’ll see what I can do with this. I follow the logic, but I’m a total newbie to the actual coding world outside of using Dynamo nods. It doesn’t look like the code in the link you attached is written in Python, am I right? I’m only aware of the Python script node in Dynamo…is there something else I should be aware of to use this code snippet?
You are correct, that was written in C# for an Add-In vs Dynamo. However, you can usually port most of the information across, but I also think you could just about do this with me nodes. I will try to get something out together and test when I can get to my computer.
I have done all the heavy lifting with python for each, but much of it may be able to be converted to nodes if you can find the right ones.
Also keep in mind that this graph is really proof of concept and is not production ready in any sense so don’t throw this at your real model right off the bat. Also, the view will come in with the same name as the one in the link so just make sure you don’t have the same view name already.
Get Linked Views:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
#Preparing input from dynamo to revit
link = UnwrapElement(IN[0])
vElems = []
names = []
cView = []
views = FilteredElementCollector(link).OfCategory(BuiltInCategory.OST_Views).WhereElementIsNotElementType().ToElements()
for view in views:
name = []
elems = FilteredElementCollector(link,view.Id).WhereElementIsNotElementType().ToElements()
for e in elems:
if e.Name == "ExtentElem":
vElems.Add(e)
break
cView.Add(view)
OUT = vElems, cView
Copy:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
#Preparing input from dynamo to revit
link = UnwrapElement(IN[0])
elem = UnwrapElement(IN[1])
view = UnwrapElement(IN[2])
elemIds = []
elemIds.Add(elem.Id)
done = []
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
views = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Views).WhereElementIsNotElementType().ToElements()
for v in views:
if view.ViewType == ViewType.FloorPlan:
tempView = v
break
done.Add(ElementTransformUtils.CopyElements(view, List[ElementId](elemIds), tempView, Transform.Identity, CopyPasteOptions()))
TransactionManager.Instance.TransactionTaskDone()
OUT = done
@SeanP, thanks for you effort. I didn’t have a lot of time to look into this yet, but I hope to this weekend sometime. I did what you told not to and tried to plug it right into a graph I already was trying, and well…as you already basicallywarned, it threw an error. I’ll play around a little more and post the error later. Thanks again and sorry it took so long for me to get back to you.
@JustinStirling, I modified the code for the Get Linked Views to eliminate View Templates and I have also since simplified the Copy node with functionality for iterating lists.
Try this new graph / python and see if it works any better for you: Copy Link View.dyn (11.8 KB)
I tried comparing the views between a working and non-working scenario and see that one that doesn’t work contains some differing views types than the working one. Might one of these now be throwing the error and need filtered out too?
It’s rather strange in the fact that the python script node you provided works fine on every file I have from one arch/struct firm but not from the one I’m currently working for.