Message 1 of 13
Install toolbar CUI.NET API

Not applicable
08-28-2006
07:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am trying to add a new toolbar to Acad 2007 from a windows installation
package using the CUI .NET API. The idea is to execute it from a custom action.
By modifying the C# code in the documentation I have the following code,
Sub Main()
Dim csstring As String = "C:\Documents and Settings\UserX\Application Data\Autodesk\AutoCAD 2007\R17.0\enu\Support\acad.cui"
Dim cs As CustomizationSection
cs = New CustomizationSection(csstring)
Dim newTB As Toolbar = New Toolbar("MyToolbar", cs.MenuGroup)
newTB.ToolbarOrient = ToolbarOrient.floating
newTB.ToolbarVisible = ToolbarVisible.show
Dim tbBtn As ToolbarButton = New ToolbarButton(newTB, -1)
tbBtn.Name = "Pline"
tbBtn.MacroID = "ID_Pline"
For Each wk As Workspace In cs.Workspaces
Dim wkTb As WorkspaceToolbar = New WorkspaceToolbar(wk, newTB)
wk.WorkspaceToolbars.Add(wkTb)
wkTb.Display = 1
Next
cs.Save()
End Sub
But I get the following error on the cs = New CustomizationSection(csstring) line.
System.IO.FileNotFoundException was unhandled
Message="The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
Source="AcCustomize"
If I put the code into a command, NETLOAD the dll, and instead of
hardcoding the location of the acad.cui file I obtain it with the
application variable Application.GetSystemVariable("MENUNAME"),
the code works fine. But as the documentation says, the application
variable is not available to Stand-alone Applications, so I need to
get it to work with a hardcoded string.
The application MENUNAME variable returns EXACTLY the same value that I provide
in the hardcoded path (minus .cui), and I have also tried to use double
backslash in the path or move the file to c:\acad.cui but I still
get the same error.
Has anyone had the same problem or have any ideas on how to solve it ?
Thanks in advance
Julian
I am trying to add a new toolbar to Acad 2007 from a windows installation
package using the CUI .NET API. The idea is to execute it from a custom action.
By modifying the C# code in the documentation I have the following code,
Sub Main()
Dim csstring As String = "C:\Documents and Settings\UserX\Application Data\Autodesk\AutoCAD 2007\R17.0\enu\Support\acad.cui"
Dim cs As CustomizationSection
cs = New CustomizationSection(csstring)
Dim newTB As Toolbar = New Toolbar("MyToolbar", cs.MenuGroup)
newTB.ToolbarOrient = ToolbarOrient.floating
newTB.ToolbarVisible = ToolbarVisible.show
Dim tbBtn As ToolbarButton = New ToolbarButton(newTB, -1)
tbBtn.Name = "Pline"
tbBtn.MacroID = "ID_Pline"
For Each wk As Workspace In cs.Workspaces
Dim wkTb As WorkspaceToolbar = New WorkspaceToolbar(wk, newTB)
wk.WorkspaceToolbars.Add(wkTb)
wkTb.Display = 1
Next
cs.Save()
End Sub
But I get the following error on the cs = New CustomizationSection(csstring) line.
System.IO.FileNotFoundException was unhandled
Message="The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
Source="AcCustomize"
If I put the code into a command, NETLOAD the dll, and instead of
hardcoding the location of the acad.cui file I obtain it with the
application variable Application.GetSystemVariable("MENUNAME"),
the code works fine. But as the documentation says, the application
variable is not available to Stand-alone Applications, so I need to
get it to work with a hardcoded string.
The application MENUNAME variable returns EXACTLY the same value that I provide
in the hardcoded path (minus .cui), and I have also tried to use double
backslash in the path or move the file to c:\acad.cui but I still
get the same error.
Has anyone had the same problem or have any ideas on how to solve it ?
Thanks in advance
Julian