Viewport.SetBoxCenter not working Dynamo 2.1

I made the change from 1.3 to dynamo 2.1… got most scripts working again, but my script with
viewport.setboxcenter is not doing what it needs to do anymore…

Some further investigation, this is the script inside the node;

#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

vport = []
for i in IN[0]:
vport.append(UnwrapElement(i))
pts=[]
for i in IN[1]:
pts.append(UnwrapElement(i).ToXyz())

# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

for v,p in zip(vport,pts):
	v.SetBoxCenter(p)
		
doc.Regenerate()
# End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT=IN[0]

this is the error i am getting;
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 35, in
AttributeError: ‘Viewport’ object has no attribute ‘ToXyz’;

Try switch the inputs, viewports to “Points”, your points to “Viewport List”. Also, I guess the output from your previous node are already XYZ, the last node expects Dynamo Point object and it convert them to XYZ object but I suppose there’s not much influence if XYZ gets converted to XYZ one more time.

tried the switch already…doesn’t work


in the node itself it is the other way around… the 0 and 1 input caught my eye as well already

also tried to remove the ToXyz, doesn’t work either
error i am getting then is;
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
expected an indented block

vport = []
for i in IN[0]:
     vport.append(UnwrapElement(i))
pts=[]
for i in IN[1]:
     pts.append(UnwrapElement(i).ToXyz())

Try indent then.

that is the original code right… or am i missing something… original code gave an error

Strange :thinking:, can’t find any other reasons.