Displace Elements - Exploded View for Parts

Hello,

I’m trying to adapt a script that will displace elements in a 3D view, the original was working with Roofs:

Create Displace Element

I think I’m close but I’m getting an error in the python code

import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference("DSCoreNodes")
import DSCore
from DSCore import *

# Place your code below this line

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument


elements = UnwrapElement(IN[0])
vetor = UnwrapElement(IN[1])
vista = UnwrapElement(IN[2])

listaids = []

for i in elements:
        listaids.append(i.Id)

TransactionManager.Instance.EnsureInTransaction(doc)

icollection = List[ElementId](listaids)

dispElem = DisplacementElement.Create(doc, icollection, XYZ(vetor.X/30.48,vetor.Y/30.48,vetor.Z/30.48), vista, None);

TransactionManager.Instance.TransactionTaskDone()

OUT = dispElem''


Thanks