.NET

Reply
Contributor
luisibad
Posts: 17
Registered: ‎03-15-2008
Message 1 of 5 (340 Views)
Accepted Solution

Help with Ribbon

340 Views, 4 Replies
12-01-2013 03:50 AM

Hi! I need help with this.

 

I've created my routines in VB.NET obviously with a lot help from this forum, I mean  following a lot of post, even I've created my panel ribbon and so far so good.

But now I would like to learn how to interact (enable) my ribbon button with my routine, because my ribbon button doesn't work for it. I was looking information about it, and I saw that I must use xlm code, and really I don't how to do it, because all information that I found is about C# code and my knowlege is about VB.NET

 

really I'll apreciate all help about it

try adding <space> or ";" or <enter> to the command 
RibBtnPoints.CommandParameter = "PUNTOS "

RibBtnPoints.CommandParameter = "PUNTOS;"
RibBtnPoints.CommandParameter = "PUNTOS" + vbCR

 

Look in youre CUI, the LINE command below contains a extra <space> 

Clipboard-2.png

ADN Support Specialist
Balaji_Ram
Posts: 701
Registered: ‎03-21-2011
Message 2 of 5 (284 Views)

Re: Help with Ribbon

12-23-2013 01:19 AM in reply to: luisibad

Hi,

 

Sorry for the delay.

 

Can you please explain what you mean by

"how to interact (enable) my ribbon button with my routine, because my ribbon button doesn't work for it" 

 

If you can share some sample code that you have along with screenshots to explain what you are trying, that will help.

 

If you want to show / hide the ribbon panels, this blog post can provide a sample code :

http://adndevblog.typepad.com/autocad/2012/07/modify-ribbon.html

 

 

Regards,

Balaji

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Contributor
luisibad
Posts: 17
Registered: ‎03-15-2008
Message 3 of 5 (262 Views)

Re: Help with Ribbon

12-26-2013 02:08 AM in reply to: Balaji_Ram

Hi! Thanks for answer.

 

I created my routine in VB.NET

 

Imports Autodesk.AutoCAD.Runtime

Imports Autodesk.AutoCAD.Windows

Imports System.Windows.Forms

 

<Assembly: CommandClass(GetType(frmImportPointsVB.ClsDrawPoints))>

 

Namespace frmImportPointsVB

   PublicClassClsDrawPoints

     'This is my command and through  of this I load a form

     <CommandMethod("PUNTOS", CommandFlags.Modal)>

     PublicSharedSub InitForm()

        Dim frm AsNewfrmImportPoints

        Dim Result AsDialogResult = Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(frm)

     EndSub

   EndClass

EndNamespace

 

I can load it without problems in AutoCAD and It works. As you can see it in the picture Captura1.

 

Later I have the next code to create the control ribbon:

 

PublicClassClsRibbon

