我正在尝试在我的 Iron python 插件上使用 revit api 事件(使用 pyRevit 添加功能区和按钮),但我真的不明白该怎么做。
我找到了这段代码,但我无法让它工作。对于初学者,我想在每次激活视图时打印“视图已激活”
https://github.com/eirannejad/pyRevit/issues/201
from System import EventHandler, Uri
from Autodesk.Revit.UI.Events import ViewActivatedEventArgs, ViewActivatingEventArgs
def event_handler_function(sender, args):
# do the even stuff here
# I'm using ViewActivating event here as example.
# The handler function will be executed every time a Revit view is activated:
__revit__.ViewActivating += EventHandler[ViewActivatingEventArgs](event_handler_function)
谢谢,