Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define commands in Command Tab Box without toolbar #125

Open
andrMollo opened this issue Feb 25, 2024 · 0 comments
Open

Define commands in Command Tab Box without toolbar #125

andrMollo opened this issue Feb 25, 2024 · 0 comments

Comments

@andrMollo
Copy link

Hi,
I'm using xCAD.NET 0.8 to create an add-in for SolidWorks 2022 SP5 in .NET Framework 4.8.

I would like to define my commands to show only in in the ribbon manu without any toolbar. Is it possible?

I use the following code for the enumeration:

public enum CwCommands_e
{
    [Title("Copy PDM")]
    [Description("Make a copy of the selected component and its drawing using PDM part number")]
    [Icon(typeof(Resources), nameof(Resources.SaveFile))]
    [CommandItemInfo(true, false, WorkspaceTypes_e.Part | WorkspaceTypes_e.Assembly, true, RibbonTabTextDisplay_e.TextBelow)]
    MakeIndepPdmE,
    [Title("Save PDM")]
    [Description("Save the selected component and its drawing using PDM part number")]
    [Icon(typeof(Resources), nameof(Resources.SaveFile))]
    [CommandItemInfo(true, false, WorkspaceTypes_e.Part | WorkspaceTypes_e.Assembly, true, RibbonTabTextDisplay_e.TextBelow)]
    SavePdmE,
    [Title("Copy")]
    [Description("Make a copy of the selected file and its drawing")]
    [Icon(typeof(Resources), nameof(Resources.SaveFile))]
    [CommandItemInfo(true, false, WorkspaceTypes_e.Part | WorkspaceTypes_e.Assembly, true, RibbonTabTextDisplay_e.TextBelow)]
    MakeIndepE,
    [Title("Save")]
    [Description("Save the selected component and its drawing")]
    [Icon(typeof(Resources), nameof(Resources.SaveFile))]
    [CommandItemInfo(true, false, WorkspaceTypes_e.Part | WorkspaceTypes_e.Assembly, true, RibbonTabTextDisplay_e.TextBelow)]
    SaveE,
    [Title("Set author")]
    [Description("Write the component author in the custom properties")]
    [Icon(typeof(Resources), nameof(Resources.SetAuthor))]
    [CommandItemInfo(true, false, WorkspaceTypes_e.Part | WorkspaceTypes_e.Assembly, true, RibbonTabTextDisplay_e.TextBelow)]
    SetAuthorE,
    [Title("Export file")]
    [Description("Export the current file in different formats")]
    [Icon(typeof(Resources), nameof(Resources.ExportFile))]
    [CommandItemInfo(true, false, WorkspaceTypes_e.All, true, RibbonTabTextDisplay_e.TextBelow)]
    ExportFileE,
    [Title("Export print file")]
    [Description("Export and print the current file in different formats")]
    [Icon(typeof(Resources), nameof(Resources.ExportFile))]
    [CommandItemInfo(true, false, WorkspaceTypes_e.All, true, RibbonTabTextDisplay_e.TextBelow)]
    ExportFilePrintE,
    [Title("Export assembly")]
    [Description("Export the current assembly and its components")]
    [Icon(typeof(Resources), nameof(Resources.ExportAssy))]
    [CommandItemInfo(true, false, WorkspaceTypes_e.Assembly, true, RibbonTabTextDisplay_e.TextBelow)]
    ExportAssemblyE,
    [Title("Print drawing")]
    [Description("Print all the sheet of the active drawing")]
    [Icon(typeof(Resources), nameof(Resources.FastPrint))]
    [CommandItemInfo(true, false, WorkspaceTypes_e.Drawing, true, RibbonTabTextDisplay_e.TextBelow)]
    FastPrintE,
    [Title("Print sheet")]
    [Description("Print the current sheet")]
    [Icon(typeof(Resources), nameof(Resources.FastPrintSheet))]
    [CommandItemInfo(true, false, WorkspaceTypes_e.Drawing, true, RibbonTabTextDisplay_e.TextBelow)]
    FastPrintSheetE,
    [Title("Update sheet format")]
    [Description("Update sheet format for all the sheet of the active document")]
    [Icon(typeof(Resources), nameof(Resources.ChangeFormat))]
    [CommandItemInfo(true, false, WorkspaceTypes_e.Drawing, true, RibbonTabTextDisplay_e.TextBelow)]
    UpdateFormatE,
    [Title("Write quantity")]
    [Description("Write the quantity custom property in all components of the open assembly")]
    [Icon(typeof(Resources), nameof(Resources.WriteQuantity))]
    [CommandItemInfo(true, false, WorkspaceTypes_e.Assembly, true, RibbonTabTextDisplay_e.TextBelow)]
    WriteQuantityE,
}

If all the command have hasToolbar set to false no Command Tab box is created; if one of them has it set to true then the ribbon tab is created correctly with all the commands.

Am I missing something?

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant