http://forums.autodesk.com/autodesk/attachments/autodesk/152/26712/1/CP205-2_Mike_Tuersley.pdf
Hello,
Could I use this method to create a Pallete Group but instead of including diferent new pages to add existing Palettes that I chouse from AutoCAD.
I want to do the same that I can do interatively with the "Palette administrator" and in the right side of the dialog I can create a group tree and then attatch in each group Palettes I can select from the right list.
Is this posible in .NET?
Thanks
Maitere Larrañaga
Hello Maitere,
If you are looking for AutoCAD .Net API to create a tool palette, then this SDK sample will help :
<ObjectARX Folder>/samples/dotNet/SimpleToolPalette
But the AutoCAD .Net API does not provide an API to create toolpalette groups and assign existing tool palette to them.
The tool palette relies on the COM interfaces and so is quite limited in what you can do when used with .Net.
Mike Tuersley's AU presentation on custom palettes using .Net that arcticad has provided will give you lot more control over the palettes. Custom palettes are different from tool palettes and so cannot be grouped under the tool palette groups.
Hello,
We finally resolved this issue implementing the function in ObjectArx, we created another proyect and implemented new commands.
We can launch the commands from a proyect of autocad.net or from comand line of AutoCad.
void CrearGruposPaletas() { TCHAR datosGrupos[1000]; //TCHAR * datosGrupos=L"Grupo3|Grupo2"; CString grupoNuevo; CString grupoPadre; CString pElem[50]; int res; bool ok; CAcTcUiToolPaletteSet *pTPSet = AcTcUiGetToolPaletteWindow(); CAcTcUiToolPaletteGroup *pPaletteGroups = pTPSet->GetToolPaletteGroup(true); CAcTcUiToolPaletteGroup *pPaletteGroupNuevo; CAcTcUiToolPaletteGroup *pPaletteGroupPadre; res= acedGetString (1, _T("\nDatos de grupo: "), datosGrupos); res=SplitString(datosGrupos,_T("|"),pElem); //Formato: NombreGrupo|GrupoPadre if (res == 2) { grupoNuevo= pElem[0]; grupoPadre=pElem[1]; pPaletteGroupNuevo = pPaletteGroups->FindGroup(grupoNuevo,true); if (pPaletteGroupNuevo == NULL) { // No existe el grupo, se creara uno nuevo //Clonar el grupo general y borrarle los elementos para que sea el nuevo grupo a agregar ok = pPaletteGroups->Clone(pPaletteGroupNuevo); if (ok) { ok = pPaletteGroupNuevo->DeleteAllItems(); } if (ok) { //Asignarle el nombre al nuevo grupo ok=pPaletteGroupNuevo->SetName(grupoNuevo); //Buscar el grupo padre y asignarle el nuevo pPaletteGroupPadre=pPaletteGroups->FindGroup(grupoPadre,true); if (pPaletteGroupPadre != NULL) { res=pPaletteGroupPadre->AddItem(pPaletteGroupNuevo); } } } } else if(res==1) { //Si no aparece GrupoPadre es el raiz grupoNuevo = pElem[0]; pPaletteGroupNuevo = pPaletteGroups->FindGroup(grupoNuevo,true); if (pPaletteGroupNuevo == NULL) { // No existe el grupo, se creara uno nuevo //Clonar el grupo general y borrarle los elementos para que sea el nuevo grupo a agregar ok = pPaletteGroups->Clone(pPaletteGroupNuevo); if (ok) { ok = pPaletteGroupNuevo->DeleteAllItems(); } if (ok) { //Si no aparece GrupoPadre es el raiz grupoNuevo= pElem[0]; ok=pPaletteGroupNuevo->SetName(grupoNuevo); res=pPaletteGroups->AddItem(pPaletteGroupNuevo); } } } }
thanks,
Ane
Hi Ane,
I am glad you have got it working.
Another approach to create ToolPalette groups is explained here :
http://adndevblog.typepad.com/autocad/2013/06/working-with-toolpalette-groups-using-net.html
Hi Balaji_Ram,
Thanks for your answer, I think that your solution is better than mine. I'll have it in mind for next.