Author Topic: Menugroup Flyouts AutoCAD 2017 VS2015  (Read 1810 times)

0 Members and 1 Guest are viewing this topic.

mindofcat

  • Mosquito
  • Posts: 16
Menugroup Flyouts AutoCAD 2017 VS2015
« on: January 30, 2017, 09:50:10 PM »
Hi All,

Still porting my code over to AutoCAD 2017 VS2015 from AutoCAD 2010 VS2010. The following was working perfectly in 2010, loading the flyouts and toolbars; but now that I have imported it into AutoCAD 2017, I load the DLL and no toolbars or flyouts are shown upon AutoCAD startup.


        Private Shared groups As acOp.AcadMenuGroups
        Private Shared group As acOp.AcadMenuGroup
        Private Shared toolbars As acOp.IAcadToolbars
        Private Shared toolbar As acOp.AcadToolbar
        Private Shared flyout As acOp.AcadToolbarItem

        Public Shared Sub addToolbar()
            Try
                Dim app As acOp.AcadApplication =
                DirectCast(Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication,
                acOp.AcadApplication)

                ' Define the toolbars group
                groups = app.MenuGroups
                group = groups.Item(0)
                toolbars = group.Toolbars

                ' Generate the flyout toolbar
                toolbar = toolbars.Add("CatScript Tools")

                ' Generate the flyouts
                flyoutForTableTop(0)

                ' Dock the newly created toolbar on the left
                toolbar.Dock(acOpCom.AcToolbarDockStatus.acToolbarDockLeft)

            Catch ex As System.Exception

            End Try
        End Sub


        ' Component for generating the flyout for table top, as well as buttons for each routine
        Private Shared Sub flyoutForTableTop(ByVal toolbarIndex As Long)

            ' Create a table top toolbar
            Dim tool As acOp.AcadToolbar = toolbars.Add("Table Top")
            Dim titles(), commands(), descs() As String

            titles = {"Straight", "Corner"}
            commands = {"straight", "corner"}
            descs = {"Generates the straight sections for table top applications. ",
                     "Generates the curved sections and corners in table top applications."}

            ' Generate the buttons
            Dim button As acOp.AcadToolbarItem
            For i As Long = 0 To titles.Length - 1
                ' Add the button to temporary toolbar
                button = tool.AddToolbarButton(i, "Table Top " & titles(i),
                descs(i), ChrW(27) & ChrW(27) & "_tt" & commands(i) & vbLf, False)

                ' Set the images for the button
                button.SetBitmaps(cat.root & "TT " & titles(i) & ".bmp",
                "C:\catscript17\" & "TT " & titles(i) & ".bmp")
            Next

            'Create the Group flyout
            flyout = toolbar.AddToolbarButton(toolbarIndex,"Table Top Conveyor", "Groups the Table Top conveyors",
                ChrW(27) & ChrW(27) & "_ttstraight" & vbLf, True)
            flyout.SetBitmaps(cat.root & "TT Straight.bmp", cat.root & "TT Straight.bmp")

            ' Attach the group toolbar to the flyout just created
            flyout.AttachToolbarToFlyout(group.Name.ToString(), "Table Top")
            tool.Visible = False

        End Sub


I'm wondering how in AutoCAD 2017 Dot net can I get to create and show custom flyouts automatically docked to the left on AutoCAD startup?

Thanks.

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Menugroup Flyouts AutoCAD 2017 VS2015
« Reply #1 on: January 31, 2017, 10:24:42 AM »
toolbar.Dock(acOpCom.Common.AcToolbarDockStatus.acToolbarDockLeft);  MAYBE
           

mindofcat

  • Mosquito
  • Posts: 16
Re: Menugroup Flyouts AutoCAD 2017 VS2015
« Reply #2 on: January 31, 2017, 12:38:15 PM »
I have this at my class header:
Imports acOpCom = Autodesk.AutoCAD.Interop.Common

acOpCom already incorporates the 'Common' class

mindofcat

  • Mosquito
  • Posts: 16
Re: Menugroup Flyouts AutoCAD 2017 VS2015
« Reply #3 on: January 31, 2017, 12:39:42 PM »
I also have this at class header:
Imports acOp = Autodesk.AutoCAD.Interop