Author Topic: Tool Palettes  (Read 12047 times)

0 Members and 1 Guest are viewing this topic.

Glenn R

  • Guest
Tool Palettes
« on: February 08, 2006, 09:26:35 PM »
Has anybody done anything to programatically access these little beasties? I'm not talking about creating a custom palette - there seems to be plenty of information for that.

What I'm talking about is iterating the currently loaded palettes and doing stuff ie. Loading/unloading, visible/not visible etc.

Any thoughts anyone?

Cheers,
Glenn.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Tool Palettes
« Reply #1 on: February 08, 2006, 09:52:13 PM »
I'm blissfully ignorant Glenn ...    :wink:
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Tool Palettes
« Reply #2 on: February 08, 2006, 09:59:53 PM »
As you create them, can you create an array (like a control array) of ref's to them for iteration?? There must be some type of handle to keep track of to have access to them you would think.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.
- J.R.R. Tolkien

Glenn R

  • Guest
Re: Tool Palettes
« Reply #3 on: February 08, 2006, 10:27:03 PM »
I'm not creating them as I mentioned. These are ones that are laoded into AutoCAD, either the standard example ones or the custom ones that I have.

It's difficult deciphering the docs...as we all know....:(

So far:
Code: [Select]
// get apointer to the editor
Editor ed = acadApp.DocumentManager.MdiActiveDocument.Editor;
// Get apointer to the tool palettes manager...
ToolPaletteManager tpMan = ToolPaletteManager.Manager;
// Get the tool pcatalog paths
ed.WriteMessage("\nCatalog path: {0}\n\n", tpMan.CatalogPath);
// get the cdollection of tool catalogs loaded
CatalogItemCollection catalogItems = tpMan.Catalogs;

tpMan.LoadCatalogs();

foreach(CatalogItem catalogItem in catalogItems) {
ed.WriteMessage("\n\nCatalog item type: {0}", CatalogItem.GetType(catalogItem.LocalFile).ToString());
if (!catalogItem.HasChildren)
continue;

for (int i = 0; i < catalogItem.ChildCount; i++) {
CatalogItem paletteItem = catalogItem.GetChild(i);
ed.WriteMessage("\nChild item type: {0}", CatalogItem.GetType(paletteItem.LocalFile).ToString());
if (CatalogItem.GetType(paletteItem.Url.ToString()) == CatalogItemType.ItemPalette) {
ed.WriteMessage("\nGot a palette!");
ed.WriteMessage("\nPalette name: {0}", paletteItem.Name);
}
}
}

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Tool Palettes
« Reply #4 on: February 08, 2006, 10:52:53 PM »
Are you getting any feedback from that Glenn?

(I can't test here 'till tomorrow, have to reload 2006 :( )
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.
- J.R.R. Tolkien

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Tool Palettes
« Reply #5 on: February 08, 2006, 11:02:59 PM »
How about "Palette Sets" ?
Quote
The CAdUiPaletteSet class contains a set of one or more palette windows (CAdUiPalette objects), and supports the following palette style constants:

I think this may be what you're after as the TPM seems to be working with the xml data not the actual windows.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.
- J.R.R. Tolkien

Glenn R

  • Guest
Re: Tool Palettes
« Reply #6 on: February 08, 2006, 11:06:04 PM »
Mick,

Not as yet.

LE,

If you're referring to the BoltUI etc. sample that ships with the ObjectARX SDK, again this is creating a CUSTOM toolpalette.
I just want to programmatically manipulate the existing palettes (load/unload etc).

Cheers,
Glenn.

LE

  • Guest
Re: Tool Palettes
« Reply #7 on: February 08, 2006, 11:08:23 PM »

LE,

If you're referring to the BoltUI etc. sample that ships with the ObjectARX SDK, again this is creating a CUSTOM toolpalette.
I just want to programmatically manipulate the existing palettes (load/unload etc).

Cheers,
Glenn.

Yep... it was about that one....

Glenn R

  • Guest
Re: Tool Palettes
« Reply #8 on: February 08, 2006, 11:09:42 PM »
Mick,

I would concur, however getting one/creating one seems to be the difficult part unless I've totally overlooked something..............

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Tool Palettes
« Reply #9 on: February 08, 2006, 11:26:49 PM »
<edit - removed useless comments!>
try again!
« Last Edit: February 09, 2006, 06:04:51 PM by MickD »
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.
- J.R.R. Tolkien

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Tool Palettes
« Reply #10 on: February 09, 2006, 06:07:34 PM »
I can see where you're heading with this now Glenn and you're right in there's little documentation! And it's littered with COM and all sorts of nasty stuff.
I was getting confused with the sample in the AU docs on creating a tool pallete from scratch which was more like a stand alone dockable window than a 'tool palette'.
I should have 2006 loaded back on after lunch and I'll have a play. Have you got any further?
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.
- J.R.R. Tolkien

Glenn R

  • Guest
Re: Tool Palettes
« Reply #11 on: February 09, 2006, 08:58:08 PM »
Mick,

No further joy to report I'm afraid. I have some suspicions, but I won't taint your thinking process with them, until you have a chance to play with your own ideas.

Cheers,
Glenn.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Tool Palettes
« Reply #12 on: February 09, 2006, 09:23:36 PM »
It works at my end Glenn, I pretty much just copied and pasted your code in and added a using ...Windows.ToolPalette; directive at the top.
here's the output.

I built the SimpleTools demo as well and it showed up in the list, will have to have a go at doing it with C#


"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.
- J.R.R. Tolkien

Glenn R

  • Guest
Re: Tool Palettes
« Reply #13 on: February 09, 2006, 10:37:19 PM »
Mick,

I'm well aware that it works (I wrote it ;) )...it's just a starting point.
I want to be able to switch to another palette, hide tabs, load/unload activate a tab etc....this is the problem. I can't see where to go from there...if that makes sense.

Keep playing if you can...maybe I've missed something blatantly obvious to someone else.

Cheers,
Glenn.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Tool Palettes
« Reply #14 on: February 12, 2006, 07:28:52 PM »
Glenn, I s'pose you've seen this :

anyway, others may not have, so ...
Code: [Select]
namespace Autodesk.AutoCAD.Windows.ToolPalette
{
     //// stripped by kwb 'cause  'The message exceeds the maximum allowed length (20000 characters). '

}

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.