.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help with Ribbon

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
luisibad
699 Views, 4 Replies

Help with Ribbon

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

4 REPLIES 4
Message 2 of 5
Balaji_Ram
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

Message 3 of 5
luisibad
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.

 

 

 

 

Message 4 of 5
SENL1362
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

Message 5 of 5
luisibad
in reply to: luisibad

Thanks you! it works with vbCr....

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost