.NET

Reply
Mentor
GeeHaa
Posts: 154
Registered: ‎04-14-2005
Message 1 of 10 (1,065 Views)
Accepted Solution

Autodesk.AutoCAD.Ribbon

1065 Views, 9 Replies
11-26-2013 09:31 AM

Hi

 

I am trying to associate F1 help to a ribbon button.

 

I found this article

 

http://adndevblog.typepad.com/autocad/2012/09/associating-f1-help-with-ribbon-button.html

 

I am using VB2010 express with AutoCAD 2013. Along with the usual acmgd.dll, acdbmgd.dll, accoremgd.dll, I am referencing AcCui.dll and AdWindows.dll

 

What I need to know is what reference I need to be able to see Autodesk.AutoCAD.Ribbon in intellisense.

 

Thanks In advance.

Hi,

 

I would suggest using the AutoLoader to deploy your application. The PackageContents.xml can be modified to associate F1 help topics.

http://adndevblog.typepad.com/autocad/2012/04/autoloaderf1-help-integration.html

 

 But if you need to do this from the CUI dialog, then it can be done by associating an extended help xaml file for your command.

 

You can find a sample extended help xaml file here :

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS1a9193826455f5ffba22e1113c6c30c0e-39dc.htm,topicNumber=d0e376084

 

To associate F1 help, you will need the line in the above post to be modified as 

 

<src:RibbonToolTip x:Key="MYEH_CMD_0002" HelpSource = "ToolTipDemo.chm" HelpTopic = "CreateLayer">

 

Unfortunately the HelpTopic does not get recognised although the chm opens on pressing F1.

For this we have a request logged with our engineering team.

 

Regards,

Balaji

 

 

Board Manager
StephenPreston
Posts: 400
Registered: ‎05-22-2006
Message 2 of 10 (1,044 Views)

Re: Autodesk.AutoCAD.Ribbon

11-26-2013 02:08 PM in reply to: GeeHaa

The Autodesk.AutoCAD.Ribbon namespace is contained within AcWindows.dll.

 

Cheers,

Stephen Preston
Autodesk Developer Network
Mentor
GeeHaa
Posts: 154
Registered: ‎04-14-2005
Message 3 of 10 (1,028 Views)

Re: Autodesk.AutoCAD.Ribbon

11-27-2013 12:16 PM in reply to: GeeHaa

Thanks very Much that did the trick. I tried to translate the C# into Vb.net But I'm getting the following error.

 

Unable to cast object of type 'F1_Help.AdskCommandHandler' to type 'System.Windows.Input.ICommand'.

 

Any Help would be much appreciated.

 

 

  <CommandMethod("CRB")> _
    Public Sub CRB()

        Dim ribCntrl As Autodesk.Windows.RibbonControl = Autodesk.AutoCAD.Ribbon.RibbonServices.RibbonPaletteSet.RibbonControl
        Dim ribTab As RibbonTab = New RibbonTab
        ribTab.Title = "F1 Help Test"
        ribTab.Id = "My_Tab_ID"
        ribCntrl.Tabs.Add(ribTab)

        Dim ribSourcePanel As Autodesk.Windows.RibbonPanelSource = New RibbonPanelSource
        ribSourcePanel.Title = "Controls"
        Dim ribPanel As RibbonPanel = New RibbonPanel
        ribPanel.Source = ribSourcePanel
        ribTab.Panels.Add(ribPanel)
        Dim ribToolTip As RibbonToolTip = New RibbonToolTip

        ribToolTip.Command = "My Command"
        ribToolTip.Title = "My Title"
        ribToolTip.Content = "My Content"
        ribToolTip.ExpandedContent = "my Expanded Content !"

        'enable f1 Help
        ribToolTip.IsHelpEnabled = True
        Dim ribRow1 As RibbonRowPanel = New RibbonRowPanel
        ribRow1.Tag = "Row1"

        Dim ribButton As RibbonButton = New RibbonButton
        ribButton.Text = "PLINE"
        ribButton.ShowText = True
        ribButton.CommandParameter = "\Xlb\Xlb_PLINE"
        ribButton.CommandHandler = New AdskCommandHandler
        ribButton.HelpSource = New System.Uri("C:\Contents\Sample.chm", UriKind.RelativeOrAbsolute)
        ribButton.HelpTopic = "Sanmple"
        ribButton.IsToolTipEnabled = True
        ribButton.ToolTip = ribToolTip
        ribSourcePanel.Items.Add(ribButton)
        ribTab.IsActive = True

    End Sub

End Class
Public Class AdskCommandHandler
    'Implements System.Windows.Input.ICommand
    Public Function CanExecute(ByVal parameter As Object) As Boolean
        Return True
    End Function
    Public Event CanExecuteChanged As EventHandler
    Public Sub Execute(ByVal parameter As Object)
        Dim ribBtn As Autodesk.Windows.RibbonButton = TryCast(parameter, Autodesk.Windows.RibbonButton)
        If ribBtn.CommandParameter.ToString <> "" Then
            Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(ribBtn.CommandParameter.ToString, True, False, True)
        End If
    End Sub

End Class

 

ADN Support Specialist
Balaji_Ram
Posts: 723
Registered: ‎03-21-2011
Message 4 of 10 (1,003 Views)

Re: Autodesk.AutoCAD.Ribbon

11-30-2013 01:30 PM in reply to: GeeHaa

Hi,

 

Can you please try this VB.Net code for the command handler class ?

 

Public Class AdskCommandHandler
    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 ribBtn As Autodesk.Windows.RibbonButton = TryCast(parameter, Autodesk.Windows.RibbonButton)
        If ribBtn.CommandParameter.ToString <> "" Then
            Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(ribBtn.CommandParameter.ToString, True, False, True)
        End If
    End Sub

End Class

 

Regards,



Balaji
Developer Technical Services
Autodesk Developer Network

Mentor
GeeHaa
Posts: 154
Registered: ‎04-14-2005
Message 5 of 10 (953 Views)

Re: Autodesk.AutoCAD.Ribbon

12-09-2013 07:37 AM in reply to: GeeHaa

Thanks that worked. It creates a new ribbon tab etc. and the chm file comes up when I hit F1 help. But I can't find the tab or panel in the CUI. and if I close AutoCAD and reopen It is gone. Do I need to somehow attach it to a workspace?

 

Thanks Again.

ADN Support Specialist
Balaji_Ram
Posts: 723
Registered: ‎03-21-2011
Message 6 of 10 (930 Views)

Re: Autodesk.AutoCAD.Ribbon

12-10-2013 01:51 AM in reply to: GeeHaa

Hi,

 

There are two different sets of API to work with ribbons in AutoCAD. The runtime ribbon API and the CUI API. The sample code that is being used here is the ribbon runtime API and the ribbon tabs created using it are not saved in the CUIx file.

 

When using the runtime ribbon API, it is needed to setup your command for load at AutoCAD startup. This is to ensure that those ribbon tabs get created everytime AutoCAD starts.

 

 

Regards,

Balaji

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Mentor
GeeHaa
Posts: 154
Registered: ‎04-14-2005
Message 7 of 10 (906 Views)

Re: Autodesk.AutoCAD.Ribbon

12-11-2013 04:21 AM in reply to: Balaji_Ram

Is there a way to associate F1 help to a button using the CUI API? I've been looking through the properties and I don't see anything like helpsource.

 

If I could do it without a program that would be fine too. At the end of the day what I need is to have a CUIx file where F1 Help for buttons is associated with a CHM file.

 

Thanks Again

ADN Support Specialist
Balaji_Ram
Posts: 723
Registered: ‎03-21-2011
Message 8 of 10 (895 Views)

Re: Autodesk.AutoCAD.Ribbon

12-11-2013 08:22 AM in reply to: GeeHaa

Hi,

 

I would suggest using the AutoLoader to deploy your application. The PackageContents.xml can be modified to associate F1 help topics.

http://adndevblog.typepad.com/autocad/2012/04/autoloaderf1-help-integration.html

 

 But if you need to do this from the CUI dialog, then it can be done by associating an extended help xaml file for your command.

 

You can find a sample extended help xaml file here :

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS1a91938...

 

To associate F1 help, you will need the line in the above post to be modified as 

 

<src:RibbonToolTip x:Key="MYEH_CMD_0002" HelpSource = "ToolTipDemo.chm" HelpTopic = "CreateLayer">

 

Unfortunately the HelpTopic does not get recognised although the chm opens on pressing F1.

For this we have a request logged with our engineering team.

 

Regards,

Balaji

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Mentor
GeeHaa
Posts: 154
Registered: ‎04-14-2005
Message 9 of 10 (886 Views)

Re: Autodesk.AutoCAD.Ribbon

12-11-2013 12:09 PM in reply to: GeeHaa

Thanks this is exactly what I needed Thank You!

Contributor
WolframKuss12
Posts: 13
Registered: ‎03-25-2014
Message 10 of 10 (176 Views)

Re: Autodesk.AutoCAD.Ribbon

08-21-2014 06:45 AM in reply to: Balaji_Ram

Balaji_Ram wrote:

 

 

Unfortunately the HelpTopic does not get recognised

 

 


Any news on this?

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.