<?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: measure lengths of 3D polyline using lisp &amp;amp; draw Centerline in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832460#M92696</link>
    <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually there are many polyline approximating to 900 kms, selecting individual lines will not be possible, hence needed a lisp.&amp;nbsp;&lt;/P&gt;&lt;P&gt;using Tlen.lsp from internet and result showing zero, may be due to 3D polyline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also want to insert centerline, Annotate-&amp;gt; Centerlines is not detecting those as lines.&lt;/P&gt;</description>
    <pubDate>Thu, 29 Oct 2020 14:22:40 GMT</pubDate>
    <dc:creator>k_l_raghava</dc:creator>
    <dc:date>2020-10-29T14:22:40Z</dc:date>
    <item>
      <title>measure lengths of 3D polyline using lisp &amp; draw Centerline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9830236#M92692</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3D Polyline length:&lt;/P&gt;&lt;P&gt;I want to measure 3D polyline length from a total station survey data and lines drawn connecting points. when i am using the other lisps it is not calculating the 3D lengths. around 800 kms of lines are in my drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note. attached is a part drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Center line:&lt;/P&gt;&lt;P&gt;Also center line to be draw in new layer in between those lines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 15:14:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9830236#M92692</guid>
      <dc:creator>k_l_raghava</dc:creator>
      <dc:date>2020-10-28T15:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: measure lengths of 3D polyline using lisp &amp; draw Centerline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9830425#M92693</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7895086"&gt;@k_l_raghava&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is nothing attached. Can you try again?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 16:16:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9830425#M92693</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2020-10-28T16:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: measure lengths of 3D polyline using lisp &amp; draw Centerline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9831636#M92694</link>
      <description>&lt;P&gt;sorry,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find the attached one now.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 06:36:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9831636#M92694</guid>
      <dc:creator>k_l_raghava</dc:creator>
      <dc:date>2020-10-29T06:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: measure lengths of 3D polyline using lisp &amp; draw Centerline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832437#M92695</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7895086"&gt;@k_l_raghava&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe I do not fully understand what you are requesting. Is there something wrong with using the "Length" property of the line?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you trying to get the TOTAL of all selected 3D Polylines?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 753px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/838001i88307A6D83CA6400/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;~DD&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 14:11:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832437#M92695</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2020-10-29T14:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: measure lengths of 3D polyline using lisp &amp; draw Centerline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832460#M92696</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually there are many polyline approximating to 900 kms, selecting individual lines will not be possible, hence needed a lisp.&amp;nbsp;&lt;/P&gt;&lt;P&gt;using Tlen.lsp from internet and result showing zero, may be due to 3D polyline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also want to insert centerline, Annotate-&amp;gt; Centerlines is not detecting those as lines.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 14:22:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832460#M92696</guid>
      <dc:creator>k_l_raghava</dc:creator>
      <dc:date>2020-10-29T14:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: measure lengths of 3D polyline using lisp &amp; draw Centerline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832486#M92697</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7895086"&gt;@k_l_raghava&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this routine and let me know if it is what you are looking for:&lt;/P&gt;&lt;PRE&gt;(defun c:TLEN ( / tlen str eList)
  (setq tlen
    (apply '+
      (mapcar
        '(lambda (e) (getpropertyvalue e "Length"))
        (foreach s (ssnamex (ssget '((0 . "*POLYLINE,LINE,ARC"))))
          (if (&amp;gt;= (car s) 0) (setq eList (cons (cadr s) eList)))
          eList
        );foreach
      );mapcar
    );apply
  );setq
  (setq str (strcat "\nTotal Length = " (rtos tlen)))
  (prompt str)
  (alert str)
  (princ)
);defun&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;Also want to insert centerline, Annotate-&amp;gt; Centerlines is not detecting those as lines.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I will not be able to help with this request ^^^ Since I cannot think of an effective method to get the centerline between two 3D polylines..&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;---EDIT---&lt;/P&gt;&lt;P&gt;Updated code to include ARC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;~DD&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 14:54:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832486#M92697</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2020-10-29T14:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: measure lengths of 3D polyline using lisp &amp; draw Centerline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832503#M92698</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 14:43:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832503#M92698</guid>
      <dc:creator>k_l_raghava</dc:creator>
      <dc:date>2020-10-29T14:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: measure lengths of 3D polyline using lisp &amp; draw Centerline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832516#M92699</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7895086"&gt;@k_l_raghava&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;... there are many polyline approximating to 900 kms, selecting individual lines will not be possible, hence needed a lisp.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;using Tlen.lsp from internet and result showing zero, may be due to 3D polyline.&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;....&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The &lt;STRONG&gt;&lt;FONT color="#000000"&gt;Addline.lsp&lt;/FONT&gt;&lt;/STRONG&gt; routine &lt;A href="https://cadtips.cadalyst.com/distance/calculate-total-length" target="_blank" rel="noopener"&gt;&amp;gt;here&amp;lt;&lt;/A&gt; works with 3DPolylines [and also Arcs, not covered by Message 6].&amp;nbsp; I'm sure there are many other such routines out there, some of which would also work with Circles, Ellipses, and Splines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[As for the centerline, that would not be difficult if both had the same number of vertices that were consistently opposite each other across the roadway width, and their ends aligned, but neither is the case in your example.&amp;nbsp; You can always use the M2P or MTP object snap between those points that are across from each other, as tedious as that would be.&amp;nbsp; I don't know of a way to automate it.]&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 14:49:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832516#M92699</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2020-10-29T14:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: measure lengths of 3D polyline using lisp &amp; draw Centerline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832874#M92700</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;....&lt;SPAN style="font-family: inherit;"&gt;.&lt;/SPAN&gt;
&lt;P&gt;[As for the centerline, ....&amp;nbsp; I don't know of a way to automate it.]&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Well, I thought of something, though it may not be quite what you need.&amp;nbsp; This traces along the &lt;EM&gt;shorter&lt;/EM&gt;&amp;nbsp; of the two 3DPolylines selected, and at each vertex, finds the closest point on the other one, calculates the point halfway between them, and it draws a 3DPolyline through the halfway-between locations.&amp;nbsp; It doesn't account for places where there isn't a vertex on the shorter one approximately "lined up with" or "across from" one on the longer one, but in the sample drawing, there's only one such location, and in a pretty straight stretch, so the effect on the result is minimal.&amp;nbsp; At the left end, it does this because of the little perpendicular leg:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3DCL1.PNG" style="width: 188px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/838066i9D7832139AC10700/image-size/medium?v=v2&amp;amp;px=400" role="button" title="3DCL1.PNG" alt="3DCL1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And since it finds the &lt;EM&gt;closest point&lt;/EM&gt;&amp;nbsp; on the across-the-road 3DPolyline, not necessarily the closest &lt;EM&gt;vertex&lt;/EM&gt; across the road [since in some places there isn't one roughly across the road], this kind of thing happens:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3DCL2.PNG" style="width: 355px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/838068i0F3F03BE447E74D8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="3DCL2.PNG" alt="3DCL2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;where the shorter one that it's stepping along is the lower red one, the dotted line is reaching across to the closest point on the longer one above, and the vertex on the new 3DPolyline is the midpoint between those locations, &lt;EM&gt;not&lt;/EM&gt;&amp;nbsp; the midpoint between roughly-across-from-each-other vertices.&amp;nbsp; I thought of having it find the nearest &lt;EM&gt;vertex&lt;/EM&gt;, but that could cause trouble where there &lt;EM&gt;isn't&lt;/EM&gt;&amp;nbsp; one close to across-the-road.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if that's close enough for you, it &lt;EM&gt;does&lt;/EM&gt;&amp;nbsp; follow the Z-coordinate variability in the 3D-ness of the source Polylines.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(vl-load-com)
(defun C:3DCL (/ ss 3DplA 3DplB lenA lenB 3Dpl1 3Dpl2 n vert1 pt2)
  (prompt "\nTo draw a Center-Line between two 3D Polylines,")
  (if
    (and
      (setq ss (ssget '((0 . "POLYLINE"))))
      (= (sslength ss) 2)
      (= (cdr (assoc 100 (reverse (entget (ssname ss 0))))) "AcDb3dPolyline")
      (= (cdr (assoc 100 (reverse (entget (ssname ss 1))))) "AcDb3dPolyline")
    ); and
    (progn ; then
      (setq
        3DplA (ssname ss 0)
        3DplB (ssname ss 1)
        lenA (vlax-curve-getDistAtParam 3DplA (vlax-curve-getEndParam 3DplA))
        lenB (vlax-curve-getDistAtParam 3DplB (vlax-curve-getEndParam 3DplB))
        3Dpl1 (if (&amp;lt; lenA lenB) 3DplA 3DplB); shorter one
        3Dpl2 (ssname (ssdel 3Dpl1 ss) 0); longer one
        n -1
      ); setq
      (command "_.3dpoly")
      (repeat (+ (fix (vlax-curve-getEndParam 3Dpl1)) (if (vlax-curve-isClosed 3Dpl1) 0 1))
        (setq
          vert1 (vlax-curve-getPointAtParam 3Dpl1 (setq n (1+ n))); vertex on shorter
          pt2 (vlax-curve-getClosestPointTo 3Dpl2 vert1); closest point to it on longer
        ); setq
        (command "_none" (mapcar '/ (mapcar '+ vert1 pt2) '(2 2 2))); midway between
      ); repeat
      (command (if (vlax-curve-isClosed 3Dpl1) "_close" ""))
    ); progn
    (prompt "\nYou must select two and only two 3DPolylines."); else
  ); if
  (princ)
); defun
(prompt "\nType 3DCL to draw a Center-Line between two 3DPolylines.")
(princ)&lt;/LI-CODE&gt;
&lt;P&gt;If you could get them to always have the &lt;EM&gt;same number of vertices&lt;/EM&gt;, and to both cover about the same extent without one stretching well beyond the end(s) of the other, a variant on &lt;FONT color="#000000"&gt;SplineAverage.lsp&lt;/FONT&gt;, &lt;A href="https://forums.autodesk.com/t5/autocad-forum/how-to-average-complex-3d-splines/m-p/5124588/highlight/true#M54885" target="_blank" rel="noopener"&gt;&amp;gt;here&amp;lt;&lt;/A&gt;, could be made for 3DPolylines.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 16:58:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/measure-lengths-of-3d-polyline-using-lisp-amp-draw-centerline/m-p/9832874#M92700</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2020-10-29T16:58:16Z</dc:date>
    </item>
  </channel>
</rss>