ImplementsIExtensionApplication

 

  PublicSub Initialize() ImplementsIExtensionApplication.Initialize

      CreateRibbon()

  EndSub

 

  PublicSub Terminate() ImplementsIExtensionApplication.Terminate

  EndSub

 

  PrivateSub CreateRibbon()

    Dim RibCtrl AsRibbonControl = ComponentManager.Ribbon

    Dim RibTab AsNewRibbonTab()

    RibTab.Title = "IBAD_2014"

    RibTab.Id = "IBAD_2014"

        RibCtrl.Tabs.Add(RibTab)

    RibTab.IsActive = True

        AddContent(RibTab)

  EndSub

 

  PrivateSub AddContent(ByVal RibTab AsRibbonTab)

    Dim RibSourcePanel AsRibbonPanelSource = NewRibbonPanelSource()

    RibSourcePanel.Title = "Herramientas"

    Dim RibPanel AsNewRibbonPanel()

        RibPanel.Source = RibSourcePanel

        RibTab.Panels.Add(RibPanel)

    Dim ribToolTip AsRibbonToolTip = NewRibbonToolTip

    ribToolTip.Title = "My Title"

    ribToolTip.Content = "My Content"

    ribToolTip.ExpandedContent = "my Expanded Content !"

 

    ribToolTip.IsHelpEnabled = False

   'Boton Ribbon para el dibujo de los PUNTOS

    Dim RibBtnPoints AsRibbonButton = NewRibbonButton()

    RibBtnPoints.Text = "DIBUJAR PUNTOS"

    RibBtnPoints.CommandParameter = "PUNTOS"

    RibBtnPoints.ShowText = True

    RibBtnPoints.LargeImage = LoadImage(My.Resources.Resource1.In_Point_32px)

    RibBtnPoints.Orientation = Windows.Controls.Orientation.Vertical

    RibBtnPoints.ShowImage = True

    RibBtnPoints.Size = RibbonItemSize.Large

    RibBtnPoints.CommandHandler = NewAdskCommandHandler()

    RibBtnPoints.IsToolTipEnabled = True

       RibBtnPoints.ToolTip = ribToolTip

   'Botón Ribbon para el dibujo del PERFIL LONGITUDINAL

   Dim RibBtnPerfil AsRibbonButton = NewRibbonButton()

   RibBtnPerfil.Text = "DIBUJAR PERFIL"

   RibBtnPerfil.CommandParameter = "PERFILES"

   RibBtnPerfil.ShowText = True

   RibBtnPerfil.LargeImage = LoadImage(My.Resources.Resource1.Profile_32px)

   RibBtnPerfil.Orientation = Windows.Controls.Orientation.Vertical

   RibBtnPerfil.ShowImage = True

   RibBtnPerfil.Size = RibbonItemSize.Large

   RibBtnPerfil.CommandHandler = NewAdskCommandHandler()

  'Botón Ribbon para extraer attributos de los BLOQUES y exportarlos EXCEL

   Dim RibBtnExport AsRibbonButton = NewRibbonButton()

   RibBtnExport.Text = "EXPORTAR ATRIBUTOS"

   RibBtnExport.CommandParameter = "EXPORTAR_ATT"

   RibBtnExport.ShowText = True

   RibBtnExport.LargeImage = LoadImage(My.Resources.Resource1.Out_Point_32px)

   RibBtnExport.Orientation = Windows.Controls.Orientation.Vertical

   RibBtnExport.ShowImage = True

   RibBtnExport.Size = RibbonItemSize.Large

   RibBtnExport.CommandHandler = NewAdskCommandHandler()

      RibSourcePanel.Items.Add(RibBtnPoints)

   RibSourcePanel.Items.Add(NewRibbonSeparator)

      RibSourcePanel.Items.Add(RibBtnPerfil)

   RibSourcePanel.Items.Add(NewRibbonSeparator)

      RibSourcePanel.Items.Add(RibBtnExport)

 

 EndSub

 

 

PublicClassAdskCommandHandler

 Implements System.Windows.Input.ICommand

  PublicFunction CanExecute(parameter AsObject) AsBooleanImplements Windows.Input.ICommand.CanExecute

   ReturnTrue

  EndFunction

 

  PublicEvent CanExecuteChanged(sender AsObject, e AsEventArgs) Implements Windows.Input.ICommand.CanExecuteChanged

  PublicSub Execute(parameter AsObject) Implements Windows.Input.ICommand.Execute

   Dim RibBtn AsRibbonButton = TryCast(parameter, RibbonButton)

    If RibBtn IsNotNothingThen

       Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.

       SendStringToExecute(RibBtn.CommandParameter, True, False, True)

    EndIf

 

  EndSub

EndClass

 

And so far so good, because appear the ribbon in AutoCAD. As you can see it in the picture Captura2.

And my problem is in this part. When I click in the button doesn't work I mean doesn't load my form, It just appear in the command line the name of my command "PUNTOS". As you can see it in the picture Capture3.

 

I was reading a lot about it and I couldn't find some solution, I guess I should learn something  about XAML, and really I don't have experience with it.

 

I would appreciate any help about it. Thanks.

 

 

 

 

Mentor
SENL1362
Posts: 174
Registered: ‎07-20-2011
Message 4 of 5 (258 Views)

Re: Help with Ribbon

12-26-2013 02:21 AM in reply to: luisibad

try adding <space> or ";" or <enter> to the command 
RibBtnPoints.CommandParameter = "PUNTOS "

RibBtnPoints.CommandParameter = "PUNTOS;"
RibBtnPoints.CommandParameter = "PUNTOS" + vbCR

 

Look in youre CUI, the LINE command below contains a extra <space> 

Clipboard-2.png

Contributor
luisibad
Posts: 17
Registered: ‎03-15-2008
Message 5 of 5 (249 Views)

Re: Help with Ribbon

12-26-2013 02:51 AM in reply to: luisibad

Thanks you! it works with vbCr....

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

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