<?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: Pass arguments to CommandMethod in managed application extension in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4897982#M44990</link>
    <description>&lt;P&gt;Hello Craig,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for clarifying.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If a .Net command uses the "Editor.GetString" to request for the block name, you can provide that while invoking the command as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(command "MyInsertCommand" "Bolt").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[CommandMethod("MyInsertCommand")]
        public void MyMethod()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            PromptStringOptions pso = new PromptStringOptions("\nBlock name to insert : ");
            pso.AllowSpaces = true;
            PromptResult pr = ed.GetString(pso);
            if (pr.Status != PromptStatus.OK)
                return;
            String blockName = pr.StringResult;
            ed.WriteMessage(String.Format("{0}Block name inside .Net command : {1}", Environment.NewLine, blockName));
        }&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;Will this work in your case ?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;Balaji&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Mar 2014 11:45:59 GMT</pubDate>
    <dc:creator>Balaji_Ram</dc:creator>
    <dc:date>2014-03-20T11:45:59Z</dc:date>
    <item>
      <title>Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4890740#M44986</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Is a LISPFunction (LISP callable wrapper) still the acknowledged mechanism to pass arguments to a .NET plugin?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Leading on from this, if the answer is yes, how do I build an OEM application so that the same mechanism will work? Currently I get &lt;EM&gt;LISP command is not available&lt;/EM&gt; when I run it. (I'm actually running from a tool palette command &amp;nbsp;(MYCOMMAND "myarg"). There are no LISP scripts or code beyond the call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Craig&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2014 16:23:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4890740#M44986</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-17T16:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4892284#M44987</link>
      <description>&lt;P&gt;In AutoCAD OEM I had to implement an AutoLISP module that calls the LispFunction. The downside is the functions exposed in the lisp module (defun C:xxx) can't pass arguments.&lt;/P&gt;&lt;P&gt;Any suggestions how I can pass arguments to my command(s)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason I would like to do this is I want to have a set of tool palette items each with a different image and setting that is passed to a single command.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2014 12:07:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4892284#M44987</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-18T12:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4897838#M44988</link>
      <description>&lt;P&gt;Hello Craig,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please provide a broader picture of what you are trying with the tool palettes in AutoCAD OEM ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;Sorry, I do not understand what you mean by "h&lt;/SPAN&gt;&lt;SPAN style="font-size: 14px; line-height: 15px; color: #000000;"&gt;ave a set of tool palette items each with a different image and setting that is passed to a single command."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;If you can please provide more information, I can try it in AutoCAD OEM and let you know if there is a way to do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Balaji&lt;/P&gt;
&lt;DIV class="lia-quilt-row lia-quilt-row-forum-message-footer"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 20 Mar 2014 11:01:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4897838#M44988</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2014-03-20T11:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4897956#M44989</link>
      <description>&lt;P&gt;Hello Balaji,&lt;/P&gt;&lt;P&gt;We want the convenience of a tool palette to be able to insert blocks. We have many custom blocks, the number of which will change over time. We want to pre-process and post-process the insert but I have determined I cannot use events so I will use a dedicated command. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, I have a command for each block, which is inflexible. I would like to have a single command and pass the block name. This will allow us to change the number of blocks supported without the need to rebuild our OEM product.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Neither .NET command or LISP commands accept arguments. LISP route was investigated but eliminated. We would like to do this in .NET.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Craig&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 11:30:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4897956#M44989</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-20T11:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4897982#M44990</link>
      <description>&lt;P&gt;Hello Craig,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for clarifying.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If a .Net command uses the "Editor.GetString" to request for the block name, you can provide that while invoking the command as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(command "MyInsertCommand" "Bolt").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[CommandMethod("MyInsertCommand")]
        public void MyMethod()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            PromptStringOptions pso = new PromptStringOptions("\nBlock name to insert : ");
            pso.AllowSpaces = true;
            PromptResult pr = ed.GetString(pso);
            if (pr.Status != PromptStatus.OK)
                return;
            String blockName = pr.StringResult;
            ed.WriteMessage(String.Format("{0}Block name inside .Net command : {1}", Environment.NewLine, blockName));
        }&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;Will this work in your case ?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;Balaji&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 11:45:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4897982#M44990</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2014-03-20T11:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898064#M44991</link>
      <description>&lt;P&gt;Hi Balaji,&lt;/P&gt;&lt;P&gt;Not in this case. We don't want the user to be able to input the name or be given the opportunity to change it.&lt;/P&gt;&lt;P&gt;This is what I was hoping for ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="onecmd.jpg" border="0" title="onecmd.jpg" src="https://forums.autodesk.com/t5/image/serverpage/image-id/88124i0E4FECA1E1359839/image-size/original?v=mpbl-1&amp;amp;px=-1" align="center" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Craig&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 12:09:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898064#M44991</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-20T12:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898116#M44992</link>
      <description>&lt;P&gt;Hello Craig,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try the following command string in the tool properties :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;^C^C_MyInsertCommand;Bolt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This should provide the "Bolt" text as the input for the .Net command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Balaji&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 12:30:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898116#M44992</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2014-03-20T12:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898128#M44993</link>
      <description>&lt;P&gt;Hi Balaji,&lt;/P&gt;&lt;P&gt;Sorry, I don't understand how _MyInsertCommand can process "Bolt".&lt;/P&gt;&lt;P&gt;Can you explain what you would expect _MyInsertCommand should do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Craig&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 12:35:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898128#M44993</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-20T12:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898162#M44994</link>
      <description>&lt;P&gt;Hello Craig,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think we are not on the same page yet &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my understanding so far -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a single .Net command to which you need the block name to be provided as an input.&lt;/P&gt;
&lt;P&gt;This .Net command can pre-process, insert and post process after the block is inserted.&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 14px; line-height: 15px;"&gt;The .Net command is to be invoked from the Tool palette&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there anything that I missed ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the code snippet, "MyInsertCommand" represents a .Net command that inserts the block and the command string provides the block name as the input to the command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Balaji&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 12:49:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898162#M44994</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2014-03-20T12:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898280#M44995</link>
      <description>Yes. That is correct. What I don't understand is how MyInsertCommand gets access to command string without prompting for input.</description>
      <pubDate>Thu, 20 Mar 2014 13:33:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898280#M44995</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-20T13:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898666#M44996</link>
      <description>&lt;P&gt;Standard menu macro process, same as with any other AutoCAD command which requests input from the user.&amp;nbsp; Try it with other commands, like "-Layer;make;foo;" to see how it works.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 15:27:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898666#M44996</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2014-03-20T15:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898702#M44997</link>
      <description>So I have to include a request for input from the command line in my code for this to work?</description>
      <pubDate>Thu, 20 Mar 2014 15:39:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4898702#M44997</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-20T15:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: Pass arguments to CommandMethod in managed application extension</title>
      <link>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4899102#M44998</link>
      <description>&lt;P&gt;Ok I've just attended the macro guide to dummies course&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;This will give us the flexibility we need .&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;P&gt;Craig&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 17:29:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/pass-arguments-to-commandmethod-in-managed-application-extension/m-p/4899102#M44998</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-20T17:29:30Z</dc:date>
    </item>
  </channel>
</rss>

