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

Problem Persisting Paletteset

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
CADKarasu
692 Views, 5 Replies

Problem Persisting Paletteset

Problem: Unable to persist a Palette from session to session (asuming it was resident on exit).

Think I have read through all the relevent posts and I'd swear I had it working at one point, BAD

is the command used to invoke the application and ps is a shared paletteset.

 

Here's my code:

 

Public Shared Sub Show()
      If ps Is Nothing Then
            ' (Command As String [Used when AutoCAD restarts to 'show' the palette if it was
            ' visible when the user quit], Tool ID As System GUID)
            ps = New PaletteSet("BAD", New Guid("8DC38958-1CBF-4CE7-AEE0-7C98BA84BDAB"))
            ps.MinimumSize = New Drawing.Size(400, 600)
            ps.Style = PaletteSetStyles.NameEditable Or PaletteSetStyles.ShowPropertiesMenu _
                           Or PaletteSetStyles.ShowAutoHideButton Or PaletteSetStyles.ShowCloseButton
            If File.Exists("C:\Pacificorp\pcorp.ico") Then ps.Icon = New Icon("C:\Pacificorp\pcorp.ico")
            ps.Name = "Drawing Batch Audit 2014"
            ps.Add("Drawing Batch Audit 2014", bad_control)
      End If
      ps.Visible = True
End Sub

 

Any help gratefully solicited . . .

5 REPLIES 5
Message 2 of 6
fieldguy
in reply to: CADKarasu

This is the 2nd time with this for me and chances are I will need it again.  It uses System.Windows.Rect which is in the WindowsBase reference.  It was noted >>here<< msg # 5 that DockSides needs to be set after Visible.  This is working for me - not sure if it is what you need.  I want to define a palletteset and show it in the same location every time.

 

if (_mycontrol == null)
            {
                int acadx = acapp.Application.MainWindow.Location.X;
                int acady = acapp.Application.MainWindow.Location.Y;
                int offset = 100;
// the size below is 50 units larger than my control System.Windows.Rect myrect = new System.Windows.Rect(acadx + offset, acady + offset, 950, 350); _mycontrol = new PaletteSet("Fill Blocks"); _mycontrol.InitializeFloatingPosition(myrect); _mycontrol.Add("blocks", _myform); } _mycontrol.Visible = true; _mycontrol.Dock = DockSides.None;

 

Message 3 of 6
Anonymous
in reply to: CADKarasu

If you use this would be fine:

 

ps = New PaletteSet("", New System.Guid("{8DC38958-1CBF-4CE7-AEE0-7C98BA84BDAB}"))

 

(Also you need to define your "bad_control" somewhere)

Message 4 of 6
CADKarasu
in reply to: fieldguy

Thank you for your reply Fieldguy, unfortunately it doesn't seem to be doing the trick.  

 

One weird thing that's occuring (a new development or something I've just been missing) is that AutoCAD does seem to be issuing the command to start the application, however it seems to be doing so before the code is netloaded (see below).  

 

AutoCAD menu utilities loaded.
Loading [C:\Users\P28867\documents\autocad development\lisp\Pacificorp.Lsp]

Command: COMMANDLINE

Command: _RIBBON

Command: BAD
Unknown command "BAD". Press F1 for help.

Command:
Command: Substation CUIX IS Loaded... Member [P28867] Development Users...
NOT Copying Network files...
JB-Netloading: C:\Users\P28867\Documents\Visual Studio 2010\Projects\Pcorp\bin\Debug\PCorp.Dll
JB-Netloading: C:\Users\P28867\Documents\Visual Studio 2010\Projects\Pcorp_FXUpdate_2010\bin\Debug\FXUpDate.DLL
Not Copying XML files Locally....
Command:
Loading AeciIb...
Loading AeciUiBase...
Loading AeciIbApi...
Loading AeciRibbonUiApi...
Command:

 

The lines in red above show that AutoCAD is issuing the command to startup the application correctly (the Command name is 'BAD' and the application isn't loaded until the S::Startup executes four lines below).  Please ignore the prompts about not loading support files that's just something I'm doing for development only.

 

The weird thing in all this is it used to work flawlessly and we have been using this application for years.  This particular issue grew out of converting the code over to the new ARX code requirments for AutoCAD 2013/ 2014.  Prior to that if the palette was visible (docked or floating) when Autocad was shut down it came back up in that position everytime.

 

Will continue to try and figure all this out and post a solution should I find one.

Thanks again for responding.

 

 

Message 5 of 6
CADKarasu
in reply to: Anonymous

Thank you for your reply Hongbinren --

 

Unfortunately this didn't help eiither (please see my previous reply).  My understanding of the paletteset command is that there are three overloads and with the one that I'm using the arguments are "Name" and "System.GUID".  In another forum post (at least I think it was the forum, might have been the Swamp though) it was said that the Name is more than a title but is also the command Autocad uses to invoke the application on startup (which in fact it does seem to be) and that the GUID was also required to enable persistence in the paletteset.  

 

I have also tried the third overload where the arguments are: Name / Command / GUID.

ps = New PaletteSet("Drawing Batch Audit 2014", "BAD", New Guid("{A4298B54-6FE6-4D52-8EEE-E253AB3E79BC}"))

This was the original format used in our pre-2014 code and it also does not seem to function now.

 

Another weird thing here as I mentioned in my original post, I swear this was working for 'a while' and then I did something and it has never persisted since then.

 

Again thank you very much for your responce.

Message 6 of 6
CADKarasu
in reply to: CADKarasu

SOLUTION:

As pointed out by n.yuan in the Swamp forum I needed to preload my application, why this is so in release 2014 when simply netloading it in our S::startup function has worked for years is still a mystery.

However after coming accross the code from Balaji_Ram in the .NET forum (http://forums.autodesk.com/t5/NET/AutoCAD-2014-Automatic-dll-loading/td-p/4580115) and implementing it to register my app. the problem is solved and my paletteset is persisting it's state from session just as it used to.  

Thanks to everyone for their help.

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