Dear All,
I am trying to get vertices of a bunch of wires.but getting an error which says
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 55, in
TypeError: ‘Func[object, object]’ object is not subscriptable…
Any help?
import clr
import sys
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference('DSCoreNodes')
from DSCore.List import Flatten
from Autodesk.Revit.DB.Electrical import*
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import System
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
import collections
from itertools import combinations
from itertools import product
WireList = UnwrapElement[IN[0]]
VertexList = []
for W in WireList:
vertexpoints = []
vertexpoints = W.GetVertex()
VertexList.append(vertexpoints)
OUT = VertexList
Im not if this is the error, but for the UnwrapElement function you should use parentheses not square brackets.
This could cause an error?
When troubleshooting code try to go through each step at a time and set the OUT value first to 'Wirelist". If this goes through fine, you can keep going through each variable you define, to see if you get the expected result.
1 Like