Launch ADDIN using Dynamo

Hi All
Can we Launch an addin or a plugin application using dynamo ?
on previous searches i finded to launch using Postable command id is there any other way ? how to find the Command ids of the application buttons?
Thanks in Advance

You can experiment by finding the .dll file that comes with the plugin and load it by choosing load library.
Make sure you setup a test project so no actual projects can get messed up.
Don’t count on anything except messing things up.

1 Like

I Tried it Marcel it gave a new study but what i actually trying is to run the addin in revit using dynamo not addin in dynamo

Hey,

I think you should be able to, if Revit can call it, Dynamo should be able to also.

I would test using a Python node, import the relevant dll and wrap it in a transaction… Just you would when using the DS libraries (which are also a Revit addin?)

Let us know how you get on!

Cheers,

Mark

Edit:

Something like…

clr.AddReference("ProtoGeometry")
from Autodesk.DesignScript import Geometry as geom

TransactionManager.Instance.EnsureInTransaction(doc)
#Do Stuff
TransactionManager.Instance.TransactionTaskDone()

Here is how to an external library, BiMorph:

1 Like

Using the LoadAddIn Method seems to be the direction you will need to go, though unsure if it will/wont work in dynamo.

1 Like

Hello
another solution to find Command id by Panel and Button Name

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
9 Likes

Hello Cyril,

can you use that script to launch a Revit Add-In? For example Roombook?
Can you launch that command and then apply with ok?

Hello @Deniz_Maral
I think no, you will probably need to use the User32 API for the ‘Calculate’ button

1 Like

Thank you for quick response @c.poupin !

How can you find the command Id of that button to apply via PostCommand? Or you mean something without PostCommand?
or maybe this way?

There is also here something but I don’t get it well how to find ID of that command.

Hello, try to find the ID like the example here (find the ribbon item by name and return its ID)

1 Like

Yes, I can find Id but it is id of ribbon. Let’s take you example.
How could you find the CommandId of “Export” button down below in window in your add-in to finalize process?
In my example: I can find Calculate Areas but I can’t find “Calculate” command :slight_smile:

I think this needs a wider discussion on the revit api forum for if you can interact with the running of another addin from a addin including any windows/forms that have interaction.

DynamoForRevit is a revit extension and has the same limitations as a extension would have.

You are right but you can also use external tools inside of it.

There is here an artical how you can use windows API to do some stuff. @c.poupin has already said that, I should use user32.dll. I am not good at .NET or Windows API :slight_smile: