Run Command to Export after GetMultiple

I want to select Multiple objects then export it to DXF.

After I get the Objects… the command seems to be stuck at Select Object. And When I want to run the command to export the selected object to a file. Here is the code:.

   protected override Result RunCommand(RhinoDoc doc, RunMode mode)
  {
     // Check the selected dot
     GetObject go = new GetObject();

     go.GroupSelect = true;
     go.SubObjectSelect = false;
     go.EnableClearObjectsOnEntry(false);
     go.EnableUnselectObjectsOnExit(false);
     go.DeselectAllBeforePostSelect = false;
     go.EnableSelPrevious(true);
     go.EnablePreSelect(true, false);
     go.EnablePressEnterWhenDonePrompt(false);

     go.SetCommandPrompt("Select objects and a label to export as .DXF:");

     GetResult result = go.GetMultiple(1,-1);

     if (go.CommandResult() != Rhino.Commands.Result.Success)
     {
        return go.CommandResult();
     }

     RhinoApp.WriteLine("Total Objects Selected: {0}", go.ObjectCount);

     string labelName = null;

     // Loop through all the objects to find Text
     for (int i = 0; i < go.ObjectCount; i++)
     {
        RhinoObject rhinoObject = go.Object(i).Object();
        
        if(rhinoObject.ObjectType == ObjectType.Annotation)
        {
           TextEntity textEntity = rhinoObject.Geometry as TextEntity;

           if (textEntity != null)
           {
              labelName = CleanString(textEntity.Text) +".dxf";
           }
        }
     }

     if(labelName == null)
     {
        return Rhino.Commands.Result.Failure;
     }

     String path = Path.GetDirectoryName(doc.Path);

     // Export the whole lot
     string command = string.Format("-_Export \"" + Path.GetDirectoryName(doc.Path) + @"\" + labelName + "\"  Scheme \"R12 Lines & Arcs\" Enter");
     // Export the selected curves
     RhinoApp.RunScript(command, true);

     return Result.Success;
  }

The Command only display “-_Export”

After selecting the objects, how do you get out from that command so that the next command can be executed?

http://developer.rhino3d.com/guides/rhinocommon/run_rhino_command_from_plugin/

Yes you are spot on dale. Thanks

I always forget to put :

[CommandStyle(Style.ScriptRunner)]