New APIs in AutoCAD 2012

As you may have seen – including over at Shaan's blog – the 2012 family of our products has now been announced.

AutoCAD 2012 - New APIs
Stephen Preston, our DevTech Americas Manager, has recorded a DevTV session on the new APIs in AutoCAD 2012. This material was presented during our recent Developer Days tour, attended by ADN members around the world.

AutoCAD 2012 – New APIs

View Download (17.2MB) Samples (133KB)

Highlights & topics covered:

  • Migration steps
  • New APIs
    • Associative Array API
    • Multi-mode Grip API
    • ResetTimes
    • VisibilityOverrule
    • BlockTableRecord.SetIsFromOverlayReference
    • acdbConvertAcDbCurveToGelibCurve
    • acdbConvertGelibCurveToAcDbCurve
    • acdbAssignGelibCurveToAcDbCurve
  • Autoloader
    • Simplified plugin deployment
  • AutoCAD for Mac

I'll definitely be following up with more information on these APIs over the coming weeks/months, in particular the new Autoloader feature, which I think readers of this blog will find extremely valuable.

6 responses to “New APIs in AutoCAD 2012”

  1. Hello Kean. Does the old approach still work, or do we have to use Autoloader? I used to add a key to the registry for my application inside HKCU\Software\Autodesk\AutoCAD\R18.2\ACAD-A001:409\Applications, to make it load on the AutoCAD startup, as described in one of your articles, but this doesn't seem to work anymore in AutoCAD 2012.
    Regards.

  2. The "traditional" demand-loading mechanism should absolutely still work.

    I suggest using the ProcessMonitor (a Microsoft SysInternals tool) to diagnose what's not working with your app being loaded.

    Kean

  3. Thank you Kean for a quick response. I figured out what was the problem. I load my plug-in on AutoCAD startup, and I create a cuix file on then fly, and load it with ads_queueexpr. I also create and add a ribbon tab but not as a part of the cuix file. To be able to add a ribbon tab, I need to know when the ribbon is completely loaded, and I used to use RibbonServices events to capture that moment to be able to add my ribbon tab, and that worked well in previous two versions of AutoCAD, but not any more. As soon as I commented those events out, the assembly begun loading properly. I guess I'll have to do without the ribbon tab. Interestingly, ribbon loading works well during the debugging in Visual Studio. Thank you for the advice to use Process Monitor. I used it, but couldn't make out what was wrong. I also created another version with the Autoloader, but also without the ribbon tab.

    Regards,
    Haris

  4. Hi Haris,

    If you're an ADN member, please do submit a reproducible sample for my team to look at (otherwise you might try posting something via the discussion group). There may be a problem with the assumptions you're making about the Ribbon's availability (the fact that it worked in prior versions doesn't mean it was the right approach, necessarily).

    If the code that's failing is from my blog, definitely let me know! 🙂

    Regards,

    Kean

  5. No Kean, I'm not an ADN member. It's highly likely that my approach is not correct given that I have no reference materials for this at all. I just figured it out by experimenting. This is how I was doing it in 2010 and 2011: during the plugin creation, I would attach a handler to RibbonServices.RibbonPaletteSetCreated event, and when that event happens, I would attach another handler for _ribbonControl.Loaded event. When that event happns, I create the ribbon tab and attach it to the ribbon. I create the ribbon tab according to the instructions from one of your blog articles. I create the cuix file for toolbars on the fly and load it, but I didn't know how to integrate the ribbon tab inside the cuix file programatically. I made a few attempts, but failed to make it work.
    This didn't work at first in AutoCAD 2012, but then I changed the code to handle _ribbonControl.LayoutUpdated event instead of _ribbonControl.Loaded, and it worked too, but only during debugging. When I actually deploy application to AutoCAD, then it stops working. Here is the original code excerpt from the working version in 2010 and 2011:

    public class SuperToolsPlugin : IExtensionApplication
    {
    RibbonPaletteSet _paletteSet = Autodesk.AutoCAD.Ribbon.
    RibbonServices.RibbonPaletteSet;
    Autodesk.Windows.RibbonControl _ribbonControl;
    RibbonTab _tab;

    public SuperToolsPlugin()
    {
    RibbonServices.RibbonPaletteSetCreated +=
    new EventHandler(RibbonServices_RibbonPaletteSetCreated);
    }

    public void Initialize()
    {

    }

    public void Terminate()
    {

    }

    void RibbonServices_RibbonPaletteSetCreated(object sender, EventArgs e)
    {
    _paletteSet = Autodesk.AutoCAD.Ribbon.RibbonServices.RibbonPaletteSet;
    _ribbonControl = Autodesk.AutoCAD.Ribbon.RibbonServices.
    RibbonPaletteSet.RibbonControl;

    _ribbonControl.Loaded += new RoutedEventHandler(ribbonControl_Loaded);
    }

    void ribbonControl_Loaded(object sender, RoutedEventArgs e)
    {
    if (!(_ribbonControl.Tabs.Contains(_tab)))
    {
    CreateRibbonTab();
    }

    _ribbonControl.ActiveTab = _tab;
    }

    public void CreateRibbonTab()
    {
    // Code for ribbon tab creation
    }

    }

    I live in Bosnia, and I'm actually a technical drafter turned progamming enthusiast. I have a web site with description of some tools that I was working on: cadisland.com/autocad_add-on.aspx. You can even download my toolset 'Carpentry 2011' for AutoCAD for drawing doors and windows, but they can only be installed if the AutoCAD is the subversion with registry key ACAD-9001:409. Now with Autoloader, it will work on any subversion. I'm especially proud of my tools 'Injector' and 'Extractor' that you can find the description of on the page. I'm looking for a telecommute job, as AutoCAD developer or something like that. I'm well versed with WPF and MVVMLight.

    Haris

  6. Hi Haris,

    That's what I was afraid of: I really don't have time to provide support on issues that don't relate directly to posts on my blog.

    Please do post your question to the AutoCAD .NET Discussion Group - I'm sure someone there will be able to help.

    Regards,

    Kean

Leave a Reply to Stardust1611 Cancel reply

Your email address will not be published. Required fields are marked *