.NET

Reply
Active Member
Posts: 8
Registered: ‎09-17-2009
Message 1 of 25 (567 Views)

Problem with PaletteSet location in Autocad

567 Views, 24 Replies
09-25-2009 01:41 AM
I'm having problem with chosing PalleteSetSet location in Autocad. No matter what I do, it is always docked on left side of Autocad window. My code is something like this:

PaletteSet ps;
ps = new PaletteSet("blabla", new Guid(System.Guid.NewGuid().ToString("B")));
ps.Style = PaletteSetStyles.NameEditable | PaletteSetStyles.ShowPropertiesMenu |
PaletteSetStyles.ShowAutoHideButton | PaletteSetStyles.ShowCloseButton;
ps.MinimumSize = new System.Drawing.Size(Width,Height);
ps.Size = new System.Drawing.Size(.Width,Height);
ps.DockEnabled = Autodesk.AutoCAD.Windows.DockSides.None;
ps.Add("blabla", new Palette());
ps.Visible = true;

Am I missing something? Edited by: JernejC on Sep 25, 2009 8:42 AM
*Norman Yuan
Message 2 of 25 (568 Views)

Re: Problem with PaletteSet location in Autocad

09-25-2009 07:12 AM in reply to: JernejC
Because you use "new Guid()" each time the PaletteSet is created. AutoCAD
persists PaletteSet's location using the GUID assigned to the PaletteSet as
identifier. You should get a fixed Guid value for your PaletteSet.

"JernejC" wrote in message news:6260920@discussion.autodesk.com...
I'm having problem with chosing PalleteSetSet location in Autocad. No matter
what I do, it is always docked on left side of Autocad window. My code is
something like this:

PaletteSet ps;
ps = new PaletteSet("blabla", new
Guid(System.Guid.NewGuid().ToString("B")));

ps.Style = PaletteSetStyles.NameEditable |
PaletteSetStyles.ShowPropertiesMenu |

PaletteSetStyles.ShowAutoHideButton |
PaletteSetStyles.ShowCloseButton;

ps.MinimumSize = new System.Drawing.Size(Width,Height);
ps.Size = new System.Drawing.Size(.Width,Height);
ps.DockEnabled = Autodesk.AutoCAD.Windows.DockSides.None;
ps.Add("blabla", new Palette());
ps.Visible = true;

Am I missing something?

Edited by: JernejC on Sep 25, 2009 8:42 AM
Active Member
Posts: 8
Registered: ‎09-17-2009
Message 3 of 25 (567 Views)

Re: Problem with PaletteSet location in Autocad

09-30-2009 03:53 AM in reply to: JernejC
Which "new Guid()" is a problem?
1.) System.Guid.NewGuid().ToString("B") or
2.) new PaletteSet("blabla", new Guid(...))

I tried setting fixed Guid in first case but there are still no changes. In second case I don't know if there is any other way...
*Tony Tanzillo
Message 4 of 25 (567 Views)

Re: Problem with PaletteSet location in Autocad

09-30-2009 05:35 AM in reply to: JernejC
You need to use the same constant string when
you create the GUID:

{code}

Guid guid = new Guid(""255AA27F-A408-48d5-AA06-F311F3027A9D");

PaletteSet ps = new PaletteSet( "commandname", guid );

You can generate the string for the GUID from Visual Studio's GUIDGEN
tool, which is available from the Tools menu (Tools->Create GUID).

The important thing is that the GUID string must be constant and unique
for each paletteset, and should never change.

Sorry if this post is unreadable, I can assume no responsibility for the
gross incompetence that underlies Autodesk's online discussion group
software.



--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6263127@discussion.autodesk.com...
Which "new Guid()" is a problem?
1.) System.Guid.NewGuid().ToString("B") or
2.) new PaletteSet("blabla", new Guid(...))

I tried setting fixed Guid in first case but there are still no changes. In
second case I don't know if there is any other way...
Active Member
Posts: 8
Registered: ‎09-17-2009
Message 5 of 25 (567 Views)

Re: Problem with PaletteSet location in Autocad

09-30-2009 06:53 AM in reply to: JernejC
Ok, thank you very much.
Active Contributor
Posts: 30
Registered: ‎09-13-2012
Message 6 of 25 (257 Views)

Re: Problem with PaletteSet location in Autocad

11-19-2012 01:53 AM in reply to: JernejC

Hi,

 

I have created my GUID, and I'm trying to compile my code.
But always is the same error message:

 

Error 1 The type 'System.Windows.Interop.IWin32Window' is defined in an assembly that is not referenced. You must add a reference to assembly 'PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. C:\C#_Projects\test8\PreviewBox\PreviewBox\Class1.cs 30 20 PreviewBox

 

I have MVS2010 and AutoCAD2013.

Net framework 4.0.

 

What I should to do?

 

regards

*Expert Elite*
Alfred.NESWADBA
Posts: 8,521
Registered: ‎06-29-2007
Message 7 of 25 (254 Views)

Re: Problem with PaletteSet location in Autocad

11-19-2012 02:03 AM in reply to: ZK_BUDiKOM

Hi,

 

the message shows you:

>> You must add a reference to assembly 'PresentationCore [...]

have you done that?

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
Posts: 30
Registered: ‎09-13-2012
Message 8 of 25 (249 Views)

Re: Problem with PaletteSet location in Autocad

11-19-2012 02:28 AM in reply to: Alfred.NESWADBA

Hmm...

no, I did not...

after the addition, works :smileyhappy:

 

I had to also add "static" in this line:

static Guid guid = new Guid("2919D05C-3A64-4098-B465-FCE445CBD1C7");
PaletteSet myPal = new PaletteSet("commandname", guid);

 

I test this example:

http://blog.smitec.net/posts/autocad-dwg-preview-control/

code:

https://github.com/smitec/AutocadPreviewBox

 

thank you alfred.

Active Contributor
Posts: 30
Registered: ‎09-13-2012
Message 9 of 25 (238 Views)

Re: Problem with PaletteSet location in Autocad

11-19-2012 05:08 AM in reply to: ZK_BUDiKOM

Hmm...

 

this code is correctly compiled, but if I want to add DWG file, AutoCAD generates an error.
What is wrong?

 

regards

 

 

*Expert Elite*
Alfred.NESWADBA
Posts: 8,521
Registered: ‎06-29-2007
Message 10 of 25 (229 Views)

Re: Problem with PaletteSet location in Autocad

11-19-2012 05:34 AM in reply to: ZK_BUDiKOM

Hi,

 

what I see when I open your project (have not started it at all):

  • you have set the property "local copy" for the references to "yes" ==> that should be "no"
  • how do you debug your project? When going to project-properties you have not set the "external program to start" to your ACAD.EXE or to the ACCORECONSOLE.EXE.

 

Interesting would be to see what message you get? Upload a screenshot from this message.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community