Revit 2010 API "Add Hello World Ribbon Panel"

Revit 2010 API "Add Hello World Ribbon Panel"

jlucero
Contributor Contributor
1,365 Views
4 Replies
Message 1 of 5

Revit 2010 API "Add Hello World Ribbon Panel"

jlucero
Contributor
Contributor
Has anyone had trouble with the "2.3 Walkthrough: Add Hello World Ribbon Panel" working? I am trying to do it with MS Visual C# Express Edition. I had no trouble with the Hello World program. The errors I am getting with this one are:

Error 1 Cannot implicitly convert type 'Autodesk.Revit.PushButton' to 'Autodesk.Revit.PulldownButton' CsAddPanel.cs 17 41 AddPanel

Error 2 The type or namespace name 'BitmapImage' could not be found (are you missing a using directive or an assembly reference?) CsAddPanel.cs 22 13 AddPanel

Error 3 The type or namespace name 'BitmapImage' could not be found (are you missing a using directive or an assembly reference?) CsAddPanel.cs 22 42 AddPanel


In the walkthrough sample within the PDF, it shows "BitmapImage" as being recognized by the compiler. It's not in the Express Edition. My guess is I am missing a reference?

I have as references RevitAPI, PresentationCore, System.Windows.Forms and WindowsBase. What am I missing here?
0 Likes
1,366 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable


For Error 1 Cannot implicitly convert .....
Please check your line that says
PushButton pushButton = ribbonPanel.{color:#0000ff}AddPushButton{color}("HelloWorld",.....); //Line 17 in csAddPanel.cs
Make sure that the words in Blue are AddPushButton in your file and {color:#ff0000}NOT AddPullDownButton{color}("....... "); //This can happen occassionally.

For Error 2 and 3 ... You are right ! You are missing a reference.
Add a reference to "System.Drawing" and you should be ok.

Hope that helps !
Prashant

Edited by: ppathak on Sep 17, 2009 6:01 PM
0 Likes
Message 3 of 5

jlucero
Contributor
Contributor
Thanks ppathak!
I was able to find out the missing references. I opened one of the samples that uses the "BitmapImage" and used the same one the sample uses. That worked.

As far as the:

Error 1 Cannot implicitly convert type 'Autodesk.Revit.PushButton' to 'Autodesk.Revit.PulldownButton' CsAddPanel.cs 24 41 AddPanel

I still need to figure it out. I'll look into what you wrote in your reply and double check my code.

Thanks again.
0 Likes
Message 4 of 5

jlucero
Contributor
Contributor
You were right ppathak.

I had:

PullDownButton pushButton = ribbonPanel.AddPushButton

instead of

PushButton pushButton = ribbonPanel.AddPushButton

Thanks!
0 Likes
Message 5 of 5

Anonymous
Not applicable

Please guide me to create Helloworl.addin With Revit 2014 and Visual studio 2010 C#

Thank all

0 Likes