Hiding a plugin command


(Alexander Schiftner) #1

Hi all,

is there a way to create a hidden plugin command, i.e. a command that does not show up in auto-completion?

Cheers, Alex


(Menno Deij - van Rijswijk) #2

In RhinoCommon, use the CommandStyle attribute.

[CommandStyle(Style.Hidden)]
public class MyCommand :  Command
{
}

For C++ check the base class constructor:

  /*
  Description:
    For each class derived from CRhinoCommand, there is only a single
    static instance that exists in the .CPP file where the class is
    defined.  No other instances of a class derived from CRhinoCommand
    should ever be created.
  Paremeters:
    bTransparent - [in] true if command is transparent and can be run
                   inside of other commands.
    bDoNotRepeat - [in] true if command should not be repeated.
    pPlugIn - [in] if command is part of a plug-in, the plug-in pointer must
        be passed here.  (This is automatically handled by the plug-in
        wizard.)
    bTestCommand - [in] true if command is a "test" or debugging tool
        that should not be part of the commercial release.
  */
  CRhinoCommand( 
    BOOL bTransparent = false,
    BOOL bDoNotRepeat = false,
    const CRhinoPlugIn* pPlugIn = NULL,
    BOOL bTestCommand = false
    );

You want to set bTestCommand to true.


#3

for vb.net it works like this: ::

 <System.Runtime.InteropServices.Guid("00000000000-000000-000000000"), Rhino.Commands.CommandStyle(Style.Hidden)>  

for multiple usages as in Scriptrunner you can do:

 Rhino.Commands.CommandStyle(Style.ScriptRunner or Style.Hidden)

(Steve Baer) #4

Just a note, don’t use an empty Guid as an attribute for your command. I’m sure this sample was just for illustrative purposes :smile:


(Alexander Schiftner) #5

It works, great, many thanks for your help, I had read the documentation but it was not apparent to me that a test command would be hidden from command completion.