<?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: How to get Start/end point of a polyline? in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/how-to-get-start-end-point-of-a-polyline/m-p/1616983#M35125</link>
    <description>Kashu,&lt;BR /&gt;
&lt;BR /&gt;
here is a sample that labels the X&amp;amp;Y of the endponts of a ployline.&lt;BR /&gt;
&lt;BR /&gt;
John Coon&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Public Sub Main()&lt;BR /&gt;
  Dim PLine As AcadLWPolyline&lt;BR /&gt;
  Set PLine = getPLine&lt;BR /&gt;
  If Not (PLine Is Nothing) Then&lt;BR /&gt;
    Dim Points As Variant&lt;BR /&gt;
    Points = PLine.Coordinates&lt;BR /&gt;
    LabelStations Points&lt;BR /&gt;
  Else&lt;BR /&gt;
    MsgBox "No polyline was selected.", vbInformation, "Finished"&lt;BR /&gt;
  End If&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Private Function getPLine() As AcadLWPolyline&lt;BR /&gt;
  On Error Resume Next&lt;BR /&gt;
  Dim Pick As AcadEntity, PickPt As Variant&lt;BR /&gt;
  ThisDrawing.Utility.GetEntity Pick, PickPt, _&lt;BR /&gt;
    vbCrLf &amp;amp; "Select polyline: "&lt;BR /&gt;
  If Not (Pick Is Nothing) Then&lt;BR /&gt;
    If TypeOf Pick Is AcadLWPolyline Then Set getPLine = Pick&lt;BR /&gt;
  End If&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Private Sub LabelStations(Points As Variant)&lt;BR /&gt;
  Dim mtxtLabel As AcadMText&lt;BR /&gt;
   Dim dblRot As Double&lt;BR /&gt;
  Dim x As Double&lt;BR /&gt;
  Dim y As Double&lt;BR /&gt;
  Dim ptText(0 To 2) As Double&lt;BR /&gt;
  Dim StationText As String&lt;BR /&gt;
&lt;BR /&gt;
  Dim StationFormat As String&lt;BR /&gt;
  StationFormat = "#0.00"&lt;BR /&gt;
  Dim i As Long&lt;BR /&gt;
  For i = 0 To (UBound(Points) - 1) Step 2&lt;BR /&gt;
    x = Points(i): y = Points(i + 1)&lt;BR /&gt;
    ptText(0) = x: ptText(1) = y: ptText(2) = 0&lt;BR /&gt;
    StationText = Format(CStr(x), StationFormat) &amp;amp; _&lt;BR /&gt;
      "," &amp;amp; Format(CStr(y), StationFormat)&lt;BR /&gt;
    dblRot = -ThisDrawing.GetVariable("VIEWTWIST")&lt;BR /&gt;
&lt;BR /&gt;
   Set mtxtLabel = ThisDrawing.ModelSpace.AddMText(ptText, dblWidth, &lt;BR /&gt;
StationText)&lt;BR /&gt;
    mtxtLabel.Rotation = dblRot&lt;BR /&gt;
  Next i&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;KASHUUU&gt; wrote in message news:5146830@discussion.autodesk.com...&lt;BR /&gt;
Hi All,&lt;BR /&gt;
I need to get start &amp;amp; end point of a lwpolyline selected by GetEntity &lt;BR /&gt;
method.&lt;BR /&gt;
My objective is.. I want to insert a text on both of the ends of a selected &lt;BR /&gt;
lwpolyline.&lt;BR /&gt;
Thanks&lt;BR /&gt;
Kashu&lt;/KASHUUU&gt;</description>
    <pubDate>Wed, 19 Apr 2006 10:41:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-04-19T10:41:54Z</dc:date>
    <item>
      <title>How to get Start/end point of a polyline?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-get-start-end-point-of-a-polyline/m-p/1616982#M35124</link>
      <description>Hi All,&lt;BR /&gt;
I need to get start &amp;amp; end point of a lwpolyline selected by GetEntity method.&lt;BR /&gt;
My objective is.. I want to insert a text on both of the ends of a selected lwpolyline.&lt;BR /&gt;
Thanks&lt;BR /&gt;
Kashu</description>
      <pubDate>Wed, 19 Apr 2006 10:16:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-get-start-end-point-of-a-polyline/m-p/1616982#M35124</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-19T10:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Start/end point of a polyline?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-get-start-end-point-of-a-polyline/m-p/1616983#M35125</link>
      <description>Kashu,&lt;BR /&gt;
&lt;BR /&gt;
here is a sample that labels the X&amp;amp;Y of the endponts of a ployline.&lt;BR /&gt;
&lt;BR /&gt;
John Coon&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Public Sub Main()&lt;BR /&gt;
  Dim PLine As AcadLWPolyline&lt;BR /&gt;
  Set PLine = getPLine&lt;BR /&gt;
  If Not (PLine Is Nothing) Then&lt;BR /&gt;
    Dim Points As Variant&lt;BR /&gt;
    Points = PLine.Coordinates&lt;BR /&gt;
    LabelStations Points&lt;BR /&gt;
  Else&lt;BR /&gt;
    MsgBox "No polyline was selected.", vbInformation, "Finished"&lt;BR /&gt;
  End If&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Private Function getPLine() As AcadLWPolyline&lt;BR /&gt;
  On Error Resume Next&lt;BR /&gt;
  Dim Pick As AcadEntity, PickPt As Variant&lt;BR /&gt;
  ThisDrawing.Utility.GetEntity Pick, PickPt, _&lt;BR /&gt;
    vbCrLf &amp;amp; "Select polyline: "&lt;BR /&gt;
  If Not (Pick Is Nothing) Then&lt;BR /&gt;
    If TypeOf Pick Is AcadLWPolyline Then Set getPLine = Pick&lt;BR /&gt;
  End If&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Private Sub LabelStations(Points As Variant)&lt;BR /&gt;
  Dim mtxtLabel As AcadMText&lt;BR /&gt;
   Dim dblRot As Double&lt;BR /&gt;
  Dim x As Double&lt;BR /&gt;
  Dim y As Double&lt;BR /&gt;
  Dim ptText(0 To 2) As Double&lt;BR /&gt;
  Dim StationText As String&lt;BR /&gt;
&lt;BR /&gt;
  Dim StationFormat As String&lt;BR /&gt;
  StationFormat = "#0.00"&lt;BR /&gt;
  Dim i As Long&lt;BR /&gt;
  For i = 0 To (UBound(Points) - 1) Step 2&lt;BR /&gt;
    x = Points(i): y = Points(i + 1)&lt;BR /&gt;
    ptText(0) = x: ptText(1) = y: ptText(2) = 0&lt;BR /&gt;
    StationText = Format(CStr(x), StationFormat) &amp;amp; _&lt;BR /&gt;
      "," &amp;amp; Format(CStr(y), StationFormat)&lt;BR /&gt;
    dblRot = -ThisDrawing.GetVariable("VIEWTWIST")&lt;BR /&gt;
&lt;BR /&gt;
   Set mtxtLabel = ThisDrawing.ModelSpace.AddMText(ptText, dblWidth, &lt;BR /&gt;
StationText)&lt;BR /&gt;
    mtxtLabel.Rotation = dblRot&lt;BR /&gt;
  Next i&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;KASHUUU&gt; wrote in message news:5146830@discussion.autodesk.com...&lt;BR /&gt;
Hi All,&lt;BR /&gt;
I need to get start &amp;amp; end point of a lwpolyline selected by GetEntity &lt;BR /&gt;
method.&lt;BR /&gt;
My objective is.. I want to insert a text on both of the ends of a selected &lt;BR /&gt;
lwpolyline.&lt;BR /&gt;
Thanks&lt;BR /&gt;
Kashu&lt;/KASHUUU&gt;</description>
      <pubDate>Wed, 19 Apr 2006 10:41:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-get-start-end-point-of-a-polyline/m-p/1616983#M35125</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-19T10:41:54Z</dc:date>
    </item>
  </channel>
</rss>

