Results 1 to 3 of 3

Thread: cant display a menu as external application

  1. #1
    Member
    Join Date
    2009-03
    Posts
    2
    Login to Give a bone
    0

    Default cant display a menu as external application

    i cant display a new menu in revit via API im following the walktrough 2 in the revit api developer guide, I modified the revit.ini file like the example that comes and also the code but i cant display it i dont know the reason,

    i atach the revit.ini file modification.

    Code:
    [ExternalApplications]
    EACount = 1 
    EAClassName1 = AddMenu.CsAddMenu 
    EAAssembly1 = C:\Users\Workstation1\Documents\Visual Studio 2008\Projects\AddMenu\AddMenu\bin\Debug\AddMenu.dll
    
    and the code in c#:
    
    
    using System; 
    using System.Windows.Forms; 
    using Autodesk.Revit; 
    
    
    public class CsAddMenu: IExternalApplication 
    { 
    public IExternalApplication.Result OnShutdown(ControlledApplication application)
    { 
    return IExternalApplication.Result.Succeeded; 
    } 
    public IExternalApplication.Result OnStartup(ControlledApplication application) 
    { 
    Autodesk.Revit.MenuItem menuItem = application.CreateTopMenu("NewMenuItem");
    //Create a menu iterm in the top menu “NewMenuItem”, click it,
    //the add-in application “HelloWorld” will be triggered. 
    menuItem.Append(Autodesk.Revit.MenuItem.MenuType.BasicMenu, "HelloWorld",
    @"C:\Users\Workstation1\Documents\Visual Studio 2008 @\Projects\HelloWorld\HelloWorld\bin\Debug\HelloWorld.dll ", "HelloWorld.CsHelloWorld "); 
    return IExternalApplication.Result.Succeeded; 
    } 
    }
    i built the HelloWorld.dll lib and the AddMenu.dll file but i cant display the new menu so i think the problem is in the .ini file but i dont know i will thank any help!
    Last edited by RobertB; 2009-03-11 at 08:41 PM. Reason: added code tags

  2. #2
    100 Club
    Join Date
    2007-10
    Location
    Brisbane
    Posts
    138
    Login to Give a bone
    0

    Default Re: cant display a menu as external application

    not sure if it matters but only things I noticed in a quick look is:
    - spaces in the ini file, try removing the spaces around the equals
    - spaces in the Append() function, try removing spaces in the last 2 string parameters
    - @ symbol at end of visual studio 2008 @\ - whats that all about? (your @at the start of the string should be sufficient)

    other than that dont see why it wont work.

    Keep in mind, at the end of hte month revit 2010 should be out, and all this menu code is replaced by the new ribbon interface and the new API calls for that.

  3. #3
    Member
    Join Date
    2008-01
    Posts
    3
    Login to Give a bone
    0

    Default Re: cant display a menu as external application

    Place quotes around your file path... There are spaces in "Visual Studio 2008"
    Also try removing the spaces on either sides of your "=" marks...


    *********************************

    [ExternalApplications]
    EACount=1
    EAClassName1=AddMenu.CsAddMenu
    EAAssembly1="C:\Users\Workstation1\Documents\Visual Studio 2008\Projects\AddMenu\AddMenu\bin\Debug\AddMenu.dll"

Similar Threads

  1. Revit can't run the external application
    By oakam430373 in forum Revit Architecture - General
    Replies: 2
    Last Post: 2014-10-21, 08:25 PM
  2. External application - open Document
    By kv in forum Revit - API
    Replies: 1
    Last Post: 2010-11-02, 08:05 PM
  3. 2010 Application Menu
    By toddwun in forum Revit Architecture - General
    Replies: 2
    Last Post: 2009-04-23, 03:52 PM
  4. External Tools sub menu items always disabled
    By stephenhamil in forum Dot Net API
    Replies: 1
    Last Post: 2009-02-03, 03:54 PM
  5. Edit MText when using an external application
    By ruthellenwilliams in forum AutoCAD General
    Replies: 1
    Last Post: 2006-03-07, 06:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •