Last active
February 12, 2020 18:21
-
-
Save Cyril-Pop/0b482612b7c2bb0ff9a78034b13b2471 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clr | |
clr.AddReference('ProtoGeometry') | |
from Autodesk.DesignScript.Geometry import * | |
#import Revit API | |
clr.AddReference('RevitAPI') | |
import Autodesk | |
from Autodesk.Revit.DB import * | |
#import transactionManager and DocumentManager (RevitServices is specific to Dynamo) | |
clr.AddReference('RevitServices') | |
import RevitServices | |
from RevitServices.Persistence import DocumentManager | |
from RevitServices.Transactions import TransactionManager | |
doc = DocumentManager.Instance.CurrentDBDocument | |
templates = UnwrapElement(IN[0]) | |
viewfamType = UnwrapElement(IN[1]) | |
outviewplan = [] | |
collLvl = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).WhereElementIsNotElementType().ToElements() | |
TransactionManager.Instance.EnsureInTransaction(doc) | |
for template in templates: | |
for lvl in collLvl: | |
newvpl = ViewPlan.Create(doc, viewfamType.Id, lvl.Id) | |
newvpl.ViewTemplateId = template.Id | |
outviewplan.append(newvpl) | |
doc.Regenerate() | |
TransactionManager.Instance.TransactionTaskDone() | |
OUT = outviewplan |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment