I have a smart button that toggles a custom view mode (this is my first attempt at a smartbutton). It is working fine on my machine, but when I deploy it to others, they get this error when opening revit:
ERROR [pyrevit.loader.uimaker] Smart button script import error: <type_id ‘.smartbutton’ name ‘My Tool Name’ @ path\to\my\tool.smartbutton> | ‘NoneType’ object has no attribute 'ActiveView
i copied the self.init function from the override 2D elements function built into pyrevit:
doc = revit.doc
activeView = doc.ActiveView
def __selfinit__(script_cmp, ui_button_cmp, __rvt__):
off_icon = script_cmp.get_bundle_file('off.png')
ui_button_cmp.set_icon(off_icon)
It seems to me that it’s trying to get the active view before a document is actually open. The odd thing is that it’s inconsistent. It works on some machines, but not others.
any ideas why this would be happening?