.NET

Reply
Contributor
_ane_
Posts: 19
Registered: ‎09-03-2010
Message 1 of 7 (1,469 Views)
Accepted Solution

Create Custom Tool Palette group

1469 Views, 6 Replies
11-12-2012 06:29 AM

Hello,

 

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

 

Thanks,

 

Ane

*Expert Elite*
arcticad
Posts: 1,285
Registered: ‎06-21-2004
Message 2 of 7 (1,458 Views)

Re: Create Custom Tool Palette group

11-12-2012 08:59 AM in reply to: _ane_

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

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



(defun botsbuildbots() (botsbuildbots))
Active Member
maiterela
Posts: 9
Registered: ‎11-12-2012
Message 3 of 7 (1,451 Views)

Re: Create Custom Tool Palette group

11-12-2012 09:43 AM 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

ADN Support Specialist
Balaji_Ram
Posts: 691
Registered: ‎03-21-2011
Message 4 of 7 (1,397 Views)

Re: Create Custom Tool Palette group

11-20-2012 04:13 AM 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

Contributor
_ane_
Posts: 19
Registered: ‎09-03-2010
Message 5 of 7 (1,011 Views)

Re: Create Custom Tool Palette group

10-09-2013 03:38 AM 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

ADN Support Specialist
Balaji_Ram
Posts: 691
Registered: ‎03-21-2011
Message 6 of 7 (982 Views)

Re: Create Custom Tool Palette group

10-11-2013 04:29 AM 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

Contributor
_ane_
Posts: 19
Registered: ‎09-03-2010
Message 7 of 7 (855 Views)

Re: Create Custom Tool Palette group

11-08-2013 07:29 AM 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.

 

 

 

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.