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

How do I activate an existing PaletteSet in C#

11 REPLIES 11
Reply
Message 1 of 12
Anonymous
1389 Views, 11 Replies

How do I activate an existing PaletteSet in C#

I did a search and found a few explanations but the examples were not complete enough to work for me because I am very new to C#.

How do I set an existing PaletteSet as the active PaletteSet with C#?

John
11 REPLIES 11
Message 2 of 12
Anonymous
in reply to: Anonymous

What do you mean by the 'active' paletteset ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5489708@discussion.autodesk.com...
I did a search and found a few explanations but the examples were not complete enough to work for me because I am very new to C#.

How do I set an existing PaletteSet as the active PaletteSet with C#?

John
Message 3 of 12
Anonymous
in reply to: Anonymous

The "displayed" palette set.
My goal is to write a program that when a user opens a construct the palette set will automatically change to one that only has commands for that particular construct.

Thanks
John
Message 4 of 12
Anonymous
in reply to: Anonymous

The 'displayed' palette set?

Sorry still not sure what you mean. Any number of
palettesets can be active/visible at any given time.

Perhaps you mean an individual palette on a paletteset ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5491322@discussion.autodesk.com...
The "displayed" palette set.
My goal is to write a program that when a user opens a construct the palette set will automatically change to one that only has commands for that particular construct.

Thanks
John
Message 5 of 12
TomiH
in reply to: Anonymous

HI,

You can do this by adding a eventhandlers for the documentcollection. Place the folloowing line to for example in your palette set builder:

' Document handler
AddHandler docCol.DocumentBecameCurrent, New DocumentCollectionEventHandler(AddressOf Me.myActiveDocumentChanged)
' In case of Document is closed
AddHandler docCol.DocumentDestroyed, New DocumentDestroyedEventHandler(AddressOf Me.myCheckZeroDocState)
' Take control over the PaletteSet state
AddHandler Me.m_ps.StateChanged, New Autodesk.AutoCAD.Windows.PaletteSetStateEventHandler(AddressOf Me.myPaletteEvents)

The myActiveDocumentChanged method looks something like this:

Private Sub myActiveDocumentChanged(ByVal sender As Object, ByVal e As DocumentCollectionEventArgs)

' If palette is destroyed, remove eventhandlers
If Me.m_PaletteExist = False Then
Dim docCol As DocumentCollection = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager
RemoveHandler docCol.DocumentDestroyed, AddressOf Me.myCheckZeroDocState
RemoveHandler docCol.DocumentBecameCurrent, AddressOf Me.myActiveDocumentChanged
RemoveHandler m_ps.StateChanged, AddressOf Me.myPaletteEvents

' Check that there is at least one document, otherwise acad will crash
ElseIf e.Document Is Nothing = False Then
' Check if the document has changed
If e.Document.Equals(Me.m_CurrentDocument) = False Then
Me.m_palette.Enabled = True
' Save the current document so that you can check it next time
Me.m_CurrentDocument = e.Document
' Finally call the function that sets your palette as you please
Me.m_ui.InitializeMyPalette(e.Document)
End If
End If

End Sub


Many potential crash points, so be carefull that you have a document when you call document events and that you have a paletteset when you call the paletteset evets.


/ Tomi
Message 6 of 12
TomiH
in reply to: Anonymous

Sorry, it was in VB.NET. Hope you get the idea.


/ Tomi
Message 7 of 12
Anonymous
in reply to: Anonymous

Tony
I am new to ADT/ABS so perhaps I am not using the correct terminology. I am using paletteset to describe a collection of individual palettes.

The behavior that I am trying to duplicate is as follows.. right mouse click on the title bar of a paletteset, on the resulting popup menu, at the bottom is displayed the available palettesets, in my case HVAC, Piping, Electrical, Plumbing, Architectural, All Palettes (notice I refered to these as palettesets). Selecting one of these displays that paletteset. I would like to program this behavior.

I plan on having a paletteset called WALLS with palettes for walls, windows, doors, etc...
I want this, and only this, paletteset to be displayed when the user opens the First Floor Walls Construct.

I will have other palettesets that are also unique to specific constructs (ie. ROOF, FLOOR...) Which would also only be displayed when the user opens the corresponding construct.

Please correct me if I am using the terms incorrectly.

Thankyou
John
Message 8 of 12
Anonymous
in reply to: Anonymous

A paletteset is a single window that has on it, one or
more palettes. Each palette has a vertical tab on the
side of the window. I'm still confused as to whether
you're referring to an individual palette or a complete
paletteset.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5492660@discussion.autodesk.com...
Tony
I am new to ADT/ABS so perhaps I am not using the correct terminology. I am using paletteset to describe a collection of individual palettes.

The behavior that I am trying to duplicate is as follows.. right mouse click on the title bar of a paletteset, on the resulting popup menu, at the bottom is displayed the available palettesets, in my case HVAC, Piping, Electrical, Plumbing, Architectural, All Palettes (notice I refered to these as palettesets). Selecting one of these displays that paletteset. I would like to program this behavior.

I plan on having a paletteset called WALLS with palettes for walls, windows, doors, etc...
I want this, and only this, paletteset to be displayed when the user opens the First Floor Walls Construct.

I will have other palettesets that are also unique to specific constructs (ie. ROOF, FLOOR...) Which would also only be displayed when the user opens the corresponding construct.

Please correct me if I am using the terms incorrectly.

Thankyou
John
Message 9 of 12
Anonymous
in reply to: Anonymous

OK, so I am using the terms correctly.
I am trying to change the displayed paletteset.

Again, I am trying to write a program, in C#, that does the same thing as right mouse clicking on the title bar of a paletteset and selecting one of the other available palettesets from the bottom of the resulting popup.

(see also paragraph 2 of my previous post)

John
Message 10 of 12
Anonymous
in reply to: Anonymous

Sorry, now I"m more confused than before,
and you don't have the terminology correct.

Every paletteset has its own title bar, so
you can't right click on the title bar of one,
and select another one from the popup menu.

You are confusing palettesets and palettes
and I would venture to guess at this point,
that you're not describing your own custom
paletteset/palette, but rather the stock
toolpalette that ships with AutoCAD, which
you activate via the TOOLPALETTES command.

Is that the case?

BTW, have you written any AutoCAD based
applications/plugins using C# ?


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5494084@discussion.autodesk.com...
OK, so I am using the terms correctly.
I am trying to change the displayed paletteset.

Again, I am trying to write a program, in C#, that does the same thing as right mouse clicking on the title bar of a paletteset and selecting one of the other available palettesets from the bottom of the resulting popup.

(see also paragraph 2 of my previous post)

John
Message 11 of 12
Anonymous
in reply to: Anonymous

Sorry about the confusion.

I want to change the visible palette group via C#.
Right mouse clicking on the Tool Palette title bar shows the available groups at the bottom of the popup.

At this point I am describing the stock ABS toolpalette.

I am just learning C# now so no I have not written anything for ACAD.

John
Message 12 of 12
Anonymous
in reply to: Anonymous

I can't tell you if you can manipulate a stock
paletteset, but I doubt its possible. If it is, it
is certainly not easy, and would require some
experience and knowledge of the APIs. If the
APIs are there they are likely undocumented.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5495717@discussion.autodesk.com...
Sorry about the confusion.

I want to change the visible palette group via C#.
Right mouse clicking on the Tool Palette title bar shows the available groups at the bottom of the popup.

At this point I am describing the stock ABS toolpalette.

I am just learning C# now so no I have not written anything for ACAD.

John

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