.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: Create custom ribbon tab and buttons for Autocad mechanical 2011?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi there,
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.
Kind regards,
Irvin
Re: Create custom ribbon tab and buttons for Autocad mechanical 2011?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi there,
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.
Thanks,
Dman
Re: Create custom ribbon tab and buttons for Autocad mechanical 2011?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Irvin,
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 !
Tamer,
Regards
Re: Create custom ribbon tab and buttons for Autocad mechanical 2011?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
Re: Create custom ribbon tab and buttons for Autocad mechanical 2011?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I want to add ribbon using C++.... Tried a lot , but failed.
Please help with code.
Re: Create custom ribbon tab and buttons for Autocad mechanical 2011?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
kapil_CCTech wrote: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.
Re: Create custom ribbon tab and buttons for Autocad mechanical 2011?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
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";
pan3ribcombo.Items.Add(str1);
pan3ribcombo.Items.Add(str2);
in the EventHandler, I changed the code to:
string but = pan3ribcombo.Current as string;
acadApp.ShowAlertDialog(but);
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?
Thanks
Re: Create custom ribbon tab and buttons for Autocad mechanical 2011?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hy all,
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.
Thanks,
Alexandru
Re: Create custom ribbon tab and buttons for Autocad mechanical 2011?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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?


