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

New ToolBar sample

6 REPLIES 6
Reply
Message 1 of 7
1cacalvo
711 Views, 6 Replies

New ToolBar sample

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.
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: 1cacalvo

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]
Message 3 of 7
1cacalvo
in reply to: 1cacalvo

Thanks.... A lot of!! 😄
Message 4 of 7
mbasa
in reply to: 1cacalvo

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????
Message 5 of 7
Anonymous
in reply to: 1cacalvo

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.
Message 6 of 7
mbasa
in reply to: 1cacalvo

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:)
Message 7 of 7
Anonymous
in reply to: 1cacalvo

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost