Is there anyway to stop AutoCAD executing the command used to create a palette upon AutoCAD startup?
I know constructing the palette without a GUID prevents this behaviour but I'd like keep this to preserve the palette size, position, state etc given when a GUID is provided.
I had hoped I could just close / make not visible the palette just before AutoCAD exits and it wouldn't try and restore the palette upon the next AutoCAD started. I've tried doing this in the Application.BeginQuit event but the command is still called the next time AutoCAD is started.
Solved! Go to Solution.
It's a custom control hosted in an AutoCAD Palleteset. It is executed by a custom CommandMethod in an assembly thats auto-loaded from a registry key.
The problem is that everytime AutoCAD starts the commandMethod command is automatically called (you can see it in the commandline) if the palleteSet was visible when AutoCAD was last closed. As I understand it AutoCAD tries to restore the state of Palettes from the last session everytime it's started. If I manually close the Palettset before closing AutoCAD then AutoCAD doesnt execute the command the next time AutoCAD starts(what I want, but I cant seem to do this programatically).
I'd like the Palletset to never be restored by AutoCAD on startup. It's quite a big pallette and seems to cause confusion to some people if it pops up when AutoCAD starts..
It's not really a big deal really though and I can see the logic behind why AutoCAD does this, I just wondered if anyone had managed to (or wanted to) circumvent it before.
I get you. I think I know how to fix this. It's how you specify the first parameter of the PaletteSet constructor. The ObjectARX documentation for this is not clear. For example:
= new PaletteSet(
The "MYPALETTESET" name parameter is NOT the name of the PaletteSet, rather it's the name of the command that AutoCAD will issue to show the PaletteSet when AutoCAD re-starts (i.e. if it was visible when you quit).
If your the palette was visible the last time you exited AutoCAD and your command to show the palette is also "MYPALETTESET", AutoCAD will call this command on startup (hence making your palette visible).
So the solution to your problem is pretty simple. Instead specify an empty string for the name parameter, i.e.:
= new PaletteSet(
This should do the trick.
As a side note I discovered that the palette data is stored in the Profile.aws file (actually an xml file) located here:
Anyways let me know if this fixed it for you.
p.s. Kudos to Tony Tanzillo for the solution:
You're most welcome.
Just one other thing to clarify. The constructor's name parameter actually sets both the name of the command for restart AND the title text for the palette window. So you might notice that the title of your palette is empty. If you want to set the title do the following:
= new PaletteSet("", new Guid("A2E356FA-1C86-410E-BEBC-79CC4515925E"));
ps.Name = "Title of My Palette";
It seems the constructor's name parameter sets both the command for restart and the title text. But if you set the Name property again it only changes the title text.
Seems like these really should have different properties (i.e. RestartCommandName and Title), but that's how it is sometimes :-)
Not sure if true when the post was originated, but there is another overload which specifically addresses the command:
public class PaletteSet : Window, ICollection
public PaletteSet(string name);
public PaletteSet(string name, Guid toolID);
public PaletteSet(string name, string cmd, Guid toolID);
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.