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

Create Custom Tool Palette group

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
_ane_
3977 Views, 6 Replies

Create Custom Tool Palette group

Hello,

 

I want to create a new Tool Palette Group. How can I do?  

 

Thanks,

 

Ane

6 REPLIES 6
Message 2 of 7
arcticad
in reply to: _ane_

http://forums.autodesk.com/autodesk/attachments/autodesk/152/26712/1/CP205-2_Mike_Tuersley.pdf

---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 3 of 7
maiterela
in reply to: arcticad

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

Message 4 of 7
Balaji_Ram
in reply to: maiterela

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.

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 5 of 7
_ane_
in reply to: _ane_

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

Message 6 of 7
Balaji_Ram
in reply to: _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

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 7 of 7
_ane_
in reply to: Balaji_Ram

 

Hi Balaji_Ram,

 

Thanks for your answer, I think that your solution is better than mine. I'll have it in mind for next.

 

 

 

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