Author Topic: CustomizationSection AutoCAD 2017 VB.NET  (Read 2142 times)

0 Members and 1 Guest are viewing this topic.

mindofcat

  • Mosquito
  • Posts: 16
CustomizationSection AutoCAD 2017 VB.NET
« on: January 28, 2017, 03:27:22 PM »
Attempting to transfer my AutoCAD 2010 routines into AutoCAD 2017 using VS2015.

Problem: In AutoCAD 2010 VS2010 I could do this:

        Public Shared cs As CustomizationSection
        Public Sub Initialize() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Initialize

            ' Retrieve the location of, and open the ACAD Main CUI File for edit
            Dim mainCuiFile As String = DirectCast(Application.GetSystemVariable("MENUNAME"), String)
            mainCuiFile += ".cuix"
            cs = New CustomizationSection(mainCuiFile)

        End Sub

In AutoCAD 2017 VS2015 the 'CustomizationSection' class seems to be missing from the AutoCAD API.
Anyone have any idea where they moved it, or what the AutoCAD 2017 VS2015 equivalent of the code above would be?

Thanks
« Last Edit: January 28, 2017, 03:35:07 PM by MINDOFCAT »

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2139
  • class keyThumper<T>:ILazy<T>
Re: CustomizationSection AutoCAD 2017 VB.NET
« Reply #1 on: January 28, 2017, 06:24:57 PM »
In AC2017,
When I add a reference to AcCUI.dll

and
using Autodesk.AutoCAD.Customization;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;


This seems to work :

Code - C#: [Select]
  1.  
  2.             var cuiFilePath = (String)AcadApp.GetSystemVariable("MENUNAME");
  3.             CustomizationSection acadCuix = new CustomizationSection(
  4.                 cuiFilePath +
  5.                 @".cuix");
  6.  
  7.  
« Last Edit: January 28, 2017, 06:28:45 PM by kdub »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

mindofcat

  • Mosquito
  • Posts: 16
Re: CustomizationSection AutoCAD 2017 VB.NET
« Reply #2 on: January 28, 2017, 06:53:18 PM »
Thanks kdub, this did the trick.
Importing acCui.dll gave me Autodesk.AutoCAD.Customization which in turn contains the CustomizationSection I was searching for. The rest was easy after that.

Thanks again. Issue resolved.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2139
  • class keyThumper<T>:ILazy<T>
Re: CustomizationSection AutoCAD 2017 VB.NET
« Reply #3 on: January 28, 2017, 06:57:29 PM »

Great, I'm pleased to be able to help.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.