Viewport Center in Modelspace (View Target)

I am trying to scale and move the modelspace target location on already created viewports in multiple layouts. I used the AutoCAD API viewport class properties. I don’t get any errors when using these to edit viewports, however the locked and scale function work but the viewports aren’t being moved. I have attached my python code.

# Load the Python Standard and DesignScript Libraries
import sys
import clr

# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')

# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

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

viewports = IN[0]
scale = IN[1]
centerpoints = IN[2]
locked = IN[3]
if locked == None:
    bool = True
else:
    bool = locked
out = []
adoc = Application.DocumentManager.MdiActiveDocument
ed = adoc.Editor
if len(viewports) != len(centerpoints):
    out = "WARNING: Viewports and Centerpoints do not match length"
else:
    for i, viewport in enumerate(viewports):
        vp = viewport.InternalDBObject
        vp.UpgradeOpen()
        cntr = centerpoints[i]
        pt = Point3d(cntr.X,cntr.Y,0)
        """
        midpoint = vp.CenterPoint
        midPnt = Point2d(midpoint.X,midpoint.Y)
        ed.SwitchToModelSpace()
        view = ViewTableRecord()
        view.IsPaperspaceView = True
        view.CenterPoint = midPnt
        ed.SetCurrentView(view)
        ed.SwitchToPaperSpace()
        """
        vp.CustomScale = scale
        vp.ViewTarget = pt
        vp.Locked = bool
        vp.On = True
        out.append(vp)

# Assign your output to the OUT variable.
OUT = out

You will need to lock the adoc and make the changes inside a transaction
I don’t currently have access to my workstation with C3D, however if you start with the standard python code the information is there