Tool.placeviewsonsheets in Dynamo 2.3

Hi, I’m upgrading scripts for 2020 Revit with dynamo 2.3. tool.placeviewsonsheets is not placing all the views in the list. Just the first one. Where as in 1.3 it will place all. Any ides? :slight_smile:


#python nodes in dynamo 1.2
#proposed by Julien Benoit @jbenoit44 
#http://aecuandme.wordpress.com/
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

sheets = []
for i in IN[0]:
	sheets.append(UnwrapElement(i))
views=[]	
for i in IN[1]:
	views.append(UnwrapElement(i))
points=[]	
for i in IN[2]:
	points.append(UnwrapElement(i).ToXyz())

# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
viewp=[]
for s,v,p in zip(sheets,views,points):
	a=Viewport.Create(doc, s.Id,v.Id, p)
	viewp.append(a)

# End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT=viewp

well, the node has a type var[]..[] which means it will not replicate over a list of inputs, it just passes inputs straight through and executes only once, but the python only iterates over a single level of input and you are passing a nested list, try flattening the inputs first.

If I flatten the list, then it wont put the right views on the right sheets?

Hi @Kulkul, would you be kind enough to help with this? I remember you helped me out understanding the levels with views to sheets :slight_smile:

Hi @vanman

Sure!

Try the below example. You need to maintain same list structure for all the inputs:

Or this by using List.Combine:

1 Like

Thanks @Kulkul , I got the results below, not sure if I misunderstood something.

In my original post. The setout I have works for dynamo 1.3 but dosnt for 2.3

Anyone have any other ideas for this? :slight_smile: Its important to be able to put multiple views on one sheet when its being duplicated as it did in dynamo 1.3. I think maybe something in the python code handles different in Dynamo 2.xx to dynamo 1.3 with Tool.PlaceViewsOnSheets

@Kulkul

Just to show, This is it working in dynamo 1.3

Is there a possible way of chopping up the sheets to match views with the correct list structure to maybe get it to work in dynamo 2.3?

Can I install dynamo 1.3 to Revit 2020? Dosnt look like it after researching :confused:

I brought in the 1.3 node to 2.2 but now the Tool.CreateEmptySheet is not working :confused:

omg so copying 1.3 node version into 2.2 seemed to work. Just had to get the lacing correct with stuff. phew

1 Like

Sorry for the basic question, but how did you copied? I am having trouble with the tool.placeviewsonexistingsheets. The node keeps giving me a NULL output

If you can share a dyn file with this node, maybe that would help.
Thank you

just copied from 1.3 to 2.2 package folder. dyn below. Send a screen shot of your graph to help

1.3 below
Tool.PlaceViewsOnSheets.dyf (6.4 KB)

Tool.PlaceViewsOnExistingSheets.dyf (4.6 KB)

2 Likes

@vanman , Thank you very much! By any chance, do you know what is wrong with this input?
It says " …the input variable should be a valid variable…"

Thank you for your time!

What does the message say above the erroring node? I dont actually use Tool.PlaceViewsOnExistingSheets in my graph. Tool.PlaceViewsOnSheets works with 2.X

Thank you so much dude! I was trying to do something very similar and was plying around with it for a while before I found this post and all my issues have been solved!