Overriding REVIT prompt in Dynamo

So this complex piece of code is working nicely, outputting a room floorplan and ceiling plan predictably and applying their templates. (In production each plan will have a different template.) Renaming the room ceiling plan cleanly is an important step in keeping the project highly organized as the number of rooms increases into the hundreds.

However, this method is flawed because renaming the ceiling plan from the level name to the room name in Dynamo triggers a REVIT prompt the user has to click through to continue, the well known “Would you like to rename the corresponding level?” This small thing can become an obstacle on a project where people are already hesitant of Dynamo’s use. This previous question addressed the same problem in a slightly different configuration, but it doesn’t appear the forum has a solution for it yet. I did a bit of digging around for “event handlers” but couldn’t find anything helpful. Perhaps someone has worked around this before? (I’m on Dynamo 1.3.2 on REVIT 2017.2.)

If you are trying to create a floor and ceiling plan per room, why not modify the FloorPlan.PerRoom node tonjust create a ceiling plan instead of a floor plan? I believe I have done this before and it worked quite nicely. However I think I split it into two graphs to help functionality and speed.

That is probably one of the most useless dialogs in Revit. Why not disable it entirely with a simple Revit addin and not just for this script?


Thanks for the tip. Why not modify the “FloorPlan.PerRoom”? has a rather straightforward explanation: That’s easier said than done depending on one’s skill level and experience. And certainly if you or anyone reading this has any insight into the matter, I’m sure I speak for other forum members when I say we would welcome any input. In the future, many users will find this thread and any solution materials you can post would be greatly appreciated. It’s a great contribution to the community. I will try to open up the node at length and work on a copy of it to see if I can figure it out but it’s really a blind leading the blind situation if I’m leading the charge. I will try to share whatever I find. While I’m a bit more conformable with a C# script; thinking like a BIM manager, this creates a challenge for deployment, especially in smaller firms lacking sophisticated deployment procedures or infrastructure. A cleanly packaged node that users can run in the Player is what I’m ultimately aiming for.

You would need to find the “FloorPlan” references and change them to “CeilingPlan”
Here is from the Original Node:

Here are the edits to make ceiling plans:

The inputs remain the same as the original node:

Copyright(c) 2015, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

import clr
from Autodesk.DesignScript.Geometry import *

# Import Element wrapper extension methods
import Revit

# Import geometry conversion extension methods

# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

# Import RevitAPI
import Autodesk
from Autodesk.Revit.DB import *

import System
from System import Array
from System.Collections.Generic import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'

#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN

if isinstance(IN[0], list):
rooms = UnwrapElement(IN[0])
rooms = [UnwrapElement(IN[0])]
namePrefix = IN[1]
bboxOffset = IN[2]
runMe = IN[3]

def OffsetBBox(bbox, offset):
bboxMinX = bbox.Min.X - offset
bboxMinY = bbox.Min.Y - offset
bboxMinZ = bbox.Min.Z - offset
bboxMaxX = bbox.Max.X + offset
bboxMaxY = bbox.Max.Y + offset
bboxMaxZ = bbox.Max.Z + offset
newBbox = BoundingBoxXYZ()
newBbox.Min = XYZ(bboxMinX, bboxMinY, bboxMinZ)
newBbox.Max = XYZ(bboxMaxX, bboxMaxY, bboxMaxZ)
return newBbox

errorReport = None
if runMe:
viewTypes = FilteredElementCollector(doc).OfClass(ViewFamilyType)
for i in viewTypes:
if i.ViewFamily == ViewFamily.CeilingPlan:
viewTypeId = i.Id

existingPlans = FilteredElementCollector(doc).OfClass(View).ToElements()

existingPlanNames, existingPlanElements = [], []
for i in existingPlans:
if not i.IsTemplate:
if i.ViewType == ViewType.CeilingPlan:

# Start Transaction

floorPlans = []
cropBoxes = []
for i in rooms:
levelId = i.LevelId
bbox = i.BoundingBox[doc.ActiveView]
newBbox = OffsetBBox(bbox, bboxOffset)
cropBox = OffsetBBox(bbox, -bboxOffset)
viewName = namePrefix + " A-PP" + i.get_Parameter(BuiltInParameter.ROOM_NUMBER).AsString() + " (" + i.get_Parameter(BuiltInParameter.ROOM_NAME).AsString()+ ")"
if viewName in existingPlanNames:
view = existingPlanElements[existingPlanNames.index(viewName)]
view.CropBox = newBbox
view.CropBoxActive = True
view.CropBoxVisible = False
newView = ViewPlan.Create(doc, viewTypeId, levelId)
newView.ViewName = viewName
newView.CropBox = newBbox
newView.CropBoxActive = True
#view.CropBoxVisible = False

# End Transaction
errorReport = "Run Me set to False"
# if error accurs anywhere in the process catch it
import traceback
errorReport = traceback.format_exc()

#Assign your output to the OUT variable
if errorReport == None:
OUT = floorPlans
OUT = errorReport

The prompt shows up when renaming a view with the same name as the level. I got around this by leaving the original view and creating duplicates that were renamed instead. That way you bypass the prompt entirely.


That was really excellent advice. I rejigged the node and everything is outputting wonderfully.

Sadly, even though the script is working seamlessly, I’ve created and edited the nodes in the archilab folder which will be an obstacle for deployment. Both of them have custom edits. Something I probably should not have neglected.

Showing as invalid syntax!
can you share the Dynamo File.