- inputs for Aliases aren't recognised correctly

I’ve recently learnt that commands have a few handy prefixes that can be used for scripting such as;

And I’ve decided I’d like to start supporting these in some of the custom commands in my plugin.

If I run my custom commands using these I have three problems.

  1. - doesn’t change the mode of commands when run through an alias, it always returns Interactive
  2. If I use _- then the command also returns Interactive for the runmode, not scripted
  3. I don’t have a way of knowing when these prefixes are used inside the command

– cs

I am not able to repeat this. If the command name, in the macro, is preceded with a hyphen character, the command is run in scripted mode.

image

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  RhinoApp.WriteLine(mode.ToString());
  return Result.Success;
}

I cannot repeat this either.

Perhaps you can provide me a way to repeat?

– Dale

Hey @Dale, apologies I should have posted a sample originally.

Here is the code that causes me issues. The original command seems to work fine and I can’t replicate my _- issue with this, so I’ll have to figure out why that is. But below will replicate my issue with not returning Scripted for Aliases when I call ABug.

public class AliasBugPlugin : Rhino.PlugIns.PlugIn
{
    protected override LoadReturnCode OnLoad(ref string errorMessage)
    {
        CommandAliasList.Add(AliasBugCommand.CommandAlias, AliasBugCommand.CommandName);
        return base.OnLoad(ref errorMessage);
    }
}

public class AliasBugCommand : Command
{
    public const string CommandName = "AliasBug";
    public const string CommandAlias = "ABug";

    public override string EnglishName => CommandName;

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
        var lastCommand = Command.GetMostRecentCommands().Last();
        RhinoApp.WriteLine(mode.ToString());
        RhinoApp.WriteLine(lastCommand.Macro);
        return Result.Success;
    }
}

Hi @csykes,

I think your confusion is that you are trying to script the alias, when it’s the command macro that is scripted. See, my image above.

– Dale

Hey @dale,
Yes I am. I have a need for this. Is this not possible?

No, this is not possible.

– Dale