TheSwamp

Code Red => .NET => Topic started by: nobody on September 03, 2015, 12:13:57 AM

Title: Is there a trick to editor.Command()
Post by: nobody on September 03, 2015, 12:13:57 AM
Okay...so this is a pretty noobish question but I've avoided using ed.Command() forever simply because I have always got the error in the attached image. Can someone please clue me in to what reference I need to load and what "using" i should be using :) Thank you!

Title: Re: Is there a trick to editor.Command()
Post by: Jeff H on September 03, 2015, 12:18:12 AM
Means Editor Object does not contain a method named Command.
Your using older version or missing a reference, or  never created a extension method for it.
Title: Re: Is there a trick to editor.Command()
Post by: nobody on September 03, 2015, 12:22:52 AM
Means Editor Object does not contain a method named Command.
Your using older version or missing a reference, or  never created a extension method for it.

Right...need to know which reference :)

I thought maybe interop or interop common but guess those aren't it.
Title: Re: Is there a trick to editor.Command()
Post by: huiz on September 03, 2015, 12:43:46 AM
Code: [Select]

  internal const char ESC = '\x1B';                                                     
  internal const char RETURN = '\xD';                                                 

  internal static void SendCommandToCommandLine(string Command, bool Escape = true) {
    string EscapeString = string.Empty;
    if (Escape == true) { EscapeString = ESC.ToString() + ESC.ToString(); }
    Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(EscapeString + Command + RETURN, true, false, true);
  }

Title: Re: Is there a trick to editor.Command()
Post by: nobody on September 03, 2015, 12:54:24 AM
Code: [Select]

  internal const char ESC = '\x1B';                                                     
  internal const char RETURN = '\xD';                                                 

  internal static void SendCommandToCommandLine(string Command, bool Escape = true) {
    string EscapeString = string.Empty;
    if (Escape == true) { EscapeString = ESC.ToString() + ESC.ToString(); }
    Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(EscapeString + Command + RETURN, true, false, true);
  }


Thanks! I'll give that a shot :)
Title: Re: Is there a trick to editor.Command()
Post by: nobody on September 03, 2015, 01:13:14 AM
Is Editor.Command() perhaps not a 2014 item?
Title: Re: Is there a trick to editor.Command()
Post by: Jeff_M on September 03, 2015, 01:13:47 AM
The Editor Command() and CommandAsync() methods were introduced in the 2015 API. So if coding for, or targeting, an earlier release you won't have those methods available.
Title: Re: Is there a trick to editor.Command()
Post by: nobody on September 03, 2015, 01:22:31 AM
The Editor Command() and CommandAsync() methods were introduced in the 2015 API. So if coding for, or targeting, an earlier release you won't have those methods available.

Awe! That's it bahaha...Was driving me crazy :)

Thanks!!