launch addin from dynamo
import clr
import System
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
uiapp = DocumentManager.Instance.CurrentUIApplication
clr.AddReference('PresentationCore')
clr.AddReference('AdWindows')
import Autodesk.Windows as adWin
def findCommandIdByName(txtPanel, txtItemRibbon):
ribbon = adWin.ComponentManager.Ribbon
for tab in ribbon.Tabs:
for panel in tab.Panels:
for ribbonItem in panel.Source.Items:
if ribbonItem.Text is not None:
if txtItemRibbon == ribbonItem.Text and txtPanel in ribbonItem.Id:
return ribbonItem.Id
name_addin_button = findCommandIdByName(IN[0],IN[1])
if name_addin_button is not None:
id_addin_button = RevitCommandId.LookupCommandId(name_addin_button )
uiapp.PostCommand(id_addin_button)
OUT = name_addin_button