Hi - I have hit a wall as to how I can move forward and would appreciate any assistance.
I have a filtered list of floor plan views (flat list in a node) and I want to make sure that the reveal hidden elements (the light bulb) is turned on in all of them, before continuing to process the views. There doesn’t even need to be a check if this mode is already on in some views, as this Dynamo graph will be run on a project immediately after opening.
I am running into difficulties due to my limited knowledge of both Python & the Revit API. I can’t figure another way to accomplish this task; I have searched forums, the webs, and existing node packages and was unable to find any similar solutions I can make simple edits to.
I am basically making blind attempts at editing a default Python Script Node and nothing seems to be working. At the very least, I’m sure this is a basic Python syntax issue, although I won’t rule out that I am not loading appropriate libraries either.
I am having a difficult time figuring out how I would even go about ‘calling’ the view method
Wow - thanks Steven. This definitely does the trick, but only affects the first view (in the [0] position) in the list. Again, pardon my lack of Python programming, but what kind of changes would need to be made in order to run this node on all items in the list? I’d imagine a simple loop would do the trick.
Yes to make that change you will need a for loop to run the EnableRevealHiddenMode method.
doc.ActiveView.EnableRevealHiddenMode()
The doc.ActiveView line is collecting the active view in Revit and EnableRevealHiddenMode() is activating reveal hidden.
I am not super good with python but I think you will need to make the following change. I do not have time to test right now.
for i in IN[0]:
i.EnableRevealHiddenMode()
you can set the out to be the list of views if you want to use them downstream.
OUT = IN[0]
Sorry if this does not work. I will try it out later.
I can’t seem to get it to loop properly. This outputs the correct list, but only 1 view gets the hidden elements view turned on.
for doc in IN[0]:
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
doc.ActiveView.EnableRevealHiddenMode()
vId = UnwrapElement(doc.ActiveView.ToDSType(True))
TransactionManager.Instance.TransactionTaskDone()
OUT = IN[0]
When I replace the line doc.ActiveView.EnableRevealHiddenMode() with i.EnableRevealHiddenMode() the node fails.
Sorry for any confusion. I meant for you to replace doc.ActiveView. Let me know if this works.
import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitServices")
from RevitServices.Persistence import *
from RevitServices.Transactions import TransactionManager
TransactionManager.Instance.EnsureInTransaction(doc)
for i in IN[0]:
i.EnableRevealHiddenMode()
TransactionManager.Instance.TransactionTaskDone()
OUT = IN[0]
Thank you for answering so quickly. Unfortunately, now this does not flip any of the views & also does not output any views from the node. The node outputs null & is the yellow warning color.
I’m thinking that it is possible that either the doc parameter needs to be redefined within the loop or that the views need to be unwrapped within the loop before being interacted with.
You were right. I was able to test this and its working. I will add this node to my new package smhNodes when I release it. Coming soon.
import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitServices")
from RevitServices.Persistence import *
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
for i in UnwrapElement(IN[0]):
i.EnableRevealHiddenMode()
TransactionManager.Instance.TransactionTaskDone()
OUT = IN[0]
@Steven I’m working on a method to remove all view-specific elements that are: hidden in view or outside the crop region (aka view-specific elements that are no longer visible in the view they are in). There are alot of bad habits of duplicating views in my office and this has a cumulative effect of massive slowdowns, after the new view is cropped and ‘re-used’. The view-specific elements I am processing out are : generic anno, detail groups, detail lines, CAD imports, text, masking regions, detail families