Hello Dynamaniacs!
I’m migrating my Scripts from IronPython2 to CPython3 and I have this problem:
The following code works perfectly on IronPython2, but it throws this error when I run it under CPython 3
AttributeError : ‘FamilyInstance’ object has no attribute ‘Parameters’ [’ File “”, line 30, in \n’]
Does anybody have an Idea, what the solution could be?
import clr
clr.AddReference("ProtoGeometry")
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
roomgroups = UnwrapElement(IN[1])
tops = UnwrapElement(IN[2])
niches = IN[0]
output = []
tosum = []
TransactionManager.Instance.EnsureInTransaction(doc)
for ix, roomgroup in enumerate(roomgroups):
top_pars = tops[ix].Parameters
for ix2, room in enumerate(roomgroup):
area = room.LookupParameter("Fläche").AsDouble()
topo_name = room.LookupParameter("Topo_RaumName").AsString()
if topo_name != "Balkon" \
or topo_name != "Garten" \
or topo_name != "Loggia" \
or topo_name != "Terrasse":
tosum.append(area)
for par in top_pars:
try:
if topo_name in par.Definition.Name:
par.Set(area)
except:
pass
par_area = tops[ix].LookupParameter("FP_Top_Fläche")
par_area.Set(sum(tosum))
tosum = []
TransactionManager.Instance.TransactionTaskDone()
OUT = output