Skip to content

Instantly share code, notes, and snippets.

@ksobon
Created November 5, 2014 03:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ksobon/a197f8584754c09cde77 to your computer and use it in GitHub Desktop.
Save ksobon/a197f8584754c09cde77 to your computer and use it in GitHub Desktop.
custom dynamo node
#Copyright(c) 2014, Konrad Sobon
# @arch_laboratory, http://archi-lab.net
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
excelSheetNumber = IN[0]
excelSheetName = IN[1]
#get all sheets in the project and their numbers
collector = FilteredElementCollector(doc)
sheets = collector.OfCategory(BuiltInCategory.OST_Sheets)
projectSheetNum = []
for i in sheets:
bipNumber = BuiltInParameter.SHEET_NUMBER
tempSheetNum = i.get_Parameter(bipNumber).AsString()
projectSheetNum.append("".join(tempSheetNum.split()))
#compare excel sheets to project sheets and pass only new sheets
newNumber, newName = [], []
for i, j in zip(excelSheetNumber, excelSheetName):
if "".join(i.split()) in projectSheetNum:
continue
else:
newNumber.append(i)
newName.append(j)
#Assign your output to the OUT variable
OUT = newNumber, newName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment