<?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: Stop &amp;quot;sendcommand&amp;quot; to press Enter in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12805870#M604</link>
    <description>&lt;P&gt;I didn't test your code, but Cr stands for Carriage Return. It just makes the cursor move to position 1 on the current line. The {Enter} key does a Line Feed, moving the cursor to the next line. So you either need to use vbCrLf or vbLf.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, when you Dim variables on the same line, you have to specify the type for each variable. If you don't, the Variant data type is used. In your code above DimPx is a Variant and DimPy is a string. For both of them to be a string you would use:&lt;/P&gt;
&lt;P&gt;Dim DimPx As String, Dim DimPy As String&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2024 19:23:23 GMT</pubDate>
    <dc:creator>Ed__Jobe</dc:creator>
    <dc:date>2024-05-29T19:23:23Z</dc:date>
    <item>
      <title>Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12805510#M603</link>
      <description>&lt;P&gt;In this macro I want to add Diameter Dimension at every circle in the drawing. In each circle it waits for user to press enter at the end and it can't be solved with "vbCr"!&lt;/P&gt;&lt;P&gt;How can I stop it to wait for enter?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub CM()
Dim ent As AcadEntity
Dim FullCircle As AcadCircle
Dim CenterPx, CenterPy As String
Dim DimPx, DimPy As String

  For Each ent In ThisDrawing.ModelSpace
      If TypeOf ent Is AcadCircle Then
      Set FullCircle = ent 

      ThisDrawing.Application.Update
      ZoomAll
      DimPx = CStr(FullCircle.Center(0) + FullCircle.Radius)
      DimPy = CStr(FullCircle.Center(1) + FullCircle.Radius)
      ThisDrawing.SendCommand "_AMPOWERDIM_DIA" &amp;amp; vbCr &amp;amp; CenterPx &amp;amp; "," &amp;amp; CenterPy &amp;amp; vbCr &amp;amp; DimPx &amp;amp; "," &amp;amp; DimPy &amp;amp; vbCr &amp;amp; vbCr

      End If
    Next
    
  End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 16:49:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12805510#M603</guid>
      <dc:creator>abbas.baghernezhad</dc:creator>
      <dc:date>2024-05-29T16:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12805870#M604</link>
      <description>&lt;P&gt;I didn't test your code, but Cr stands for Carriage Return. It just makes the cursor move to position 1 on the current line. The {Enter} key does a Line Feed, moving the cursor to the next line. So you either need to use vbCrLf or vbLf.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, when you Dim variables on the same line, you have to specify the type for each variable. If you don't, the Variant data type is used. In your code above DimPx is a Variant and DimPy is a string. For both of them to be a string you would use:&lt;/P&gt;
&lt;P&gt;Dim DimPx As String, Dim DimPy As String&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 19:23:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12805870#M604</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2024-05-29T19:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12806071#M605</link>
      <description>&lt;P&gt;Thank You.&lt;/P&gt;&lt;P&gt;I learned new things.&lt;/P&gt;&lt;P&gt;But it didn't work. I guess it is because it needs to press enter on cursor , not on the command line. So How can I press enter?&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 21:07:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12806071#M605</guid>
      <dc:creator>abbas.baghernezhad</dc:creator>
      <dc:date>2024-05-29T21:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12808296#M606</link>
      <description>&lt;P&gt;It looks like the AMPOWER command you are trying to use belongs to acad mech, I assume. I don't have that installed, so I can't help you further.&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2024 19:14:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12808296#M606</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2024-05-30T19:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12808648#M607</link>
      <description>&lt;P&gt;we can use "DIMDIAMETER" instead. There is No difference!&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2024 22:24:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12808648#M607</guid>
      <dc:creator>abbas.baghernezhad</dc:creator>
      <dc:date>2024-05-30T22:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12823119#M608</link>
      <description>&lt;P&gt;I don't see in your code where you set CenterPx and CenterPy. Therefore, you are probably getting an "invalid point" error and the second point is being accepted as the first point. So it's still waiting for you to enter a point.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 14:07:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12823119#M608</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2024-06-06T14:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12824633#M609</link>
      <description>&lt;P&gt;here is the Whole code, It still has the problem.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub CM()
