Is there any way to duplicate (with detailing, NOT as dependent) one singular floor plan multiple times, renaming it from names in a list already created in Revit MEP 2015?
I can only seem to duplicate one at a time as of right now and at that point using dynamo doesnt have many benefits for this case.
Hello mfitzemeyer,
Like this?
#Modiefied code from clockwork
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
view = UnwrapElement(IN[0])
amount = IN[1]
elementlist = list()
dupopt = Autodesk.Revit.DB.ViewDuplicateOption.WithDetailing
TransactionManager.Instance.EnsureInTransaction(doc)
for i in range(amount):
newview = view.Duplicate(dupopt)
elementlist.append(doc.GetElement(newview))
TransactionManager.Instance.TransactionTaskDone()
OUT = elementlist
Alt 2:
1 Like
Yes! The only other added feature id be looking for is to name them directly instead of it being called “copy 1,2,3 etc” i want to pull from an excel file. I know how to get lists but i dont know how to use it to rename already existing floor plans.
Did you try the SetParameterByName node?
3 Likes
Another way that builds off of the code already presented, is to use the list of names as your iterator. One less place in the code to worry about something going wrong if your list of names and your quantity integer don’t quite match up.
import clr
clr.AddReference(‘ProtoGeometry’)
clr.AddReference(‘RevitAPI’)
clr.AddReference(‘RevitServices’)
import Autodesk
import RevitServices
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
view = UnwrapElement(IN[0])
nameList = IN[1]
newViews = list()
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
for name in nameList:
newViewId = view.Duplicate(ViewDuplicateOption.WithDetailing)
newView = doc.GetElement(newViewId)
newView.Name = name
newViews.append(newView)
TransactionManager.Instance.TransactionTaskDone()
OUT = newViews
1 Like
This is perfect. I added replaced the code block with “‘View’+(1…5);” with an excel reader to take names directly from a pre-written file and it worked exactly how I wanted it to.
Thank you very much.