<?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: Select Object Command Prompt in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3485102#M55238</link>
    <description>&lt;P&gt;You better use acedCmd P/Invoke function&lt;/P&gt;&lt;P&gt;Give this a try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;       &amp;lt;DllImport("acad.exe", BestFitMapping:=True, CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Auto)&amp;gt; _
        Private Shared Function acedCmd(ByVal vlist_in As System.IntPtr) As Integer
        End Function
        &amp;lt;CommandMethod("Cloud")&amp;gt; _
        Public Shared Sub TestCloud()
            Dim db As Database = HostApplicationServices.WorkingDatabase

            Dim doc As Document = acApp.DocumentManager.MdiActiveDocument

            Dim ed As Editor = doc.Editor

            Dim tr As Transaction = db.TransactionManager.StartTransaction()

            Using tr
                Try

                    ' Prompt for the polyline to revcloud

                    Dim peo As New PromptEntityOptions(vbLf &amp;amp; "Select first polyline:")

                    peo.SetRejectMessage(vbLf &amp;amp; "Select polyline only")

                    peo.AddAllowedClass(GetType(Polyline), True)

                    Dim per As PromptEntityResult = ed.GetEntity(peo)

                    If per.Status &amp;lt;&amp;gt; PromptStatus.OK Then

                        Return
                    End If

                    Dim fid As ObjectId = per.ObjectId

                    Dim obj1 As DBObject = tr.GetObject(fid, OpenMode.ForWrite)

                    acApp.SetSystemVariable("CMDECHO", 0)

                    Dim buf As New ResultBuffer()

                    buf.Add(New TypedValue(5005, "_REVCLOUD"))

                    buf.Add(New TypedValue(5005, "_O"))

                    buf.Add(New TypedValue(5006, fid))

                    buf.Add(New TypedValue(5005, "_N"))

                    acedCmd(buf.UnmanagedObject)

                    buf.Dispose()

                    acApp.SetSystemVariable("CMDECHO", 1)

                    tr.Commit()

                Catch ex As Autodesk.AutoCAD.Runtime.Exception

                    ed.WriteMessage(ex.Message + vbLf + ex.StackTrace)

                End Try

            End Using

        End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jun 2012 08:58:57 GMT</pubDate>
    <dc:creator>Hallex</dc:creator>
    <dc:date>2012-06-05T08:58:57Z</dc:date>
    <item>
      <title>Select Object Command Prompt</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3484914#M55237</link>
      <description>&lt;P&gt;I'm creating a VB.Net routine which will run the REVCLOUD command.&amp;nbsp; In my application I prompt the user to select a single polyline using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;EntRslt = acDoc.Editor.GetEntity(EntOpts)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then later I run the REVCLOUD command using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;acDoc.SendStringToExecute(&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;"_revcloud Object Poly No "&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;, &lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;False&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;, &lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;False&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;, &lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;True&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Where &lt;STRONG&gt;Poly&lt;/STRONG&gt; is the polyline I selected earlier.&amp;nbsp; Of course, the line above doesn't work since "Poly" is interpreted as a string.&amp;nbsp; But I would like to figure out how to pass my VB.Net selected Polyline into the REVCLOUD command.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Anyone have any advice on how I might do this?&amp;nbsp; The REVCLOUD command will not accept the "Previous" selection set so setting the Implied Selectoin does not work.&amp;nbsp; If my Polyline was the Last object in the database I could use the "Last" option, but it isn't.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Thanks in advance.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2012 04:29:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3484914#M55237</guid>
      <dc:creator>mathewkol</dc:creator>
      <dc:date>2012-06-05T04:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: Select Object Command Prompt</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3485102#M55238</link>
      <description>&lt;P&gt;You better use acedCmd P/Invoke function&lt;/P&gt;&lt;P&gt;Give this a try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;       &amp;lt;DllImport("acad.exe", BestFitMapping:=True, CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Auto)&amp;gt; _
        Private Shared Function acedCmd(ByVal vlist_in As System.IntPtr) As Integer
        End Function
        &amp;lt;CommandMethod("Cloud")&amp;gt; _
        Public Shared Sub TestCloud()
            Dim db As Database = HostApplicationServices.WorkingDatabase

            Dim doc As Document = acApp.DocumentManager.MdiActiveDocument

            Dim ed As Editor = doc.Editor

            Dim tr As Transaction = db.TransactionManager.StartTransaction()

            Using tr
                Try

                    ' Prompt for the polyline to revcloud

                    Dim peo As New PromptEntityOptions(vbLf &amp;amp; "Select first polyline:")

                    peo.SetRejectMessage(vbLf &amp;amp; "Select polyline only")

                    peo.AddAllowedClass(GetType(Polyline), True)

                    Dim per As PromptEntityResult = ed.GetEntity(peo)

                    If per.Status &amp;lt;&amp;gt; PromptStatus.OK Then

                        Return
                    End If

                    Dim fid As ObjectId = per.ObjectId

                    Dim obj1 As DBObject = tr.GetObject(fid, OpenMode.ForWrite)

                    acApp.SetSystemVariable("CMDECHO", 0)

                    Dim buf As New ResultBuffer()

                    buf.Add(New TypedValue(5005, "_REVCLOUD"))

                    buf.Add(New TypedValue(5005, "_O"))

                    buf.Add(New TypedValue(5006, fid))

                    buf.Add(New TypedValue(5005, "_N"))

                    acedCmd(buf.UnmanagedObject)

                    buf.Dispose()

                    acApp.SetSystemVariable("CMDECHO", 1)

                    tr.Commit()

                Catch ex As Autodesk.AutoCAD.Runtime.Exception

                    ed.WriteMessage(ex.Message + vbLf + ex.StackTrace)

                End Try

            End Using

        End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2012 08:58:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3485102#M55238</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-06-05T08:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Select Object Command Prompt</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3486132#M55239</link>
      <description>&lt;P&gt;I discovered&amp;nbsp;one more&amp;nbsp;method you may want to use,&lt;/P&gt;&lt;P&gt;check this as well, just change the arc sizes in the command string:&lt;/P&gt;&lt;PRE&gt;        &amp;lt;CommandMethod("Revc", CommandFlags.Modal Or CommandFlags.Session)&amp;gt; _
        Public Shared Sub RevCloudTest()
            Dim doc As Document = acApp.DocumentManager.MdiActiveDocument
            Dim ed As Editor = doc.Editor
            acApp.SetSystemVariable("osmode", 512)
            Dim pt As Point3d = ed.GetPoint(vbLf + "Pick a point on polyline: ").Value
            doc.SendStringToExecute("_REVCLOUD _A 0.1 0.3 _O " + pt.X.ToString + "," + pt.Y.ToString + ",0 _N ", True, False, False)
        End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#993300"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2012 18:06:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3486132#M55239</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-06-05T18:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Select Object Command Prompt</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3486158#M55240</link>
      <description>&lt;P&gt;Thank you very much for your reply.&amp;nbsp; I was able to get your first suggection to line:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume it has something to do with the TypedValue TypeCode 5006.&amp;nbsp; I assume 5005 is a string and 5006 is an ObjectID?&amp;nbsp; What would the code be for a double?&amp;nbsp; Is there a list of these codes somewhere?&amp;nbsp; I have looked and I've not found anythng useful.&lt;/P&gt;
&lt;PRE&gt;buf.Add(New TypedValue(5005, "_OFFSET"))
buf.Add(New TypedValue(5006, OffsetLength))
buf.Add(New TypedValue(5006, Pline.ObjectId))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Thanks again.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2012 18:20:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3486158#M55240</guid>
      <dc:creator>mathewkol</dc:creator>
      <dc:date>2012-06-05T18:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Select Object Command Prompt</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3486188#M55241</link>
      <description>&lt;P&gt;Ok, the offset length is easy, I just use the ToString option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But of course, in the Offset command I will need to specify a point as well.&amp;nbsp; 5006 does not work; I'm not sure which integer value to use here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2012 18:36:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3486188#M55241</guid>
      <dc:creator>mathewkol</dc:creator>
      <dc:date>2012-06-05T18:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select Object Command Prompt</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3486300#M55242</link>
      <description>&lt;P&gt;Here is some constants for ResultBuffer values:&lt;/P&gt;&lt;PRE&gt;		' Type of resbuf element
		' credit to Alexander Rivilis 
		Const RTNONE As Short = 5000
		' No result 
		Const RTREAL As Short = 5001
		' Real number 
		Const RTPOshort As Short = 5002
		' 2D poshort X and Y only 
		Const RTSHORT As Short = 5003
		' Short integer 
		Const RTANG As Short = 5004
		' Angle 
		Const RTSTR As Short = 5005
		' String 
		Const RTENAME As Short = 5006
		' Entity name 
		Const RTPICKS As Short = 5007
		' Pick set 
		Const RTORshort As Short = 5008
		' Orientation 
		Const RT3DPOshort As Short = 5009
		' 3D poshort - X, Y, and Z 
		Const RTLONG As Short = 5010
		' Long integer 
		Const RTVOID As Short = 5014
		' Blank symbol 
		Const RTLB As Short = 5016
		' list begin 
		Const RTLE As Short = 5017
		' list end 
		Const RTDOTE As Short = 5018
		' dotted pair 
		Const RTNIL As Short = 5019
		' nil 
		Const RTDXF0 As Short = 5020
		' DXF code 0 for ads_buildlist only 
		Const RTT As Short = 5021
		' T atom 
		Const RTRESBUF As Short = 5023
		' resbuf 
		Const RTMODELESS As Short = 5027
		' interrupted by modeless dialog 
		'
		' Error return code
		Const RTNORM As Short = 5100
		' Request succeeded 
		Const RTERROR As Short = -5001
		' Some other error 
		Const RTCAN As Short = -5002
		' User cancelled request -- Ctl-C 
		Const RTREJ As Short = -5003
		' AutoCAD rejected request -- invalid 
		Const RTFAIL As Short = -5004
		' Link failure -- Lisp probably died 
		Const RTKWORD As Short = -5005
		' Keyword returned from getxxx() routine 
		Const RTINPUTTRUNCATED As Short = -5008&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#008080"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2012 19:17:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3486300#M55242</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-06-05T19:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Select Object Command Prompt</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3486420#M55243</link>
      <description>&lt;P&gt;Thank you very much HALLEX, I was able to use your code to fix mine.&amp;nbsp; It all seems to work now.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2012 20:29:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3486420#M55243</guid>
      <dc:creator>mathewkol</dc:creator>
      <dc:date>2012-06-05T20:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select Object Command Prompt</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3486930#M55244</link>
      <description>&lt;P&gt;Glad I could help, Matt&lt;/P&gt;&lt;P&gt;Happy computing &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;&lt;FONT face="arial,helvetica,sans-serif" color="#800000"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2012 05:50:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-object-command-prompt/m-p/3486930#M55244</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-06-06T05:50:59Z</dc:date>
    </item>
  </channel>
</rss>

