Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have tried to create the Ribbon by AutoCAD startup. Previously, was created a CUIX file and enter CUIX detail to load through the xml. Now, trying to create a Ribbon dynamically through stratup while its chosen by the user to load.
Issue is: While, executing the netload command its works as expected. However, its not working by startup (by xml).
Here is my code for your reference.. Please, help...
Xml file content
<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage SchemaVersion="1.0" AutodeskProduct="AutoCAD" ProductType="Addins" Name="NewCADTools" AppVersion="0.0.0"
Description="NewCADTools" Author="Kite15"
AppNameSpace="a"
ProductCode="{95891FA5-7CD2-495E-A68D-138FF2475085}" UpgradeCode="{88989D32-522F-440F-85D8-0EB7EFD0BAD4}">
<Components>
<RuntimeRequirements OS="Win64" Platform="AutoCAD*" SeriesMin="R24.2" SeriesMax="R24.2" />
<ComponentEntry AppName="NewAutoCADTestTool" Version="1.0.0" ModuleName="./Contents/2023/NewAutoCADRibbon.dll" AppDescription="test." LoadOnAutoCADStartup="True">
</ComponentEntry>
</Components>
</ApplicationPackage>Extension Application initialization code:
public class NewAutoCADlugin : IExtensionApplication
{
void IExtensionApplication.Initialize()
{
try
{
#region Adding new toolButtons
NewAutoCADTools addAutoCADToolButton = new NewAutoCADTools();
addAutoCADToolButton.CreateRibbon();
#endregion
}
catch (System.Exception ex)
{
var error=ex.Message;
}
}
void IExtensionApplication.Terminate()
{
// Do plug-in application clean up here if required
// throw new NotImplementedException();
}
}
Code for Ribbon creation:
public void CreateRibbon()
{
RibbonControl ribbon = ComponentManager.Ribbon;
if (ribbon != null)
{
RibbonTab rtab = ribbon.FindTab(RibbonTabName);
if (rtab != null)
{
ribbon.Tabs.Remove(rtab);
}
rtab = new RibbonTab();
rtab.Title = RibbonTabTitle;
rtab.Id = RibbonTabId;
//Add the Tab
AddRibbonPanelContent(rtab);
}
}
Solved! Go to Solution.