<?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: Problem calling acedCmd in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4755701#M45913</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a VB conversion of Tony's RunCommand wrapper.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With VB, extension methods have to be defined a module. If the module isn't part of the same namespace, you have to import it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Imports EditorInputExtensionMethods&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    Module EditorInputExtensionMethods
 
       &amp;lt;System.Runtime.CompilerServices.Extension&amp;gt; _
       Public Function Command(editor As Editor, ParamArray args As Object()) As PromptStatus
           If editor Is Nothing Then
               Throw New ArgumentNullException("editor")
           End If
           Return runCommand(editor, args)
       End Function
 
       Dim runCommand As Func(Of Editor, Object(), PromptStatus) = GenerateRunCommand()
 
       Private Function GenerateRunCommand() As Func(Of Editor, Object(), PromptStatus)
           Dim method As MethodInfo = GetType(Editor).GetMethod( _
               "RunCommand", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.[Public])
           Dim instance As ParameterExpression = Expression.Parameter(GetType(Editor), "editor")
           Dim args As ParameterExpression = Expression.Parameter(GetType(Object()), "args")
           Return Expression.Lambda(Of Func(Of Editor, Object(), PromptStatus)) _
               (Expression.Call(instance, method, args), instance, args).Compile()
       End Function
 
   End Module&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2014 20:12:06 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2014-01-16T20:12:06Z</dc:date>
    <item>
      <title>Problem calling acedCmd</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4752787#M45910</link>
      <description>&lt;P&gt;I am using TT's CommandLine class in my project.&amp;nbsp;Initially, when I loaded the project in AutoCAD 2014&amp;nbsp;I had to change "acad.exe" to "accore.dll" and it worked fine and continues working fine&amp;nbsp;in my developing machine. &amp;nbsp;Now, I am having problems in some computers where the commandline class seems to be not working properly. It seems to me that I had come across some posts that talked about the differences in the function signature&amp;nbsp;for 32 and 64bit platforms, however now I can't find any information about it.&amp;nbsp; Can someone give me some help on this issue.&amp;nbsp; It will be really appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2014 17:20:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4752787#M45910</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2014-01-15T17:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem calling acedCmd</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4753331#M45911</link>
      <description>&lt;P&gt;There's no need to P/Invoke acedCmd() directly on recent releases of AutoCAD&lt;/P&gt;&lt;P&gt;thanks to the RunCommand wrapper (not sure what release it appeared in initially).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;acedCmd() doesn't support the use of managed selection sets, but RunCommand()&lt;/P&gt;&lt;P&gt;does (it handles that internally for you) and allows them to be passed as&amp;nbsp;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;arguments &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;where&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;a command is expecting a selection set.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See this post:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="https://forums.autodesk.com/t5/NET/Send-Command-Executes-after-exiting-command-method/td-p/3882929"&gt;http://forums.autodesk.com/t5/NET/Send-Command-Executes-after-exiting-command-method/td-p/3882929&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2014 21:34:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4753331#M45911</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2014-01-15T21:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Problem calling acedCmd</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4754567#M45912</link>
      <description>&lt;P&gt;DP thank you very much for your help, very appreciated.&amp;nbsp; Now, would it be to much to ask if there is, you have or have seen&amp;nbsp;a VB version.&amp;nbsp; I am using VS2010 Express and can not use&amp;nbsp;C# code.&amp;nbsp; Trying to Port it myself will make&amp;nbsp;the few hair left to fall out.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2014 13:37:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4754567#M45912</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2014-01-16T13:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: Problem calling acedCmd</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4755701#M45913</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a VB conversion of Tony's RunCommand wrapper.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With VB, extension methods have to be defined a module. If the module isn't part of the same namespace, you have to import it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Imports EditorInputExtensionMethods&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    Module EditorInputExtensionMethods
 
       &amp;lt;System.Runtime.CompilerServices.Extension&amp;gt; _
       Public Function Command(editor As Editor, ParamArray args As Object()) As PromptStatus
           If editor Is Nothing Then
               Throw New ArgumentNullException("editor")
           End If
           Return runCommand(editor, args)
       End Function
 
       Dim runCommand As Func(Of Editor, Object(), PromptStatus) = GenerateRunCommand()
 
       Private Function GenerateRunCommand() As Func(Of Editor, Object(), PromptStatus)
           Dim method As MethodInfo = GetType(Editor).GetMethod( _
               "RunCommand", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.[Public])
           Dim instance As ParameterExpression = Expression.Parameter(GetType(Editor), "editor")
           Dim args As ParameterExpression = Expression.Parameter(GetType(Object()), "args")
           Return Expression.Lambda(Of Func(Of Editor, Object(), PromptStatus)) _
               (Expression.Call(instance, method, args), instance, args).Compile()
       End Function
 
   End Module&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2014 20:12:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4755701#M45913</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2014-01-16T20:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problem calling acedCmd</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4755723#M45914</link>
      <description>I see that Giles has help you out (thanks Giles)</description>
      <pubDate>Thu, 16 Jan 2014 20:20:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4755723#M45914</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2014-01-16T20:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Problem calling acedCmd</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4762455#M45915</link>
      <description>&lt;P&gt;Thank you both for your help. I have marked both of your posts as solutions, since it is what I was looking for.&amp;nbsp; However, I have not been able to run or test this solution.&amp;nbsp; Since the moment I added the ExtensionMethod to my project, I am getting a error message on VS 2010 that says "No Source Available".&amp;nbsp; I am going to create a separate post about this issue.&amp;nbsp; I have never come across something like this, but it seems to be common.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2014 15:37:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4762455#M45915</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2014-01-20T15:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problem calling acedCmd</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4762815#M45916</link>
      <description>I was able to build the project and run the code, and your solution works very well, so thanks again.</description>
      <pubDate>Mon, 20 Jan 2014 18:19:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4762815#M45916</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2014-01-20T18:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem calling acedCmd</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4811757#M45917</link>
      <description>&lt;P&gt;I am having trouble with the EditorinputExtensionMethods.&amp;nbsp; I'm not sure what I'm doing wrong, but when I call the editor.Command(parameters), absolutely nothing happens.&amp;nbsp; I have access to the editor, because the editor.WriteMessage command works.&amp;nbsp; I am calling the editor.Command from a button click on a windows form in a module loaded into AutoCAD with NETLOAD.&amp;nbsp; Any insight would be greatly appreciated!&amp;nbsp; Code is inserted below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Imports System.Reflection
Imports System.Linq.Expressions
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Runtime

Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Data.SqlServerCe
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.ApplicationServices.DocumentExtension

Module EditorInputExtensionMethods

    &amp;lt;System.Runtime.CompilerServices.Extension&amp;gt; _
    Public Function Command(editor As Editor, ParamArray args As Object()) As PromptStatus
        If editor Is Nothing Then
            Throw New ArgumentNullException("editor")
        End If
        Return runCommand(editor, args)
    End Function

    Dim runCommand As Func(Of Editor, Object(), PromptStatus) = GenerateRunCommand()

    Private Function GenerateRunCommand() As Func(Of Editor, Object(), PromptStatus)
        Dim method As MethodInfo = GetType(Editor).GetMethod( _
            "RunCommand", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public)
        Dim instance As ParameterExpression = Expression.Parameter(GetType(Editor), "editor")
        'Dim instance As ParameterExpression = Expression.Parameter(GetType(Editor), "instance")
        Dim args As ParameterExpression = Expression.Parameter(GetType(Object()), "args")
        Return Expression.Lambda(Of Func(Of Editor, Object(), PromptStatus)) _
            (Expression.Call(instance, method, args), instance, args).Compile()
    End Function

End Module

Public Class frmMhsApp
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim doc As Document =
                  Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
        Dim ed As Editor = doc.Editor

        ed.Command("._line", New Point3d(0, 0, 0), New Point3d(5, 5, 0))

        ed.WriteMessage("Message Test")
    End Sub


&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2014 19:38:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4811757#M45917</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-02-12T19:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem calling acedCmd</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4817033#M45918</link>
      <description>&lt;P&gt;I found my issue!&amp;nbsp; I had to load my form as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(frmApp)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps someone else.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2014 21:07:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/4817033#M45918</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-02-14T21:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem calling acedCmd</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/5546011#M45919</link>
      <description>&lt;P&gt;I'm having the same issue as bruceamcd. Without a form it works fine.&lt;/P&gt;&lt;P&gt;But&amp;nbsp;using a form with either&amp;nbsp;Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog or ShowModelessDialog it doesn't.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Tony's Runcommand wrapper from Autocad 2014 x64.&lt;/P&gt;&lt;P&gt;FIBERWORLD is set to 1 as required.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts on what might cause this behavior are welcome. thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2015 07:59:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-calling-acedcmd/m-p/5546011#M45919</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-18T07:59:42Z</dc:date>
    </item>
  </channel>
</rss>

