New ToolBar sample

New ToolBar sample

Anonymous
Not applicable
954 Views
6 Replies
Message 1 of 7

New ToolBar sample

Anonymous
Not applicable
Can anyone give me a hand on creating a toolbar in AutoCAD with arx? I have
looked through the help files but cannot find anything. Where do I need to
begin and what do I need to look out for? If anyone knows where to find a
tutorial or a simple example, I would appreciate it.
0 Likes
955 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Simplest code without error checking:
[code]
#import "acax16enu.tlb" no_namespace

static void AddToolbar(void)
{
// Add your code for command Toolbar.AddToolbar here
try
{
IAcadApplicationPtr pAcad = acedGetAcadWinApp()->GetIDispatch(TRUE);
IAcadMenuGroupsPtr pMnuGrps = pAcad->MenuGroups;
IAcadMenuGroupPtr pMnuGrp = pMnuGrps->Item(0);
IAcadToolbarsPtr pTlbrs = pMnuGrp->Toolbars;
IAcadToolbarPtr pTlbr = pTlbrs->Add("My toolbar");
IAcadToolbarItemPtr pTlbrItem = pTlbr->AddToolbarButton(
0, // Item number
"MyName", // Item name
"Help string", // Item help string
"\x1b\x1b_.Options " // Item macro string
);
pTlbrItem->SetBitmaps("C:\\SmallIcon.bmp","C:\\LargeIcon.bmp");
}
catch (...)
{

}
}
[/code]
0 Likes
Message 3 of 7

Anonymous
Not applicable
Thanks.... A lot of!! 😄
0 Likes
Message 4 of 7

Anonymous
Not applicable
It is great thanks but after I create a new toolbar and I close AutoCAD it is not saved with the other AutoCAD toolbars. Everytime I have to recreate and relocate.

How can I save my new toolbar so that everytime AutoCAD opens it will be in its las position????
0 Likes
Message 5 of 7

Anonymous
Not applicable
Created with help of ActiveX toolbar cannot be saved such as toolbar from mnu/cui-file. You need to monitor toolbar position (for example in command reactor) save it and after restart AutoCAD create toolbar and set it's position from saved value.
0 Likes
Message 6 of 7

Anonymous
Not applicable
I tries this mnu files those toolbars created with mnu files cannot be saved either.

Can you show me any example or link for creating toolbars with mnu files?

I used the AutoCAD 2004 doumentation from the help of AutoCAD itself.

Thanks anyways:)
0 Likes
Message 7 of 7

Anonymous
Not applicable
Read acad.mnu and find **toolbar section. You have to create own mnu-file and load it with help of menuload command.
0 Likes