Use Same Tab with Different Plugins

Use Same Tab with Different Plugins

Anonymous
Not applicable
1,800 Views
4 Replies
Message 1 of 5

Use Same Tab with Different Plugins

Anonymous
Not applicable

I have two Command Handler Plugins that I want to share the same Custom Tab.  They are two different DLLs.  Is this possible or do the two have to be merged into one?

 

Thanks,

Joe

0 Likes
Accepted solutions (1)
1,801 Views
4 Replies
Replies (4)
Message 2 of 5

susan_tate
Autodesk
Autodesk

Hi Joe,

 

This is a bit of trick we added for internal use in the 2016 release of Navisworks so there is nothing in the official API relating to it.

 

Create a ribbon layout file for one of the plugins and use the command Ids as you normally would for that plugin's commands. Add another set of buttons for the commands in the other plugin, but for each command use the command Id prefixed with "(@nw)PluginName.DeveloperId." .

 

For example, if you have defined a plugin with a command as follows in the command plugin attributes:

 

[Plugin("JoeCommandPlugin", "JoeDevInc")]

[Command("JoesFirstCommand", LoadForCanExecute = true)]

 

You would reference this in the ribbon layout for another plugin as:

(@nw)JoeCommandPlugin.JoeDevInc.JoesFirstCommand

 

Hope that helps! Note that this is only available with NW 2016.

 

Regards, Susan



Susan Tate

Principal Engineer

0 Likes
Message 3 of 5

Anonymous
Not applicable
Thanks for the reply! I'll give this a try later on today. We only need this for 2016 and beyond anyway, so it's fine that it doesn't work before 2016.
0 Likes
Message 4 of 5

Anonymous
Not applicable

Ok, I can get the command to fire in the correct plugin, but I can't get the icon to display in the ribbon.  Here's my XAML file:

 

<?xml version="1.0" encoding="utf-8" ?>
<RibbonControl
    x:Uid="SectionTransporter" xmlns="clr-namespace:Autodesk.Windows;assembly=AdWindows"
    xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:adwi="clr-namespace:Autodesk.Internal.Windows;assembly=AdWindows"
    xmlns:system="clr-namespace:System;assembly=mscorlib"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Autodesk.Navisworks.Gui.Roamer.AIRLook;assembly=navisworks.gui.roamer">

    <RibbonTab Id="PclTab">
        <RibbonPanel x:Uid="SectionTransporterPanel">
	    <RibbonPanelSource x:Uid="SectionTransporterPanelSrc" Title="SectionTransporter">
				<local:NWRibbonButton x:Uid="BtSt" Id="BtSt" Size="Large" ShowText="False" Orientation="Horizontal"/>
            </RibbonPanelSource>
        </RibbonPanel>
        <RibbonPanel x:Uid="NWFixUnitsPanel">
	    <RibbonPanelSource x:Uid="NWFixUnitsPanelSrc" Title="Units">
				<local:NWRibbonButton x:Uid="(@nw)NWFixUnits.ADSK.FixUnits" Id="(@nw)NWFixUnits.ADSK.FixUnits" Size="Large" ShowText="True" Orientation="Vertical"/>
            </RibbonPanelSource>
        </RibbonPanel>
    </RibbonTab>
</RibbonControl>

and here's my PlugIn Attributes:

    [RibbonLayout("NWFixUnits.xaml")]
    [RibbonTab("PclTab", DisplayName = "PCL-Units")]
    [Plugin("NWFixUnits", "ADSK", DisplayName = "NWFixUnits", ToolTip = "Fix Merged Model Units")]
    [Command("FixUnits", CanToggle = false, DisplayName = "Fix Units", LargeIcon = "Icon_NW-FixUnits-32.png", ToolTip = "Fix Merged Model Units")]

The XAML file is from a plugin called "SectionTransporter" so it's named for that.

 

When I had both ribbons, the icon displayed.  I put the icon in both sub-folders but it won't display.

 

0 Likes
Message 5 of 5

susan_tate
Autodesk
Autodesk
Accepted solution

Hi again,

 

I think you'll need to define the icon in the ribbon xaml in this case, using the path that is appropriate for your plugins:

 

	    <RibbonPanelSource x:Uid="NWFixUnitsPanelSrc" Title="Units">
				<local:NWRibbonButton x:Uid="(@nw)NWFixUnits.ADSK.FixUnits" 
Id="(@nw)NWFixUnits.ADSK.FixUnits"
Size="Large"
  Image="pack://siteOfOrigin:,,,/Images/YourSmallImage_16.png"
LargeImage="pack://siteOfOrigin:,,,/Images/YourLargeImage_32.png"
ShowText="True"
Orientation="Vertical"/> </RibbonPanelSource>

HTH



Susan Tate

Principal Engineer