Kean Walmsley

July 2009

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Twitter Updates

    follow me on Twitter



    « Extracting XML data from drawings using a new .NET API in AutoCAD 2009 | Main | API overhaul for Autodesk Design Review »

    April 09, 2008

    TrackBack

    TrackBack URL for this entry:
    http://www.typepad.com/services/trackback/6a00d83452464869e200e551cc25cc8834

    Listed below are links to weblogs that reference The New RibbonBar API in AutoCAD 2009:

    Comments

    An Excellent in-sight to the API's of AutoCAD. Keep up the good blogging Kean!

    (Through the Interface is the #1 Site for AutoCAD API!!!)

    Hi Kean, a useful insight as always!!
    I've been experimenting with the XAML interface and I was wondering what you thought of the posts) here: -

    http://tinyurl.com/3hyt37 (a post from the Autodesk discussion forums)

    In particular I wanted your opinion on whether it would be possible to implement (as Colin French in the above post suggests) a gallery of Dimension styles that, on "mouse-over" updates the current view, and how useful you think this might prove?

    I don't see a way of safely doing "preview" modifications of styles without some replumbing work (i.e. not through an external API, which would actually effect the modification, not just preview it).

    Kean

    I guess it'll just have to go on my wish list for a future version then. :)

    Incidentally, do you happen to have any links/documentation about what exactly the Extended Tooltips can show/limitations on size etc? - the documentation provided with 2009 is sketchy at best. I've downloaded the objectarx samples but they are pretty sparse as far as useable information goes.

    I haven't, I'm afraid: I haven't yet spent much time with this API, either - this post was provided by a member of my team, so I really only provided editing services. :-)

    Kean

    Ok, not to worry then.

    Hi Kean:
    I see that there is a ribboncombobox but I can not seem to get it to work.

    this works:
    RibbonComboBox cmb1 = new RibbonComboBox;

    this causes an error:
    row1.Items.Add(cmb1);

    Hi Trevor,

    Sorry - I didn't write this article, and am not familiar with the code. I suggest posting your question to the ADN website, if you're a member, or to the AutoCAD .NET Discussion Group, if not.

    Regards,

    Kean

    Hello,

    thank you for all these usefull informations (and not only this article :) )

    I use Ribbon, in an application, thanks to AdWindows.dll, acRibbon.dll (and also acdbmgb.dll and acmdg.dll)

    I tried to make my app runs on Autocad 2010 and I saw that there is no ribbon dll anymore ?

    Do you know a way to make an application using Ribbon, working on both 2009 and 2010 ?

    Hi Willhelm,

    I'm pretty sure the functionality in AcRibbon.dll has been combined into AdWindows.dll (or perhaps AcWindows.dll).

    You will also need to migrate your code, as there are differences in the way AutoCAD 2010's ribbon has been implemented. More on that in an upcoming post (the information provided via ADN will be able to help in the meantime, if you're a member).

    Regards,

    Kean

    Hi,

    thank you for your help.
    I succed making my application compile, using adWindows.dll and acWindows.dll

    I had to change RibbonRow to RibbonRowPanel.
    The only thing I can't do (for the moment^^) is Clicking on a RibbonButton. They removed the "Click" event.

    Thank again

    Regards,

    Wilhelm

    Hello Kean,
    I applied the first method in your article. Everything works fine, but I can't figure out how to open the custom ribbon tab at the start of autocad 2009. I can open the tab when I manually run the command. I applied the IExtension application and Initialize() function, imported ads_queueexpr, and have this line in Initialize function: ads_queueexpr("(command \"Ribbon\")") before I run the function to create the tab. But it seems Ribbon can't be edited before autocad starts fully. Is there a solution to this? Thnaks.

    I'm afraid I don't know the answer to this: this post was for AutoCAD 2009 and was provided by a guest author.

    In AutoCAD 2010 I know you can use the CUIX API to have your custom ribbon tab loaded on startup - perhaps someone on the discussion groups knows how to do this for 2009.

    Kean

    Hello Kean,
    do you have in plan to write an article about AutoCAD 2010 Ribbon like this one? As Wilhelm mentioned, the Click event is missing. How do we make the button work?

    Yes, it's getting higher up my list...

    Kean

    Hi Kean,

    Any thoughts to what can be done to make up for the missing Click event in RibbonButton.

    For those of you who are ADN members, you can find a technical solution on the ADN site which should help: TS88988 - Adding a Ribbon Tab at runtime (non CUIx file).

    I will publish something based on this when I have the time to research it myself, but in the meantime this is the approach, from what I can tell:

    When you create your button, it needs to have a command string and a handler:

    Autodesk.Windows.RibbonButton ribButton1 = new RibbonButton();
    ribButton1.Text = "Register me!";
    ribButton1.CommandParameter = "REGISTERME ";
    ribButton1.ShowText = true;
    ribButton1.CommandHandler = new AdskCommandHandler();
    

    The command handler class, derived from ICommand, then takes care of executing the command using SendStringToExecute:

    public class AdskCommandHandler: System.Windows.Input.ICommand 
    {
      public bool CanExecute(object parameter)
      {
        return true;
      }
      public event EventHandler CanExecuteChanged;
      public void Execute(object parameter)
      {
        //is from a Ribbon Button?
        RibbonButton ribBtn = parameter as RibbonButton;
        if (ribBtn != null)
          Application.DocumentManager.MdiActiveDocument.SendStringToExecute(
            (String)ribBtn.CommandParameter, true, false, true
          );
        //is from s Ribbon Textbox?
        RibbonTextBox ribTxt = parameter as RibbonTextBox;
        if (ribTxt != null)
            System.Windows.Forms.MessageBox.Show(ribTxt.TextValue);
      }
    }
    I hope this is enough to get you going,

    Kean

    An additional comment Fenton Webb on this:

    It is actually possible to specify the controlling class (the System.Windows.Input.ICommand) of the raw RibbonButton using the x:Class property... This is referred to as “code behind”. Something like this, where CsMgdAcad8.AdskCommandHandler is the class derived from System.Windows.Input.ICommand:

    <ResourceDictionary x:Class="CsMgdAcad8.AdskCommandHandler">

    Kean

    Verify your Comment

    Previewing your Comment

    This is only a preview. Your comment has not yet been posted.

    Working...
    Your comment could not be posted. Error type:
    Your comment has been posted. Post another comment

    The letters and numbers you entered did not match the image. Please try again.

    As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

    Having trouble reading this image? View an alternate.

    Working...

    Post a comment

    Feed & Share

    Search