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.
Solved! Go to Solution.
Solved by Balaji_Ram. Go to Solution.
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
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.
<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
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.
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.
@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.