I’m kinda new to AutoCad programming and hope I ask the question right 🙂 I atleast couldn’t find another post about this.
Is there a way I can access the properties of a CatalogItem in an existing tool palette?
With the code below I managed to loop through the existing items in the loaded tool palettes.
_
Public Sub Test()
'Initiate ToolPaletteManager
Dim tp As ToolPaletteManager = Autodesk.AutoCAD.Windows.ToolPalette.ToolPaletteManager.Manager
'Initiate the CatalogItems from the toolpalette.
Dim catalogItemCol As CatalogItemCollection = tp.Catalogs
Dim iter As Long
'Iterate through all items in the toolpalette catalog
For iter = 0 To catalogItemCol.Count - 1
Dim catalogMain As CatalogItem
catalogMain = catalogItemCol.Item(iter)
'iterate through all tool palette tabs
Dim iter2 As Long
For iter2 = 0 To catalogMain.ChildCount - 1
Dim catalogSub As CatalogItem
catalogSub = catalogMain.GetChild(iter2)
'Iterate through all items in the palette tab
Dim iter3 As Long
For iter3 = 0 To catalogSub.ChildCount - 1
Dim palItem As CatalogItem
palItem = catalogSub.GetChild(iter3)
'todo
'get the properties of the catalogItem (palItem)
'edit items if needed
Next
Next
Next
End Sub
I found the CustomBaseClass which contains the function .GetToolProperties(), but I have no idea how to use it. If anyone could point me out to the right direction I would really appreciate it.
If you have a better way to access the toolpalette items using VB.Net or C# I would really like to know. I’ve checked the sample SimpleToolPalette, but I can’t make anything out of it, besides creating new Tool palette’s
Many thanks in advance !