2

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

darkhitect
  • 55
  • 1
  • 6

1 Answers1

2

@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?

Daren Thomas
  • 67,947
  • 40
  • 154
  • 200
  • 1
    Man, I am loving RPS! Thank you for the answer @Daren Thomas. ![link](https://imgur.com/KcpihwI) – darkhitect Aug 26 '19 at 12:33
  • Is it possible to use DeployRPSAddin mechanism to add new Ribbon Tab? – darkhitect Aug 26 '19 at 18:30
  • 1
    @darkhitect Tell me about it - RPS is industry changing stuff! Yes Ribbon Tabs and Ribbon Panels (and tool tips!) are all possible - but as far as I know its only possible if you use a startup script. pyRevit seems to have a clever way of deploying on-the-fly though, would be worth investigating how they do it. – Callum Aug 26 '19 at 21:41
  • Well this works perfect to me as well. It is important that I can create a DLL without RPS or pyRevit and send whole bundle or even installer to my colleagues. This is for internal use, bur it looks nice and bit tidier like this. I managed to create new Ribbon with XML file by using DeployRPS and with split buttons I have all I need. ToolTips and long descriptions would be handy as well, but I would opt to go without them if this is only option for stand alone app. I tryed variation of toolTip, tooltip and ToolTip as an attribute in existing tag, but I expect it is not working. – darkhitect Aug 27 '19 at 04:40
  • 1
    The DeployRPS functionality creates a DLL that you can deploy, but you'll need to add the runtime (RpsRuntime.dll) as well when deploying. And yes, then you can create an installer and ship it. Have a look at the [HelloWorld example](https://github.com/architecture-building-systems/revitpythonshell/tree/master/RevitPythonShell/Examples), which includes an InnoSetup installer script that creates just that. Of course, you'll have to add all your bells and whistles and awesomeness, but as a starting point it should help! – Daren Thomas Aug 28 '19 at 08:39