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

How to Load CUI File (Ribbon Tabs) And Make Visible via .NET?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
VB_Autocad_guy
3690 Views, 5 Replies

How to Load CUI File (Ribbon Tabs) And Make Visible via .NET?

How do I Load CUI File (Ribbon Tabs) And Make Visible via .NET?

 

I know how to load a cui file, I know how to make a Ribbon... but how do I load a CUI file and then make the ribbon visible via code? 

 

.NET Code or Refernce to the correct objects and properties would sure help. 

5 REPLIES 5
Message 2 of 6
Balaji_Ram
in reply to: VB_Autocad_guy

Hello,

 

1) To load / unload a CUI file, you may use "acedCmd" using P/Invoke. Here is a sample code :

 

[DllImport("acad.exe", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl, EntryPoint = "acedCmd")]

private static extern int acedCmd(System.IntPtr vlist);

// ....


ResultBuffer rb = new ResultBuffer();
ResultBuffer rb = new ResultBuffer();

// RTSTR = 5005
rb.Add(new TypedValue(5005, "FILEDIA"));
rb.Add(new TypedValue(5005, "0"));
acedCmd(rb.UnmanagedObject);

string cuiFileName = cs.CUIFileBaseName;

//CUIUNLOAD
rb = new ResultBuffer();
rb.Add(new TypedValue(5005, "_CUIUNLOAD"));
rb.Add(new TypedValue(5005, cuiFileName));
acedCmd(rb.UnmanagedObject);

//CUILOAD
rb = new ResultBuffer();
rb.Add(new TypedValue(5005, "_CUILOAD"));
rb.Add(new TypedValue(5005, cuiFileName));
acedCmd(rb.UnmanagedObject);

//FILEDIA
rb = new ResultBuffer();
rb.Add(new TypedValue(5005, "FILEDIA"));
rb.Add(new TypedValue(5005, "1"));
acedCmd(rb.UnmanagedObject);

 

2)   To make a tab visible, you need to set the "ActiveTab" property of the Ribbon Control

 

Autodesk.Windows.RibbonControl ribControl = Autodesk.Windows.ComponentManager.Ribbon;
ribControl.ActiveTab = <Set the tab here>

 

Cheers,

 

Balaji

 

Developer Technical Services

Autodesk Developer Network

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 6
VB_Autocad_guy
in reply to: Balaji_Ram

Thank you for the response. 

I was able to get the cui loading working. 

 

My intent is to load the CUIX file and then enable the Panels & Tabs from the CUIX file.

I'm having a problem enabling them, even when the CUIX file is loaded. 

 

My Loop doesn't find the Ribbon tab when it's not visible in the collection. 

When I check the Tab and make it visible... then it's visible in the collection. 

 

I need a little direction here. 

 

SFR.jpg

 

 <CommandMethod("listrib")> _
Sub listrib()
        Dim i As Integer

        Dim ribcontrol As Autodesk.Windows.RibbonControl = Autodesk.Windows.ComponentManager.Ribbon
        Dim ribTab As Autodesk.Windows.RibbonTab

        For i = 0 To ribcontrol.Tabs.Count - 1
            With ribcontrol.Tabs
                ed.WriteMessage("Name: " & .Item(i).Name & " ID:" & .Item(i).Id & Environment.NewLine)
                If .Item(i).Name = "SFR Tab" Then
                    .Item(i).IsActive = True
                End If

            End With

        Next



    End Sub

 

Message 4 of 6
Balaji_Ram
in reply to: VB_Autocad_guy

Hi,

 

I have attached a sample project that loads a cuix file and then sets the tab as active. I have used the same code that you have shown for iterating through the tabs. It works ok for me.

 

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 5 of 6
VB_Autocad_guy
in reply to: Balaji_Ram

Hi,

 

I re-installed Autocad yesterday because it was giving me strange errors and the default profile became corrupted. 

This morning I tried your Example Solution and it worked seamlessly. 

 

Appreciate the Help. Problem solved. 

 

 

 

Message 6 of 6
dcassara
in reply to: VB_Autocad_guy


@VB_Autocad_guy wrote:

How do I Load CUI File (Ribbon Tabs) And Make Visible via .NET?

 

I know how to load a cui file, I know how to make a Ribbon... but how do I load a CUI file and then make the ribbon visible via code? 

 

.NET Code or Refernce to the correct objects and properties would sure help. 


 


@VB_Autocad_guy wrote:

How do I Load CUI File (Ribbon Tabs) And Make Visible via .NET?

 

I know how to load a cui file, I know how to make a Ribbon... but how do I load a CUI file and then make the ribbon visible via code? 

 

.NET Code or Refernce to the correct objects and properties would sure help. 



@VB_Autocad_guy wrote:

How do I Load CUI File (Ribbon Tabs) And Make Visible via .NET?

 

I know how to load a cui file, I know how to make a Ribbon... but how do I load a CUI file and then make the ribbon visible via code? 

 

.NET Code or Refernce to the correct objects and properties would sure help. 




open autocad 2013 and states that CUI files are found. how do retrieve CUIfiles to impport into autocad


@VB_Autocad_guy wrote:

How do I Load CUI File (Ribbon Tabs) And Make Visible via .NET?

 

I know how to load a cui file, I know how to make a Ribbon... but how do I load a CUI file and then make the ribbon visible via code? 

 

.NET Code or Refernce to the correct objects and properties would sure help. 



@VB_Autocad_guy wrote:

How do I Load CUI File (Ribbon Tabs) And Make Visible via .NET?

 

I know how to load a cui file, I know how to make a Ribbon... but how do I load a CUI file and then make the ribbon visible via code? 

 

.NET Code or Refernce to the correct objects and properties would sure help. 




 

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