Skip to content

Define commands in Command Tab Box without toolbar #125

@andrMollo

Description

@andrMollo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions