Hi,
I am learner for Revit API. I am current practice the samples from the Revit help. But there are always some errors I could not fix it. I believe it may be caused by less namespaces and references, but I don't know which namespaces and references should be used.
Thanks
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Windows.Media.Imaging;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace ContextualHelp
{
private void AddPushButton(RibbonPanel panel)
{
PushButton pushButton = panel.AddItem(new PushButtonData("HelloWorld",
"HelloWorld", @"D:\Sample\HelloWorld\bin\Debug\HelloWorld.dll", "HelloWorld.CsHelloWorld")) as PushButton;
// Set ToolTip and contextual help
pushButton.ToolTip = "Say Hello World";
ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.Url,
"http://www.autodesk.com");
pushButton.SetContextualHelp(contextHelp);
// Set the large image shown on button
pushButton.LargeImage =
new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\39-Globe_32x32.png"));
}
}
Solved! Go to Solution.
Solved by IbrahimNaeem. Go to Solution.
Solved by jeremytammik. Go to Solution.
I suggest you work through the getting started material first of all:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#2
That will acquaint you with all you need.
Cheers,
Jeremy
Thanks Jeremy,
I will go through and learn from it.
I have downloaded the Revit2015 Addin template, but it is different with the one shown from video. Should I do something to match with the video one?
Yes, you need to write click on references and select add reference, a dialogue will appear. write in the search what's missing and when appears activate the small checkbox beside it and then click ok, by this you add .Net namespaces from Visual Studio Library. Also be cautious if your Revit is installed anywhere else rather the "c" drive.
Thanks, Ibrahim Naeem
Thanks Hema_Cima, How can I modify the Revit2015 Addin, so next time do not need do it again.
Cheers,
Shan
Hi Jeremy,
I have go through the link which you gave to me and practiced. I have used the template for the above project, the errors are still there.
I don't know what's wrong with that?
Many thanks.
Shan
I have also looked at the RevitAPI.chm file, found the AddPushButton is under the Revit.UI. And why it does not exist?
In the picture of the help file you linked AddPushButton is a method of PulldownButton, so you need to tell the program which pulldown button you want to add a push button too. It's not a stand alone command.
There is a tutorial here to get you started on the ribbon, complete with working code. See if you can get this working and then branch out from there.
Thanks mwilson, I have went through the Add Hello World Ribbon Panel(which was successfully) and trying to workthrough the Ribbon Panels and Controls
http://help.autodesk.com/view/RVT/2015/ENU/?guid=GUID-1547E521-59BD-4819-A989-F5A238B9F2B3
Should I create a Hello class first, like the Add Hello World Ribbon Panel, which contains the External Command Types:
And then go through the following steps?
There is a typo:
Ribbonpanel panel = a.CreateRibbonPanel...
should be
Ribbonpanel panel = app.CreateRibbonPanel....
you have better go through the Revit API Guide , it's shared by the building Coder www.thebuildingcoder.com , you've better go there and search for the guide
Thanks, Ibrahim Naeem
Can't find what you're looking for? Ask the community or share your knowledge.