<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Editor's Command method in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5577953#M40627</link>
    <description>&lt;P&gt;Are you sure? It doesn't seem like either Mark or Undo are working...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public static void MarkPosition()&lt;BR /&gt;{&lt;BR /&gt;Utils.SetUndoMark(true);&lt;BR /&gt;ed.WriteMessage("Undo Mark Set");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/// &amp;lt;summary&amp;gt;&lt;BR /&gt;/// Method to step AutoCAD back to undo mark&lt;/P&gt;&lt;P&gt;/// &amp;lt;/summary&amp;gt;&lt;BR /&gt;public static void BigUndo()&lt;BR /&gt;{&lt;BR /&gt;Utils.SetUndoMark(false);&lt;BR /&gt;ed.WriteMessage("Undo to Previous Mark Complete");&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Thu, 09 Apr 2015 17:14:49 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-04-09T17:14:49Z</dc:date>
    <item>
      <title>Editor's Command method</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5574177#M40623</link>
      <description>&lt;P&gt;I'm trying to create a button that, when pressed, marks the position of the drawing. Right now the method looks like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[CommandMethod("MARKPOS", CommandFlags.Session)]&lt;BR /&gt;public void MarkPosition()&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ed.Command("UNDO", "M");&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I try and execute the method I get the error pictured below and cannot determine why.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG title="Capture.PNG" alt="Capture.PNG" border="0" src="https://forums.autodesk.com/t5/image/serverpage/image-id/162441iE4E82CE50A81E344/image-size/original?v=mpbl-1&amp;amp;px=-1" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;************** Exception Text **************&lt;BR /&gt;Autodesk.AutoCAD.Runtime.Exception: eInvalidInput&lt;BR /&gt;at Autodesk.AutoCAD.EditorInput.Editor.Command(Object[] parameter)&lt;BR /&gt;at AutoCAD_Adapter.MyCommands.MarkPosition() in c:\Users\nickg\Documents\All Code\autocad-adapter\IOAutoCADHandler\myCommands.cs:line 186&lt;BR /&gt;at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)&lt;BR /&gt;at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)&lt;BR /&gt;at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)&lt;BR /&gt;at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2015 16:55:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5574177#M40623</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-07T16:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: Editor's Command method</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5575015#M40624</link>
      <description>&lt;P&gt;Instead of using the editor to send command, try this&lt;/P&gt;
&lt;PRE&gt;Autodesk.AutoCAD.Internal.Utils.SetUndoMark(True)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2015 04:40:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5575015#M40624</guid>
      <dc:creator>Ajilal.Vijayan</dc:creator>
      <dc:date>2015-04-08T04:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Editor's Command method</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5577411#M40625</link>
      <description>&lt;P&gt;Alright, is there a similar way to undo back to the mark?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2015 13:17:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5577411#M40625</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-09T13:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Editor's Command method</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5577661#M40626</link>
      <description>&lt;P&gt;Yes, to undo back use this&lt;/P&gt;
&lt;PRE&gt;Autodesk.AutoCAD.Internal.Utils.SetUndoMark(False)&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Apr 2015 14:58:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5577661#M40626</guid>
      <dc:creator>Ajilal.Vijayan</dc:creator>
      <dc:date>2015-04-09T14:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Editor's Command method</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5577953#M40627</link>
      <description>&lt;P&gt;Are you sure? It doesn't seem like either Mark or Undo are working...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public static void MarkPosition()&lt;BR /&gt;{&lt;BR /&gt;Utils.SetUndoMark(true);&lt;BR /&gt;ed.WriteMessage("Undo Mark Set");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/// &amp;lt;summary&amp;gt;&lt;BR /&gt;/// Method to step AutoCAD back to undo mark&lt;/P&gt;&lt;P&gt;/// &amp;lt;/summary&amp;gt;&lt;BR /&gt;public static void BigUndo()&lt;BR /&gt;{&lt;BR /&gt;Utils.SetUndoMark(false);&lt;BR /&gt;ed.WriteMessage("Undo to Previous Mark Complete");&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2015 17:14:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5577953#M40627</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-09T17:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Editor's Command method</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5578512#M40628</link>
      <description>&lt;P&gt;works for me..&amp;nbsp; (the false settings doesn't trigger the undo event, just closes the undo set)&amp;nbsp; You just have to call undo after closing it?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2015 23:44:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-s-command-method/m-p/5578512#M40628</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-09T23:44:49Z</dc:date>
    </item>
  </channel>
</rss>

