# Problem with command's parameters in RhinoApp.RunScript() method

**URL:** <https://discourse.mcneel.com/t/problem-with-commands-parameters-in-rhinoapp-runscript-method/180909>\
**Category:** Rhino Developer\
**Tags:** windows\
**Created:** [April 25, 2024, 6:31pm UTC](https://discourse.mcneel.com/t/problem-with-commands-parameters-in-rhinoapp-runscript-method/180909 "2024-04-25T18:31:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gilles\_FOUCAULT](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/gilles_foucault/32/563656_2.png) [@Gilles\_FOUCAULT](https://discourse.mcneel.com/u/Gilles_FOUCAULT)\
**Post date:** [April 25, 2024, 6:31pm UTC](https://discourse.mcneel.com/t/problem-with-commands-parameters-in-rhinoapp-runscript-method/180909/1 "2024-04-25T18:31:54Z")

</div>

Hello,

In my C++ SDK plugin, the “Line” command with “0,0,0 10,10,0” as start/end coordinates parameters is called. The problem is that my plugin always skips parameters after “-\_Line”, as depicted in the screen capture below. I tested RhinoApp().RunScriptEx(doc\_sn, L"-\_Line 0,0,0 10,10,0", nullptr), RhinoApp().RunScript(doc\_sn, L"-\_Line 0,0,0 10,10,0"), RhinoApp().RunMenuScript(L"-\_Line 0,0,0 10,10,0"), without any improvements.

![Rhino8_MakeLine_10](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/4/4/f44493b803485a27cba6a7d8d56c47ec3be52a28.gif)

Here follows my C++ code:

```auto

CRhinoCommand::result CCommandMakeLine_10::RunCommand(const CRhinoCommandContext& context)
{
  // CCommandMakeLine_10::RunCommand() is called when the user
  // runs the "MakeLine_10".

    unsigned int doc_sn = context.Document()->RuntimeSerialNumber();
    RhinoApp().RunScriptEx(doc_sn, L"-_Line 0,0,0 10,10,0", nullptr);
    context.Document()->Redraw();

  return CRhinoCommand::success;
}

```

Could you help me to solve this problem ?

Thanks in advance.

Best regards

Gilles

---

<div class="post-metadata">

**Author:** ![menno](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/menno/32/770384_2.png) [@menno](https://discourse.mcneel.com/u/menno)\
**Post date:** [April 26, 2024, 9:36am UTC](https://discourse.mcneel.com/t/problem-with-commands-parameters-in-rhinoapp-runscript-method/180909/3 "2024-04-26T09:36:56Z")

</div>

Is your command a script-runner command? If not, you need to inherit from `CRhinoScriptCommand` instead of `CRhinoCommand`.

---

<div class="post-metadata">

**Author:** ![Gilles\_FOUCAULT](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/gilles_foucault/32/563656_2.png) [@Gilles\_FOUCAULT](https://discourse.mcneel.com/u/Gilles_FOUCAULT)\
**Post date:** [April 26, 2024, 2:55pm UTC](https://discourse.mcneel.com/t/problem-with-commands-parameters-in-rhinoapp-runscript-method/180909/4 "2024-04-26T14:55:27Z")

</div>

My command is a C++ plugin. It inherits from CRhinoUtilityPlugin.

It has been constructed using the Rhino SDK. In Visual Studio 2022: Menu File \> New Project \> Rhino 3D Plugin (C++ ) “Build plug-ins for Rhino using the C++ SDK”.

Here follows the header:

```auto
// MakeLine_10PlugIn.h : main header file for the MakeLine_10 plug-in.
//

#pragma once

// CMakeLine_10PlugIn
// See MakeLine_10PlugIn.cpp for the implementation of this class
//

class CMakeLine_10PlugIn : public CRhinoUtilityPlugIn
{
public:
  // CMakeLine_10PlugIn constructor. The constructor is called when the
  // plug-in is loaded and "thePlugIn" is constructed. Once the plug-in
  // is loaded, CMakeLine_10PlugIn::OnLoadPlugIn() is called. The
  // constructor should be simple and solid. Do anything that might fail in
  // CMakeLine_10PlugIn::OnLoadPlugIn().
  CMakeLine_10PlugIn();
  
  // CMakeLine_10PlugIn destructor. The destructor is called to destroy
  // "thePlugIn" when the plug-in is unloaded. Immediately before the
  // DLL is unloaded, CMakeLine_10PlugIn::OnUnloadPlugin() is called. Do
  // not do too much here. Be sure to clean up any memory you have allocated
  // with onmalloc(), onrealloc(), oncalloc(), or onstrdup().
  ~CMakeLine_10PlugIn() = default;

  // Required overrides
  
  // Plug-in name display string. This name is displayed by Rhino when
  // loading the plug-in, in the plug-in help menu, and in the Rhino
  // interface for managing plug-ins. 
  const wchar_t* PlugInName() const override;
  
  // Plug-in version display string. This name is displayed by Rhino
  // when loading the plug-in and in the Rhino interface for 
  // managing plug-ins.
  const wchar_t* PlugInVersion() const override;
  
  // Plug-in unique identifier. The identifier is used by Rhino for
  // managing plug-ins.
  GUID PlugInID() const override;
  
  // Additional overrides
  
  // Called after the plug-in is loaded and the constructor has been
  // run. This is a good place to perform any significant initialization,
  // license checking, and so on. This function must return TRUE for
  // the plug-in to continue to load.  
  BOOL OnLoadPlugIn() override;
  
  // Called one time when plug-in is about to be unloaded. By this time,
  // Rhino's mainframe window has been destroyed, and some of the SDK
  // managers have been deleted. There is also no active document or active
  // view at this time. Thus, you should only be manipulating your own objects.
  // or tools here.  
  void OnUnloadPlugIn() override;

private:
  ON_wString m_plugin_version;

  // TODO: Add additional class information here
};

// Return a reference to the one and only CMakeLine_10PlugIn object
CMakeLine_10PlugIn& MakeLine_10PlugIn();

```

---

<div class="post-metadata">

**Author:** ![menno](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/menno/32/770384_2.png) [@menno](https://discourse.mcneel.com/u/menno)\
**Post date:** [April 26, 2024, 3:12pm UTC](https://discourse.mcneel.com/t/problem-with-commands-parameters-in-rhinoapp-runscript-method/180909/5 "2024-04-26T15:12:52Z")

</div>

That all looks good, but you also have a command of which you showed the implementation earlier, and what I meant was the inheritance of that `CCommandMakeLine_10` command.

You should have something like this:

```auto
class CCommandMakeLine_10 : CRhinoScriptCommand // <-- inherit from CRhinoScriptCommand, not CRhinoCommand
{
  // command declaration and definition comes here
};

```

---

<div class="post-metadata">

**Author:** ![Gilles\_FOUCAULT](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/gilles_foucault/32/563656_2.png) [@Gilles\_FOUCAULT](https://discourse.mcneel.com/u/Gilles_FOUCAULT)\
**Post date:** [April 26, 2024, 3:59pm UTC](https://discourse.mcneel.com/t/problem-with-commands-parameters-in-rhinoapp-runscript-method/180909/6 "2024-04-26T15:59:15Z")

</div>

@menno : Thank you very much! It works.

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/685184_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [April 30, 2024, 9:51pm UTC](https://discourse.mcneel.com/t/problem-with-commands-parameters-in-rhinoapp-runscript-method/180909/7 "2024-04-30T21:51:42Z")

</div>

> **[Running Rhino Commands from Plugins](https://developer.rhino3d.com/guides/cpp/running-rhino-commands-from-plugins/)**
>
> This guide discusses the proper techniques to use when running a Rhino command from within the context of a C/C++ plugin command.
