Create Views and sheets from Excel

I am trying to create views from levels and put them on a sheet from Excel, but I have a Pyhton node, that dose’nt work properbly.

Python Node

the script is sometimes working, and it looks like, that the information from excel i correct.

Can anyone help me?

1 Like

Can you show the Python code and your inputs? It looks like you have a null or empty list somewhere.

1 Like

Of course :slight_smile:!

Python Script|569x500

If you could, please copy and paste your Python code as preformatted text so others can try it without having to retype it all :slight_smile: This post here is a gif showing how you can post it as preformatted text

It seems that your error is with the Titleblock input. Can you show what you are inputting into the IN[2] port on your Python code?

Sorry, new users can only put 2 links in a post.

Is there another way, so I can Show you the Python Code?

You don’t need to provide a link to share a Python code, just copy it from the Python node, paste it here, select the code text and hit the </> symbol. I typed it up from the Python code from the screenshot you posted above:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

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

sheetnames = IN[0]
sheetnumbers = IN[1]
titleblock = UnwrapElement(IN[2]) #unwrapped titleblock
sheetlist = list()


TransactionManager.Instance.EnsureInTransaction(doc) # you need an active transaction as you will create elements

for number in range(len(sheetnumbers)):
	newsheet = ViewSheet.Create(doc, titleblock.Id) # create a new sheet where titleblock.Id is the id of the tileblock
	newsheet.Name = sheetnames[number]
	newsheet.SheetNumber = sheetnumbers[number]
	sheetlist.append(newsheet.ToDSType(False))

TransactionManager.Instance.TransactionTaskDone()

OUT = sheetlist

It works properly on my end; based on the error you showed in your post, I believe you are giving the node an incorrect input on IN[2]; This is what your inputs should be (IN[0] = list of sheet names, IN[1] = list of sheet numbers, IN[2] = titleblock family type)

Double check that your inputs are correct and try running it again; if it is still giving you an error, post a screen capture of your graph with your inputs showing :slight_smile:

2 Likes