Generate Views and Revision Clouds

Hello!

I have been trying to make this work for some time, and can’t figure out the exact problem. It works with a single element, but will give errors like “Referencing non-pointer”, and Null input when trying to feed it the whole project or elements in active view. My guess is the filtering I tried to do is insufficient.

The aim is, to generate a 2D and a 3D view for each element in Revit on their respective levels (so they are visible in the 2D view), name the views from the element’s Mark parameter, have them colored red in both views, and put a Revision Cloud around them in 2D view. The 3D view must be zoomed to fit, and should show the element in their section box from their bounding box.
These Views will be later exported to PDF-s for future use in an other department at the company. I have more than 3-4000 elements to show like this, across multiple projects.
I’d be grateful for your input with this.

Your image is illegible. Please use Export as Image in the top right corner of the Dynamo window when the nodes and node titles are visible. Make sure to have all node preview bubbles pinned as well, so we can see your data.

This is just a list management issue. If it works for a single element then you need to work through each node and make sure it’s returning everything correctly for a list. This will almost certainly mean you need to modify some list levels and maybe modify some logic, but it’s possible. If you’re getting null errors then I would also start with a small list of elements that you know all work individually already.

Unfortunately the image export button doesn’t work, so tried to stitch it together from screen captures.
My guess is there are elements in the model that are visible, but they don’t have anchor levels, or bounding boxes. How can I filter them out?
I read this forum for some time, but only registered yesterday, so I’m not able to upload the .dyn file.

The image still isn’t legible. What does the image export do when you click it?

If you want to filter elements without levels or a bounding box (although I don’t think the latter exists) you would just look for values equal to null or empty and then filter with FilterByBoolMask.

I click the image export, see the two options from the picklist, click the one with workspace, and then nothing happens.

I got the 3D views to work, the problem was that empty lists persisted through the Isnull, FilterByBoolMask, and ListIsEmpty nodes, had to flatten the list after the filters.

The last problem I face, is that I can’t adjust the view ranges of the 2D views, seems like the script I grabbed doesn’t support list inputs for view range offsets. Do you have any other idea for generating views where the certain element is visible?

Good morning, you can go through the menu bar for your image exports
Cordially
christian.stan

Again, we can’t really follow your graph and therefore the underlying issue if we can’t see it.

The export worked on an other PC.
Posting the graph, having a problem with the Python Script, and also the circles are misplaced most of the time:

import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import*
clr.AddReference(‘RevitServices’)
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

def modViewrange(vp,tof,bof,cof,dof):
v = UnwrapElement(vp)
viewrange = v.GetViewRange()
asslvl = v.GenLevel
viewrange.SetLevelId(PlanViewPlane.TopClipPlane,asslvl.Id)
viewrange.SetOffset(PlanViewPlane.TopClipPlane,tof)
viewrange.SetLevelId(PlanViewPlane.BottomClipPlane,asslvl.Id)
viewrange.SetOffset(PlanViewPlane.BottomClipPlane,bof)
viewrange.SetOffset(PlanViewPlane.CutPlane,cof)
viewrange.SetLevelId(PlanViewPlane.ViewDepthPlane,asslvl.Id)
if bof < dof:
viewrange.SetOffset(PlanViewPlane.ViewDepthPlane,bof)
else:
viewrange.SetOffset(PlanViewPlane.ViewDepthPlane,dof)
#Applying the viewrange to the view
v.SetViewRange(viewrange)

doc = DocumentManager.Instance.CurrentDBDocument
count = 0

TransactionManager.Instance.EnsureInTransaction(doc)
if isinstance(IN[0],list) and isinstance(IN[1],list):
for vp,tof,bof,cof,dof in zip(IN[0],IN[1],IN[2],IN[3],IN[4]):
modViewrange(vp,tof,bof,cof,dof)
count += 1
elif isinstance(IN[0],list) and isinstance(IN[1],list) == False:
for vp in IN[0]:
modViewrange(vp,IN[1],IN[2],IN[3],IN[4])
count += 1
else:
modViewrange(IN[0],IN[1],IN[2],IN[3],IN[4])
count += 1
TransactionManager.Instance.TransactionTaskDone()

OUT = ‘%d view ranges altered’ %(count)

Would greatly appreciate your input.

Great. Can you take the screenshot again with the node preview bubbles pinned so we can see the data though? Otherwise it’s nearly impossible to determine what’s going on. Also, make sure you post python code using preformatted text.
image

Thank you for walking me through it.

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

def modViewrange(vp,tof,bof,cof,dof):
	v = UnwrapElement(vp)
	viewrange = v.GetViewRange()
	asslvl = v.GenLevel
	viewrange.SetLevelId(PlanViewPlane.TopClipPlane,asslvl.Id)
	viewrange.SetOffset(PlanViewPlane.TopClipPlane,tof)
	viewrange.SetLevelId(PlanViewPlane.BottomClipPlane,asslvl.Id)
	viewrange.SetOffset(PlanViewPlane.BottomClipPlane,bof)
	viewrange.SetOffset(PlanViewPlane.CutPlane,cof)
	viewrange.SetLevelId(PlanViewPlane.ViewDepthPlane,asslvl.Id)
	if bof < dof:
		viewrange.SetOffset(PlanViewPlane.ViewDepthPlane,bof)
	else:
		viewrange.SetOffset(PlanViewPlane.ViewDepthPlane,dof)
	#Applying the viewrange to the view
	v.SetViewRange(viewrange)

doc = DocumentManager.Instance.CurrentDBDocument
count = 0

TransactionManager.Instance.EnsureInTransaction(doc)
if isinstance(IN[0],list) and isinstance(IN[1],list):
	for vp,tof,bof,cof,dof in zip(IN[0],IN[1],IN[2],IN[3],IN[4]):
		modViewrange(vp,tof,bof,cof,dof)
		count += 1
elif isinstance(IN[0],list) and isinstance(IN[1],list) == False:
	for vp in IN[0]:
		modViewrange(vp,IN[1],IN[2],IN[3],IN[4])
		count += 1
else:
	modViewrange(IN[0],IN[1],IN[2],IN[3],IN[4])
	count += 1
TransactionManager.Instance.TransactionTaskDone()

OUT = '%d view ranges altered' %(count)

1 Like

Just from a brief scanning, there are multiple times where you filter values based on nulls or empties, but don’t filter out the elements that had those missing values. This leaves you with mismatched lists as well as elements that are probably going to cause you trouble later. Start by fixing those issues - always check and see that your inputs match in length when you expect them to - and try to cleanup the node layout a bit if you can. I know there’s a lot going on, but it gets pretty messy in the middle and it’s hard to follow.

It was indeed countless instances of list handling problems. I separated the 3D and 2D view generation, and started to check for list count mismatches, and I got it to work.
Thank you for the help.