Author Topic: Is there a trick to editor.Command()  (Read 2206 times)

0 Members and 1 Guest are viewing this topic.

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Is there a trick to editor.Command()
« 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!


Jeff H

  • Needs a day job
  • Posts: 6115
Re: Is there a trick to editor.Command()
« Reply #1 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.

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: Is there a trick to editor.Command()
« Reply #2 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.

huiz

  • Swamp Rat
  • Posts: 897
  • Certified Prof C3D
Re: Is there a trick to editor.Command()
« Reply #3 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);
  }

The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: Is there a trick to editor.Command()
« Reply #4 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 :)

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: Is there a trick to editor.Command()
« Reply #5 on: September 03, 2015, 01:13:14 AM »
Is Editor.Command() perhaps not a 2014 item?

Jeff_M

  • King Gator
  • Posts: 4040
  • C3D user & customizer
Re: Is there a trick to editor.Command()
« Reply #6 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.

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: Is there a trick to editor.Command()
« Reply #7 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!!