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.