Creating new customized menu and toolbar in Autocad 2010 using VB.NET

Creating new customized menu and toolbar in Autocad 2010 using VB.NET

Anonymous
Not applicable
6,316 Views
5 Replies
Message 1 of 6

Creating new customized menu and toolbar in Autocad 2010 using VB.NET

Anonymous
Not applicable

Hi,

I am trying to create new custom menu and toolbar in autocad 2010 using VB.NET / C#. I tried in google i didn't get proper help. i tried the below URL for adding exisitng toolbar and menu. But i need to create new one. Please please please help me.

 

http://through-the-interface.typepad.com/through_the_interface/2010/04/adding-to-autocads-applicatio...

 

Thanks & Regards,

Shashidhara N

 

 

 

0 Likes
6,317 Views
5 Replies
Replies (5)
Message 2 of 6

wayne.brill
Collaborator
Collaborator

Hi,

 

Here is an example that adds menu elements to the CUIx file using the  AutoCAD.NET Customization namespace. (reference accui.dll)  If you do not want to change the main CUIx file then you can use a Partial CUIx file. In either case the API is the similar. (other than the CustomizationSection).  This example is from the ADN website.

 

If you do not want to work with the CUIx files at all, you can use the COM API to create toolbars and pulldown menus. (these are not automatically created the next time AutoCAD is started) The 2010 Developer's Guide that ships with AutoCAD 2010 has examples. (see this help directory see this file - acad_dev180.chm)

 

Wayne Brill

Autodesk Developer Network



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 6

Anonymous
Not applicable

I dont know how this works

tbBtn.MacroID = "<my command method>"

all that happens is an error is caught saying object reference not set
what i'm i missing?

 

also are customizations going away because i'm using autocad map 3d 2011 x64 and i want a toolbar and i cant find anything that works except

 

'' Create toolbar
Dim toolbar As Object = Application.MenuGroups.item(0).Toolbars.add("Field Engineering ToolBar")

 

'' Directory of bitmap images
'Dim dir As String = "C:\Program Files\Autodesk\AutoCAD Map 3D 2011\FEimages"

 

'' New Map Button
Dim mapBtn As Object = toolbar.AddToolbarButton(0, "Make Map Button", "Helpstring button", "MAKEMAP ", False)
mapBtn.SetBitmaps(dir & "\Map_bmp.BMP", dir & "\Map_bmp.BMP")

0 Likes
Message 4 of 6

Balaji_Ram
Alumni
Alumni

Hi,

 

The sample shoud still work ok. 

 

The MacroID requires a unique identifier of a menu macro. 

In the sample project, please look for "CreateMenuMacro".

 

The third parameter to this method is the Unique identifier of the macro. 

The second parameter to this method is the actual macro that will invoke your command which should be for example : "^C^CMyCommand "

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 5 of 6

Anonymous
Not applicable

Hi ,

I have viewd your code,I have a doubt after adding New PopupMenuItem how to bind new event or command with that perticular PopupmenuItem.

Please Revert back with it ASAP.

Regards,

Sudarshan

0 Likes
Message 6 of 6

Anonymous
Not applicable

hi,I got this , Just One question how to add nested PopUpmenuitems to existing One.

Thanks.

0 Likes