Dynamo - Create Sheet won't work - sheet Number already in use / ghost sheets

This is driving me mad now. I have tried every method including OOTB nodes, 3rd party package nodes (Clockwork, GeniusLoci, Rhythm, Bimorph etc) and Revit API that I can find online on Youtube, in this forum, NONE of them work. It’s so screwed to the point I find it’s ghosted.

In short, I need to add multiple drafting views (containing imported CAD symbols) in groups, to different sheets, with my generated sheet name and number.

#1 symptom: using OOTB SheetByNameNumberTitleblockViews, those sheets with my desired name and sheet number appear in sheet list schedule for one second or less, then disappear. Dynamo run shows successful, however returned sheets shows no name and not visible in sheet list schedule/Project Browser
Possible reason:
Warning: Sheet.SetSheetName operation failed. referenced object is not valid. possibly because it has been deleted from the Gtabase, or Its creauon was undone.

#2 symptom: sheet Number already in use
this happens often too, using 3rd party nodes, API, and sometimes OOTB node

#3 symptom: view xxx cannot be added because already on another Sheet (while no sheet was ever created)

#4 symptom: view too large to be added to sheet

Hey,

Think we are going to need to see your graph.
Can you post screenshots of your graph, with your input visible and node previews visible.

Possible solution for error #2: create the sheets first and let Revit automatically assign the sheet name and number. Then change the name and number after the sheets have been created. Make sure your levels/lacing is set correctly when trying to rename and renumber multiple sheets at one time.

As @MVE1112 states, without seeing your graph, it will be difficult for us to instruct on what to do for the other errors.

My inputs are absolutely of the correct nesting, object type and lacing


And it seems after first run, I will have sheet number already in use error, which in fact there are no sheets ever created inside the model

reopened the model and run

based on the error you posted, some views are too big for the sheet, hence the error. Maybe you can do it one by one and test out which drafting view is causing the error and then figure out why the drafting view is so huge. With a scale of 1000:1, I cant possibly think that your drafting view size will exceed the sheet size but I guess it might be your cad having floating elements which causes that max size

and also, its view 0 because of viewport I guess, not your drafting view name

your errors 1-3 were caused by transactional issues… it might be good to end the global transaction in dynamo before trying to create new sheets. I would suggest to make your script work in this manner.

  1. End all transaction
  2. Check the drafting view size range, if exceeds a certain size, don’t proceed and show some indicator that the size is wrong
  3. Check for existing sheetname/sheetnumber, if any exists automatically add a suffix to it (e.g xxx (1))
  4. If everything else complies, proceed to create sheets

edit:
if you do not want to add suffix and want to “replace” the sheet, you will have to do it in python


Yes which I did, the node did not report error, but sheet was not created. In Revit 2023 I could see the same node return a sheet object, but with name empty
P.S. this is a fresh first run on reopened model

I’ve deleted all sheets from this model.
In fact I’ve also tried accessing Revit API in Dynamo Python script codelet. I’ll post in a moment


image

I am using Revit 2020 btw (on Revit 2023 I have similar issue)

hi it works for me, using the sample project
image

below is the code:

#Preparing input from dynamo to revit
sheetnames = ToList(IN[0])
sheetnumbers = ToList(IN[1])
sheet_titleblock = UnwrapElement(IN[2])
draftingviews = ToList(IN[3])

TransactionManager.Instance.EnsureInTransaction(doc)
#Main codes to be within this region
result = []
for sheet_name, sheet_number, drafting_view in zip(sheetnames, sheetnumbers, draftingviews):
	newsheet = Autodesk.Revit.DB.ViewSheet.Create(doc, sheet_titleblock.Id)
    #before setting name/number check for duplicates
	newsheet.Name = sheet_name
	newsheet.SheetNumber = sheet_number
	sheet_center = XYZ((newsheet.Outline.Max.U - newsheet.Outline.Min.U) / 2, (newsheet.Outline.Max.V - newsheet.Outline.Min.V) / 2, 0)
    #before creating viewport, check for the size requirement, you can set your viewscale here if its too big, but its up to you
    vp = Autodesk.Revit.DB.Viewport.Create(doc, newsheet.Id, drafting_view.Id, sheet_center)
	result.append(newsheet)
		
	

#End of region
TransactionManager.Instance.TransactionTaskDone()
TransactionManager.Instance.ForceCloseTransaction()

#Final output
OUT = result

this is the created sheet:

1 Like

I had similar issues so I decided to solve it with workarounds and building in safeguards.

  • I think the lacing is broken is this node so I help it along by just using List.OfRepeatedItem.
    This only works for 1 view per sheet btw.
    (I processed this into a code block to save a lot of space and to ‘lock down’ any changes or when it breaks. So no in between lacing issues. The group of nodes work as 1 unit this way)

  • I basically turn off all annotations in the views so they’re not warping the Viewport Centerpoint.

  • I also delete all empty sheets that might be occupying the numbers.

However, if all fails, just use pyRevit

1 Like

The sample is still cooking, I guess.
Curious about, what it looks after getting done.

Hi,

I have NameError: “ToList” is not defined.

I have the following imports:
import clr
clr.AddReference(‘RevitServices’)
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

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

clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.Elements)

if I add the below codes, it will prompt ImportError: cannot import “ToList”

clr.AddReference(‘System.Core’)
import System
clr.ImportExtensions(System.Linq)
from System.Linq import ToList

if you are looking for a typical list, why not use the Python method list()?

If you want a .NET list try this:

# Imports the .NET list class into python
clr.AddReference("System")
from System.Collections.Generic import List as NETList

To use the .NET list you need to provide the class which the list contains as well,
lst = NETList[ElementId](listOfElementIds))

I feel there’s something wrong with my Revit, so I tried to do a fresh new installation. I could launch the uninstall wizard for Revit 2020 and 2021, I chose the repair option, and it succeeded.
However, I could not launch the uninstall wizard for Revit 2022 and 2023. Simply won’t show up. And yes, I did reboot my PC.


which I did, but encountered this error:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 21, in
TypeError: DraftingView is not iterable


changed the code a bit further, and now this error:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 35, in
Exception: viewId cannot be added to the ViewSheet.
Parameter name: viewId

Hi we are trying to automate multiple views placement and alignment on to sheets, may I ask if you are aware of any existing solutions that can do this? Thanks in advance