'FamilyInstance' object has no attribute 'Parameters' on CPython3

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

it’s strange :flushed:, it looks like PythonNet doesn’t always manage to go up the inheritance tree (methods and properties)
this is the 2nd time I see this problem

Hi @CarlosCMB

I don’t see the same error for me in CPython3 :thinking:

Possible to share relevant rvt and dyn file?

1 Like

@CarlosCMB
What’s your config?

  • Windows version?
  • Revit version?,
  • Dynamo version?
  • run on Virtual machine?

Feels like the imports not being setup is impacting this…

Edit: Curious what options are exposed via dir(elem) both with and without the imports; somehow it feels like the answer will be in that set.

1 Like