Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How I know which namespace and references should be used.

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
Anonymous
603 Views, 11 Replies

How I know which namespace and references should be used.

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"));
}
}

 

 

11 REPLIES 11
Message 2 of 12
jeremytammik
in reply to: Anonymous

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



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 12
Anonymous
in reply to: jeremytammik

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?

 

Revit Addin.png

Message 4 of 12
IbrahimNaeem
in reply to: Anonymous

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 

Message 5 of 12
Anonymous
in reply to: IbrahimNaeem

Thanks Hema_Cima, How can I modify the Revit2015 Addin, so next time do not need do it again.

 

Cheers,

 

Shan

Message 6 of 12
mwilson1
in reply to: Anonymous

Make the changes then select File -> Export Template... 

Message 7 of 12
Anonymous
in reply to: jeremytammik

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

Revit Addin1.png

Message 8 of 12
Anonymous
in reply to: Anonymous

I have also looked at the RevitAPI.chm file, found the AddPushButton is under the Revit.UI.  And why it does not exist?

 

RevitAPI.png

Message 9 of 12
mwilson1
in reply to: Anonymous

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.

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/Revit-API/files/GUID-...

Message 10 of 12
Anonymous
in reply to: mwilson1

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:

  • Hello.HelloButton
  • Hello.HelloOne
  • Hello.HelloTwo
  • Hello.HelloThree
  • Hello.HelloA
  • Hello.HelloB
  • Hello.HelloC
  • Hello.HelloRed
  • Hello.HelloBlue
  • Hello.HelloGreen

And then go through the following steps?

Message 11 of 12
stever66
in reply to: Anonymous

There is a typo:

 

Ribbonpanel panel = a.CreateRibbonPanel...

 

should be

 

Ribbonpanel panel = app.CreateRibbonPanel....

Message 12 of 12
IbrahimNaeem
in reply to: Anonymous

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.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community