.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

stopping palette being restored on startup

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
jamierobertson1
877 Views, 6 Replies

stopping palette being restored on startup

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.

 

Any ideas?

6 REPLIES 6
Message 2 of 7
Artvegas
in reply to: jamierobertson1

Hi, I'm a bit confused what you are asking. Are you talking about an AutoCAD palette or your own custom .NET palette? If you are talking about your own custom .NET palette, how is AutoCAD executing your command to create the palette on startup? Did you add it to a lisp file, are you doing this in the IApplicationExtension.Initialize() method, or using the autoloader mechanism? Art
Message 3 of 7
jamierobertson1
in reply to: Artvegas

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.

Message 4 of 7
Artvegas
in reply to: jamierobertson1

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:

 

   PaletteSet ps
      = new PaletteSet(
            "MYPALETTESET",
            new Guid("A2E356FA-1C86-410E-BEBC-79CC4515925E"
         ));

 

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.:

 

   PaletteSet ps
      = new PaletteSet(
            "",
            new Guid("A2E356FA-1C86-410E-BEBC-79CC4515925E"
         ));

 

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:

C:\Users\<UserName>\AppData\Roaming\Autodesk\AutoCAD XXXX\RXX.X\enu\Support\Profiles\Unnamed Profile\Profiles.awt

 

Anyways let me know if this fixed it for you.

 

Art.

 

p.s. Kudos to Tony Tanzillo for the solution:
http://forums.autodesk.com/t5/NET/PaletteSet-Title-Command-GUID-Confusion/td-p/2661021

Message 5 of 7
jamierobertson1
in reply to: Artvegas

That fixed it perfectly, thanks very much!

Message 6 of 7
Artvegas
in reply to: jamierobertson1

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:

 

   PaletteSet ps
      = 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 🙂

 

Art

Message 7 of 7
Brad_Hamilton
in reply to: Artvegas

Not sure if true when the post was originated, but there is another overload which specifically addresses the command:

namespace Autodesk.AutoCAD.Windows

{

[Wrapper("AdUiPaletteSet")]

public class PaletteSet : Window, ICollection

{

public PaletteSet(string name);

public PaletteSet(string name, Guid toolID);

public PaletteSet(string name, string cmd, Guid toolID);

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost