<?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: Help on stretching my selected object in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3587032#M11554</link>
    <description>&lt;P&gt;To stretch dynamically you might be want to use this one&lt;/P&gt;&lt;PRE&gt;Public Sub testStretch()
' keep left button when specify other corner
Dim comm As String
comm = "_stretch _c pause "
ThisDrawing.SendCommand comm

End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 19 Aug 2012 20:57:04 GMT</pubDate>
    <dc:creator>Hallex</dc:creator>
    <dc:date>2012-08-19T20:57:04Z</dc:date>
    <item>
      <title>Help on stretching my selected object</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3580466#M11551</link>
      <description>&lt;P&gt;Hi guys. Sorry but i seem to be stuck once more.&amp;nbsp; I am writing a code to select an object (crossing) and to stretch it a certain distance on the y axis. This is the code that I have to select the object, but I cannot find what to use to stretch it.&amp;nbsp; I actually found something to scale it, but it is not what I need. Hope you guys can help. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With ThisDrawing.Utility&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dim SP1sel1(0 To 2) As Double&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim SP1sel2(0 To 2) As Double&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim objSS As AcadSelectionSet&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set objSS = ThisDrawing.SelectionSets.Add("zzadsaaafatt")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Select the object&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1sel1(0) = 488: SP1sel1(1) = -20: SP1sel1(2) = 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP1sel2(0) = 540: SP1sel2(1) = -150: SP1sel2(2) = 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objSS.Select acSelectionSetCrossing, SP1sel1, SP1sel2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim Test1 as AcadEntity&lt;/P&gt;&lt;P&gt;Dim StretchValue (0 To 2) As Double&amp;nbsp;&amp;nbsp;&amp;nbsp; ' this is the amount I would like to stretch by&lt;/P&gt;&lt;P&gt;StretchValue(0) = 0: StretchValue(1) = -30: StretchValue(2) = 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 20:48:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3580466#M11551</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-15T20:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help on stretching my selected object</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3580582#M11552</link>
      <description>&lt;P&gt;With code, you do not "Stretch" things as you do&amp;nbsp;using AutoCAD as drafter. It depends on what entity you wna tot stretch:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For AcadLine, you must know which end (StartPoint or EndPoint) you want to stretch, then, you simply change start/end point to a new point. For polyline, you need to know which vertex you want to stretch, then you simply update the polyline's coordinates that define the vertices with one of the vertex being replaced by a new point. If it is a circle, stretch might mean to change its radius...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, you would loop through the selectionset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim ent As AcadEntity&lt;/P&gt;&lt;P&gt;For Each ent in objSS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If TypeOf ent Is AcadLine Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''Change line's start or end point&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ElseIf TypeOf ent Is AcadLWPolyline Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''Update polyline's coordinates with a new vertex point&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 22:30:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3580582#M11552</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2012-08-15T22:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help on stretching my selected object</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3583844#M11553</link>
      <description>&lt;P&gt;Thanks for the reply.&amp;nbsp; I will give it a shot later today and I would appreciate any more help if I cannot get it to work,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2012 14:30:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3583844#M11553</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-16T14:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help on stretching my selected object</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3587032#M11554</link>
      <description>&lt;P&gt;To stretch dynamically you might be want to use this one&lt;/P&gt;&lt;PRE&gt;Public Sub testStretch()
' keep left button when specify other corner
Dim comm As String
comm = "_stretch _c pause "
ThisDrawing.SendCommand comm

End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Aug 2012 20:57:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3587032#M11554</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-08-19T20:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help on stretching my selected object</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3589512#M11555</link>
      <description>&lt;P&gt;Hey guys im sorry, but i just cannot figure this out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking at your comment&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim ent As AcadEntity&lt;/P&gt;&lt;P&gt;For Each ent in objSS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If TypeOf ent Is AcadLine Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''Change line's start or end point&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ElseIf TypeOf ent Is AcadLWPolyline Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''Update polyline's coordinates with a new vertex point&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but how can I change the start or end point of the line when I have hand drawn it into autocad?&amp;nbsp; I havent declared any points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any responses&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2012 15:13:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3589512#M11555</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-21T15:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Help on stretching my selected object</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3589702#M11556</link>
      <description>&lt;P&gt;You, of course need to ask user to input the point he intends to stretch to, psudo code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If Typeof ent Is AcadLine Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ''Ask user to input point, using AcadUtility.GetPoint()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;''Change line's Start/End Point&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;of course, with VBA, it is difficult for you to get dynamic visual feed back when user moves mouse to the intended stretch point (for point pick, it is fortunate enough that you can specify a base point so that a rubber line shows when trying to poick a point).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to use the code to achieve the similar visual effect as built-in stretch command, you'd have to learn how to do it with Jig in ObjectARX (C++ or .NET API). Or do it with SendCommand(), as adviced by the other reply (note, with SendCommand(), you probably cannot loop through your selectionSet: SendCommand has to be the last line of code to execute.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2012 16:28:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3589702#M11556</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2012-08-21T16:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help on stretching my selected object</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3589730#M11557</link>
      <description>&lt;P&gt;I just put some quick code that works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Public Sub StretchEntity()

    Dim ss As AcadSelectionSet
    Set ss = ThisDrawing.SelectionSets.Add("MySS")
    ss.Select acSelectionSetAll
    
    Dim ent As AcadEntity
    Dim line As AcadLine
    
    For Each ent In ss
        If TypeOf ent Is AcadLine Then
            Set line = ent
            StretchLine line
        End If
    Next
    
    ss.Delete
    
End Sub

Private Sub StretchLine(line As AcadLine)

    Dim pt As Variant
    Dim basePt As Variant
    basePt = line.StartPoint
    
    pt = ThisDrawing.Utility.GetPoint(basePt, vbCr &amp;amp; "Stretch the line's end point to:")
    
    line.EndPoint = pt
    line.Update

End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;As I said, the visual effect of strech is very limited due to the limitation of VBA in AutoCAD. There is nothing you can do about it.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2012 16:39:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3589730#M11557</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2012-08-21T16:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Help on stretching my selected object</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3590204#M11558</link>
      <description>&lt;P&gt;Hrm, I guess I have to work my way around stretching, however I appreciate all of your help.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2012 21:53:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-on-stretching-my-selected-object/m-p/3590204#M11558</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-21T21:53:45Z</dc:date>
    </item>
  </channel>
</rss>