Dim ent As AcadEntity
Dim FullCircle As AcadCircle
Dim CenterPx, CenterPy As String
Dim DimPx, DimPy As String

  For Each ent In ThisDrawing.ModelSpace
      If TypeOf ent Is AcadCircle Then
      Set FullCircle = ent
  
      CenterPx = CStr(FullCircle.Center(0))
      CenterPy = CStr(FullCircle.Center(1) + FullCircle.Radius)
      ThisDrawing.SendCommand "_CM" &amp;amp; vbCr &amp;amp; CenterPx &amp;amp; "," &amp;amp; CenterPy &amp;amp; vbCr &amp;amp; vbCr
      ThisDrawing.Application.Update
      ZoomAll
      DimPx = CStr(FullCircle.Center(0) + FullCircle.Radius)
      DimPy = CStr(FullCircle.Center(1) + FullCircle.Radius)
      ThisDrawing.SendCommand "_AMPOWERDIM_DIA" &amp;amp; vbCr &amp;amp; CenterPx &amp;amp; "," &amp;amp; CenterPy &amp;amp; vbCr &amp;amp; DimPx &amp;amp; "," &amp;amp; DimPy &amp;amp; vbCr &amp;amp; vbCr

      End If
    Next
    
  End Sub
​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 05:45:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12824633#M609</guid>
      <dc:creator>abbas.baghernezhad</dc:creator>
      <dc:date>2024-06-07T05:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12824973#M610</link>
      <description>&lt;LI-CODE lang="general"&gt;Sub CM()
Dim ent As AcadEntity
Dim FullCircle As AcadCircle
Dim CenterPx, CenterPy As String
Dim DimPx, DimPy As String

  For Each ent In ThisDrawing.ModelSpace
      If TypeOf ent Is AcadCircle Then
      Set FullCircle = ent

      ThisDrawing.Application.Update
      ZoomAll
      DimPx = CStr(FullCircle.Center(0) + FullCircle.Radius)
      DimPy = CStr(FullCircle.Center(1) + FullCircle.Radius)
      ThisDrawing.SendCommand "_DIMDIAMETER" &amp;amp; vbCr
ThisDrawing.SendCommand CenterPx &amp;amp; "," &amp;amp; CenterPy &amp;amp; vbCr &amp;amp; DimPx &amp;amp; "," &amp;amp; DimPy &amp;amp; vbCr &amp;amp; vbCr
      End If
    Next
    
  End Sub&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 07 Jun 2024 09:10:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12824973#M610</guid>
      <dc:creator>baksconstructor</dc:creator>
      <dc:date>2024-06-07T09:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12825660#M611</link>
      <description>&lt;P&gt;Have you tried setting a breakpoint and debugging? When using SendCommand it is especially important to monitor the command line and sequence of events.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your first use of SendCommand calls _CM. This is the same as your sub's name and also the shortcut for the CENTERMARK command. This use is amibguous. I would rename your sub to remove ambiguity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Although the signature for the DIM statement show the As keyword as optional, note what help says about leaving out the type declaration:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="T"&gt;&lt;FONT color="#0000FF"&gt;If you don't specify a data type or object type, and there is no &lt;STRONG&gt;Def&lt;/STRONG&gt;&lt;I&gt;type&lt;/I&gt; statement in the module, the variable is &lt;STRONG&gt;Variant&lt;/STRONG&gt; by default.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="T"&gt;Therefore, CenterPx and DimPx are variants. Just fyi.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 14:53:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12825660#M611</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2024-06-07T14:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12827365#M612</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;Splitting sendcommand doesn't help at all.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2024 20:00:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12827365#M612</guid>
      <dc:creator>abbas.baghernezhad</dc:creator>
      <dc:date>2024-06-08T20:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12827368#M613</link>
      <description>&lt;P&gt;Thank You Again.&lt;/P&gt;&lt;P&gt;Yes of course I tried to debug my code.&lt;/P&gt;&lt;P&gt;I edited my code. Changing sub name and correcting varable types...I still need to press enter!&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2024 20:03:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12827368#M613</guid>
      <dc:creator>abbas.baghernezhad</dc:creator>
      <dc:date>2024-06-08T20:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12830343#M614</link>
      <description>&lt;P&gt;I was able to do it with DIMDIAMETER command. Show your modified code.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 16:39:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12830343#M614</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2024-06-10T16:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12830402#M615</link>
      <description>&lt;P&gt;Here it is:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub CentMark()
