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

VBA to Dot-Net

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
450 Views, 2 Replies

VBA to Dot-Net

Hi,


I'm new to programming AutoCAD with .net so maybe someone can help me with this lines of code written in VBA. I need to rewrite this functionallity in .net:


Public Sub showToolbar()
Dim menuGroup As AcadMenuGroup
Set menuGroup = ThisDrawing.Application.MenuGroups("acad")
Dim toolbar As AcadToolbar

' Check if Toolbar is already there
If (functions.CheckMenuEntry(menuGroup, TOOLBAR_NAME)) Then
Set toolbar = menuGroup.Toolbars.Item(TOOLBAR_NAME)
Else
Set toolbar = menuGroup.Toolbars.Add(TOOLBAR_NAME)
Dim measureDistance As AcadToolbarItem
Set measureDistance = toolbar.AddToolbarButton(toolbar.Count, "Distance between 2 Points", "Distance between 2 Points", "-VBARUN LaOsToolbar.measureDistance" + vbCr)
measureDistance.SetBitmaps "LaOs\measureDistance_small.bmp", "LaOs\measureDistance_large.bmp"
End If

toolbar.Visible = True

If (toolbar.DockStatus acToolbarDockRight) Then
toolbar.Dock acToolbarDockRight
End If
End Sub



Public Sub InsertMenu()
Dim menubar As AcadMenuBar
Set menubar = Application.menubar

' Check if Menubar is already there
If not (CheckMenuBarEntry(menubar, LTGBAU_NAME)) Then
Dim ltgBauMenu As AcadPopupMenu
Dim lispSubMenu As AcadPopupMenu
' Check if PopUpMenu is already there
If (CheckMenuEntry(Application.MenuGroups("acad"), LTGBAU_NAME)) Then
Set ltgBauMenu = Application.MenuGroups("acad").Menus.Item(LTGBAU_NAME)
Else
Set ltgBauMenu = Application.MenuGroups("acad").Menus.Add(LTGBAU_NAME)
End If
Application.MenuGroups("acad").Menus.InsertMenuInMenuBar LTGBAU_NAME, menubar.Count
Dim ltgBauMenuItem As AcadPopupMenuItem
' Toolbar
Set ltgBauMenuItem = ltgBauMenu.AddMenuItem(ltgBauMenu.Count + 1, "Show Toolbar", "-VBARUN Menu.showLaOsToolbar" + vbCr)
' Separator
ltgBauMenu.AddSeparator ltgBauMenu.Count
' Lisp-Submenu
Set lispSubMenu = ltgBauMenu.AddSubMenu(ltgBauMenu.Count + 1, "Lisp-Functions")
Set ltgBauMenuItem = lispSubMenu.AddMenuItem(lispSubMenu.Count + 1, "Generate Böschungen", "bs" + vbCr)
End If
End Sub
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

take a look at this http://discussion.autodesk.com/forums/thread.jspa?messageID=6199524飤

Patrick K Johnson
http:\\www.cadenhancement.com
Message 3 of 3
Anonymous
in reply to: Anonymous

I've watched this tutorial a few weeks ago and a few of my own .net applications are already working.

But with the code in my first post I have still some problems because I dont't know with classes I have to use. Maybe someone could help me with this

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