Are you using c# or VB.NET???
If you are using vb.net replace the RibbonCommandhandler class with this code:
I looked a the converted VB.net code in this thread but there are some strange things in it.
Public Class RibbonCommandHandler Implements System.Windows.Input.ICommand Public Function CanExecute(parameter As Object) As Boolean Return True End Function Public Event CanExecuteChanged As EventHandler Public Sub Execute(parameter As Object) Dim doc As Document = acadApp.DocumentManager.MdiActiveDocument If TypeOf parameter Is RibbonButton Then Dim button As RibbonButton = TryCast(parameter, RibbonButton) doc.Editor.WriteMessage(vbLf & "RibbonButton Executed: " + button.Text + vbLf) End If End Sub End Class
It's correct you get a warning an CanExecuteChanged. It's nessecery when you use
System.Windows.Input.ICommand but should compile.
Sorry forgot to say I was using your script as is, just changed the references to pull up the proper DLL's. So its C#.
Though I can't get anything to load into Autocad so figuring that error, or warning I should say I was getting was because of that.
i'm trying actually to create a custom ribbon for autocad mechanical 2010. I saw you exemple and I run it in visual studio 2010 with a debug configuration, as a result, there is no error and it seems everything is ok.. but after that autocad's opened I can not see the ribbon ! did i miss something ? btw i tryed a .net version and it also returns the same result !
Public Class RibbonCommandHandler Implements System.Windows.Input.ICommand Public Function CanExecute(ByVal parameter As Object) As Boolean Implements System.Windows.Input.ICommand.CanExecute Return True End Function Public Event CanExecuteChanged(ByVal sender As Object, ByVal e As System.EventArgs) Implements System.Windows.Input.ICommand.CanExecuteChanged Public Sub Execute(ByVal parameter As Object) Implements System.Windows.Input.ICommand.Execute Dim doc As Document = Application.DocumentManager.MdiActiveDocument If TypeOf parameter Is RibbonButton Then Dim button As RibbonButton = TryCast(parameter, RibbonButton) doc.Editor.WriteMessage(vbLf & "RibbonButton Executed: " + button.Text & vbLf) End If End Sub End Class
my RibbonCommandHandler. Don't know why I need to write like this: Public Function CanExecute(ByVal parameter As Object) As Boolean Implements System.Windows.Input.ICommand.CanExecute
but it seems work.
I am using vb.next express 2008.
I want to add ribbon using C++.... Tried a lot , but failed.
Please help with code.
This is the .NET forum. You might want to try the ObjectArx (C++) forum.
I tried to modify the code, so I added a few strings to one of the combo-boxes instead of RibbonButtons, with a code like this:
String str1 = "String1";
String str2 = "String2";
in the EventHandler, I changed the code to:
string but = pan3ribcombo.Current as string;
But the texts are not shown in the Combo-box and they are blank. When I change the current item, ShowAlertDialog shows the right text.
How I can change it to have a Combo-box of texts?
Can anyone to post a short example with a custom riboon tab created with Visual Studio for AutoCAD Map 3D 2013.
The current exeple is good but when i tried to compile it for AutoCAD Map 3D i don't know what are the namespaces to validate the code.
It will be helpfully if someone can specifie what are the namespaces for creating a riboon tab for AutoCAD Map 3D 2013.
I too would like an example of adding items to the RibbonCombo, as I would like them to behave like Window Forms comboboxes, if that is possible?