Dim ent As AcadEntity
Dim FullCircle As AcadCircle
Dim CenterPx As String, CenterPy As String
Dim DimPx As String, DimPy As String

  For Each ent In ThisDrawing.ModelSpace
      If TypeOf ent Is AcadCircle Then
      Set FullCircle = ent
  
      CenterPx = CStr(FullCircle.Center(0))
      CenterPy = CStr(FullCircle.Center(1) + FullCircle.Radius)
      ThisDrawing.SendCommand "_CM" &amp;amp; vbCr &amp;amp; CenterPx &amp;amp; "," &amp;amp; CenterPy &amp;amp; vbCr &amp;amp; vbCr
      ThisDrawing.Application.Update
      ZoomAll
      DimPx = CStr(FullCircle.Center(0) + FullCircle.Radius)
      DimPy = CStr(FullCircle.Center(1) + FullCircle.Radius)
      ThisDrawing.SendCommand "_AMPOWERDIM_DIA" &amp;amp; vbCr &amp;amp; CenterPx &amp;amp; "," &amp;amp; CenterPy &amp;amp; vbCr &amp;amp; DimPx &amp;amp; "," &amp;amp; DimPy &amp;amp; vbCr &amp;amp; vbCr

      End If
    Next
    
  End Sub&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 10 Jun 2024 17:05:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12830402#M615</guid>
      <dc:creator>abbas.baghernezhad</dc:creator>
      <dc:date>2024-06-10T17:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12832535#M616</link>
      <description>&lt;P&gt;Two problems.&lt;/P&gt;
&lt;P&gt;1. You didn't use a line feed like I suggested. Use vbCrLf instead of vbCr.&lt;/P&gt;
&lt;P&gt;2. You didn't check the command line (F2) when debugging, like I suggested. See the command line report below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Command: _CM
CENTERMARK
Select circle or arc to add center mark:
Command: 20.4125331509048,12.0722926214424
Unknown command "4125331509048,12.0722926214424".  Press F1 for help.
Command:
Command:
CENTERMARK
Select circle or arc to add center mark:
Command: DIMDIAMETER
Select arc or circle:
Command: 20.4125331509048,12.0722926214424
Unknown command "4125331509048,12.0722926214424".  Press F1 for help.
Command:
DIMDIAMETER
Select arc or circle: 21.3998900501084,12.0722926214424
Select arc or circle:
Command:
DIMDIAMETER
Select arc or circle:&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notice that it keeps prompting to select a circle? You can't do that by entering a center point coordinate. You have to select on screen. I tried a trick I use, but it didn't work. I think the only way is to not use SendCommand and add your own center mark and dims.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;edit:&lt;/P&gt;
&lt;P&gt;Unfortunately, VBA does not have a center mark entity. You would only be able to add the dims. To automate the center mark, you would need to use C#. Lisp could do it, but it's more complicated. To lisp, a center mark is an anonymous block.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 15:14:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12832535#M616</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2024-06-11T15:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12832977#M617</link>
      <description>&lt;P&gt;Thank You Again.&lt;/P&gt;&lt;P&gt;I used your adviced and as you said it may not have a straight solution. But the problem was not with CM. It waits for my enter for dimension command before going to next circle.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 17:59:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12832977#M617</guid>
      <dc:creator>abbas.baghernezhad</dc:creator>
      <dc:date>2024-06-11T17:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: Stop "sendcommand" to press Enter</title>
      <link>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12833155#M618</link>
      <description>&lt;P&gt;Yes, once the command prompts you to select an entity, you must select it with the mouse. Usually you can use the lisp (handent) function to pass the command an ename, but these two commands aren't having it.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 19:32:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/stop-quot-sendcommand-quot-to-press-enter/m-p/12833155#M618</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2024-06-11T19:32:45Z</dc:date>
    </item>
  </channel>
</rss>

