Search code examples
c#revit-apirevitrevitpythonshell

Revit ribbonpanel pushbutton with Bitmap Image without RevitPythonShell or C# (ironpython only)?


I am an architect (real one, not software architect :) ) experimenting a bit with Revit API and introducing myself into coding world. I have done a part with C# but switched to Python with hope that initial steps will go faster this way. To get back to the point, I have created an app and deployed a DLL with RevitPythonShell. I have created a pushbutton inside ribbonpanel but would like to create Bitmap Image so it looks nice. Is there any way to add Bitmap Image to an app so I can use it on Revit instance without RPS being installed?

Previously I created same app using C# and it goes smoothly. But using Python, there is an issue. When you create a control on a Revit Ribbon panel, you need to pass in the path to a DLL and the fully qualified name (including namespaces) of a class inside that DLL that implements IExternalCommand. However, when using Python, this is not possible, at least I dont know how to do it.

Daren Thomas has a nice instruction while using RPS as a Stratup Script (https://github.com/daren-thomas/scripting-autodesk-revit-with-revitpythonshell/blob/master/more_control_over_the_ribbonpanel.md) but is there any way to avoid this, just to deploy new script or "translate" class name of PushButtonData Constructor of Revit API?

This image shows what I would like to achieve. It show my C# vs Python app.

example


Solution

  • @darkhitect - how are you using python to deploy your scripts? If you're using the DeployRpsAddin mechanism of RevitPythonShell, you should be able to use the largeImage and smallImage attributes in the <PushButton text="Hello World! " src="helloworld.py "/> tag. Set them to the paths to the image and you should be good to go?