0

I'm not sure what I'm doing wrong. My code is

# -*- coding: utf-8 -*-
from rpw import revit, db, ui, DB, UI
import clr

# Import RevitAPI
clr.AddReference("RevitAPI")

dd1 = db.Collector(of_category='Data Devices') 

for d in dd1:
    o=db.Element(d)
    print ("Value of comments parameter = ", o.parameters['Comments'].value)

my error message is:

File "C:\Program Files\pyRevit-Master\pyrevitlib\rpw\db\parameter.py", line 70, in __getitem__
rpw.exceptions.RpwParameterNotFound: parameter not found [element:2367981]:[param_name:Comments]

however I know this parameter is part of every data device element.

user3808752
  • 169
  • 4
  • 14
  • I think the issue is with my collector statement, if I print dd1 I get: – user3808752 Jan 23 '19 at 12:53
  • so it looks like the statement `dd1 = db.Collector(of_category='Data Devices')` is collecting data devices that are instances in the revit model AND instances in FamilyTypes collection? – user3808752 Jan 23 '19 at 13:28

1 Answers1

0

I modified the line dd1 = db.Collector(of_category='Data Devices')to read dd1 = rpw.db.Collector(of_category='Data Devices', of_class='FamilyInstance') and that resolved the issue.

user3808752
  • 169
  • 4
  • 14