<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>CAD Forum discussion (EN) : Extract polyline total length</title>
  <link>https://www.cadforum.cz/forum_en/</link>
  <description><![CDATA[This is an XML content feed of; CAD Forum discussion (EN) : AutoCAD : Extract polyline total length]]></description>
  <pubDate>Wed, 22 Apr 2026 19:41:58 +0000</pubDate>
  <lastBuildDate>Sun, 19 Apr 2009 15:26:10 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>https://www.cadforum.cz/forum_en/RSS_post_feed.asp?TID=1854</WebWizForums:feedURL>
  <image>
   <title><![CDATA[CAD Forum discussion (EN)]]></title>
   <url>https://www.cadforum.cz/forum_en/forum_images/web_wiz_forums.png</url>
   <link>https://www.cadforum.cz/forum_en/</link>
  </image>
  <item>
   <title><![CDATA[Extract polyline total length : What I need to do is  measure...]]></title>
   <link>https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5315&amp;title=extract-polyline-total-length#5315</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="https://www.cadforum.cz/forum_en/member_profile.asp?PF=8247">sadhu</a><br /><strong>Subject:</strong> 1854<br /><strong>Posted:</strong> 19.Apr.2009 at 15:26<br /><br /><div style="overflow: auto;"><font size="2" face="Arial"><font size="2" face="Arial">What I need to do is measure the distance from an electrical&nbsp;distribution box&nbsp;to an outlet box in an apartement or residence. The process is repetitive. </font></font></div><div style="overflow: auto;"><font size="2" face="Arial">&nbsp;<br></font></div><div style="overflow: auto;"><font size="2" face="Arial"><font size="2" face="Arial">-The distribution box is always 30cm from the floor&nbsp;(A) ;<br>-the distance on the floor is almost always about two to four segments (polyline - in fact I use CD.lisp here) (B) ;<br>-the outlet box is at a variable distance from the floor. (30, 100, 110,&nbsp; 120 cm) (D).;<br>- To these three misurments (A+B+C) I need to add three constant values (k1=15cm, k2=20cm, k3=15cm). These constant values differ from project to project (building to building).&nbsp;&nbsp;</font></font></div><div style="overflow: auto;"><font size="2" face="Arial">&nbsp;</font></div><div style="overflow: auto;"><font size="2" face="Arial">So the result is (A+k1)+(B+k2)+(C+k3)</font></div><div style="overflow: auto;"><font size="2" face="Arial">&nbsp;</font></div><div style="overflow: auto;"><font size="2" face="Arial">1. A can be entered from keyboard or autolisp</font></div><div style="overflow: auto;"><font size="2" face="Arial">2. B is measured by CD.lisp (consecutive clicks)</font></div><font size="2" face="Arial"><div style="overflow: auto;"><font size="2" face="Arial">3. C&nbsp;should be entered by keyboard</font></div><div style="overflow: auto;">4. k1, k2 and k3 can be entered by lisp (prefered) or keyboard.</div><div style="overflow: auto;">&nbsp;</div><div style="overflow: auto;">The total measurement that I get in the end &#091;(A+k1)+(B+k2)+(C+k3)&#093; is used in manufacturing&nbsp;to cut tubes of appropriate length.</div><div style="overflow: auto;">&nbsp;</div><div style="overflow: auto;">Actually there are objects on the drawing that have height attributes - I wonder if they can be used.</div><div style="overflow: auto;"><br>I hope the explanation is clear enough. <br></div><div style="overflow: auto;">&nbsp;</div><div style="overflow: auto;"><font size="2" face="Arial">I work in the electrical section but this is the installation part.</font></div></font>]]>
   </description>
   <pubDate>Sun, 19 Apr 2009 15:26:10 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5315&amp;title=extract-polyline-total-length#5315</guid>
  </item> 
  <item>
   <title><![CDATA[Extract polyline total length :   Hello,I&amp;#039;am using the...]]></title>
   <link>https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5310&amp;title=extract-polyline-total-length#5310</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="https://www.cadforum.cz/forum_en/member_profile.asp?PF=8247">sadhu</a><br /><strong>Subject:</strong> 1854<br /><strong>Posted:</strong> 18.Apr.2009 at 12:26<br /><br />Hello,<br><br>I'am using the CD.lisp and need to add a few features.<br><br>1.&nbsp; enter a value from keyboard that will add to the cumulative distance to misure ;<br><br>2.&nbsp; enter a second value from keyboard that will add to the cumulative distance&nbsp; measured at the end of the consecutive clicks;<br><br>3. add three constant values (offset1, offset2 add tolerance) in background to the total value. These constant values need to be defined at the beginning of every new project.<br><br>thanks <br><span style="font-size:10px"><br /><br />Edited by sadhu - 18.Apr.2009 at 12:28</span>]]>
   </description>
   <pubDate>Sat, 18 Apr 2009 12:26:01 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5310&amp;title=extract-polyline-total-length#5310</guid>
  </item> 
  <item>
   <title><![CDATA[Extract polyline total length : Glad it was an easy fix.. that...]]></title>
   <link>https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5203&amp;title=extract-polyline-total-length#5203</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="https://www.cadforum.cz/forum_en/member_profile.asp?PF=30236">msplcdykee69</a><br /><strong>Subject:</strong> 1854<br /><strong>Posted:</strong> 07.Apr.2009 at 04:20<br /><br />Glad it was an easy fix.. that is always good.]]>
   </description>
   <pubDate>Tue, 07 Apr 2009 04:20:47 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5203&amp;title=extract-polyline-total-length#5203</guid>
  </item> 
  <item>
   <title><![CDATA[Extract polyline total length : yes it works. I just had to enlarge...]]></title>
   <link>https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5200&amp;title=extract-polyline-total-length#5200</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="https://www.cadforum.cz/forum_en/member_profile.asp?PF=8247">sadhu</a><br /><strong>Subject:</strong> 1854<br /><strong>Posted:</strong> 06.Apr.2009 at 19:48<br /><br />yes it works.&nbsp; I just had to enlarge the command line window.<br><br>Thanks a lot.&nbsp;]]>
   </description>
   <pubDate>Mon, 06 Apr 2009 19:48:12 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5200&amp;title=extract-polyline-total-length#5200</guid>
  </item> 
  <item>
   <title><![CDATA[Extract polyline total length : Well First you did seperate the...]]></title>
   <link>https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5159&amp;title=extract-polyline-total-length#5159</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="https://www.cadforum.cz/forum_en/member_profile.asp?PF=30236">msplcdykee69</a><br /><strong>Subject:</strong> 1854<br /><strong>Posted:</strong> 01.Apr.2009 at 04:00<br /><br /><P>Well First you did seperate the two lisps into two seperate applications right?&nbsp; I am sure you did.&nbsp; </P><P>here is what should come up when you imput LNL in the command prompt:</P><P><FONT color=#ff0000 size=3><strong>Command: lnl</strong></FONT></P><P><FONT color=#ff0000 size=3><strong>Select object(s) on required layer(s):<BR>Select objects: 1 found</strong></FONT></P><P><FONT color=#ff0000 size=3><strong>Select objects:</strong></FONT></P><P><FONT color=#ff0000 size=3><strong>Total length of all entities on layer(s) 0: 402.48</P><DIV><FONT size=+0>If you have any other problems just email me and I will send you my lisp program That does run correctly.&nbsp; I have been using it for years.</FONT></DIV><DIV>&nbsp;</DIV><DIV><a href="mailto:msplcdykee69@yahoo.com" target="_blank">msplcdykee69@yahoo.com</A></DIV></strong></FONT><span style="font-size:10px"><br /><br />Edited by msplcdykee69 - 01.Apr.2009 at 04:03</span>]]>
   </description>
   <pubDate>Wed, 01 Apr 2009 04:00:46 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5159&amp;title=extract-polyline-total-length#5159</guid>
  </item> 
  <item>
   <title><![CDATA[Extract polyline total length : After I type LNL I&amp;#039;m asked...]]></title>
   <link>https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5156&amp;title=extract-polyline-total-length#5156</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="https://www.cadforum.cz/forum_en/member_profile.asp?PF=8247">sadhu</a><br /><strong>Subject:</strong> 1854<br /><strong>Posted:</strong> 31.Mar.2009 at 23:35<br /><br />After I type LNL I'm asked to select objects. I then select all objects on the current layer and then hit "ENTER". I don't see any result on the command line.<br><br>What am I doing wrong ? What do you mean by "select the layer" ?<br><br><br><br>&nbsp;]]>
   </description>
   <pubDate>Tue, 31 Mar 2009 23:35:35 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5156&amp;title=extract-polyline-total-length#5156</guid>
  </item> 
  <item>
   <title><![CDATA[Extract polyline total length : if you look at your command line...]]></title>
   <link>https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5154&amp;title=extract-polyline-total-length#5154</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="https://www.cadforum.cz/forum_en/member_profile.asp?PF=30236">msplcdykee69</a><br /><strong>Subject:</strong> 1854<br /><strong>Posted:</strong> 31.Mar.2009 at 22:14<br /><br />if you look at your command line after you call the command LNL and then select the layer they are on it will list the total length on the command line]]>
   </description>
   <pubDate>Tue, 31 Mar 2009 22:14:51 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5154&amp;title=extract-polyline-total-length#5154</guid>
  </item> 
  <item>
   <title><![CDATA[Extract polyline total length : How does the lisp command &amp;#034;LNL&amp;#034;...]]></title>
   <link>https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5151&amp;title=extract-polyline-total-length#5151</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="https://www.cadforum.cz/forum_en/member_profile.asp?PF=8247">sadhu</a><br /><strong>Subject:</strong> 1854<br /><strong>Posted:</strong> 31.Mar.2009 at 18:44<br /><br />How does the lisp command "LNL" work ? After loading the lisp file I called LNL and selected various polylines - where do I get the results ?<br><br>CD works perfect.<br>]]>
   </description>
   <pubDate>Tue, 31 Mar 2009 18:44:52 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5151&amp;title=extract-polyline-total-length#5151</guid>
  </item> 
  <item>
   <title><![CDATA[Extract polyline total length : msplcdykee69  Nice AutoLISP program...]]></title>
   <link>https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5117&amp;title=extract-polyline-total-length#5117</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="https://www.cadforum.cz/forum_en/member_profile.asp?PF=2361">Arben.Allaraj</a><br /><strong>Subject:</strong> 1854<br /><strong>Posted:</strong> 29.Mar.2009 at 22:27<br /><br />&nbsp;<br>&nbsp;msplcdykee69 <br><br>&nbsp; Nice AutoLISP program .]]>
   </description>
   <pubDate>Sun, 29 Mar 2009 22:27:59 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5117&amp;title=extract-polyline-total-length#5117</guid>
  </item> 
  <item>
   <title><![CDATA[Extract polyline total length : There are 2 way to do this: One...]]></title>
   <link>https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5113&amp;title=extract-polyline-total-length#5113</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="https://www.cadforum.cz/forum_en/member_profile.asp?PF=30236">msplcdykee69</a><br /><strong>Subject:</strong> 1854<br /><strong>Posted:</strong> 29.Mar.2009 at 21:47<br /><br />There are 2 way to do this: One is to use this lisp command "LNL" Copy this into a notepad and save as a lisp so you can install in CAD.&nbsp; The second list works like the distance command except it is cumulative distance "CD" it gives you the length from point to point plus toe total length of what you have measured.&nbsp; The lisp command for this is below as well. <DIV></DIV><DIV>One:</DIV><DIV>;;; LENLYR.LSP a program to find the length of all<BR>;;; entities on any selected layer<BR>;;;<BR>(defun err (s)<BR>&nbsp; (if (= s "Function cancelled") <BR>&nbsp;&nbsp;&nbsp; (princ "\nLENLYR - cancelled: ")<BR>&nbsp;&nbsp;&nbsp; (progn (princ "\nLENLYR - Error: ") (princ s) <BR>&nbsp;&nbsp;&nbsp; (terpri))<BR>&nbsp; ); if<BR>&nbsp; (resetting)<BR>&nbsp; (princ "SYSTEM VARIABLES have been reset\n")<BR>&nbsp; (princ)<BR>); err<BR>(defun setv (systvar newval) <BR>&nbsp;&nbsp; (setq x (read (strcat systvar "1")))&nbsp;&nbsp; <BR>&nbsp;&nbsp; (set x (getvar systvar))<BR>&nbsp;&nbsp; (setvar systvar newval) <BR>); setv <BR>(defun setting () <BR>&nbsp;&nbsp; (setq oerr *error*)<BR>&nbsp;&nbsp; (setq *error* err)<BR>&nbsp;&nbsp; (setv "CMDECHO" 0)<BR>&nbsp;&nbsp; (setv "BLIPMODE" 0)<BR>); end of setting<BR>(defun rsetv (systvar)<BR>&nbsp;&nbsp; (setq x (read (strcat systvar "1")))<BR>&nbsp;&nbsp; (setvar systvar (eval x))<BR>); restv<BR>(defun resetting () <BR>&nbsp;&nbsp; (rsetv "CMDECHO")<BR>&nbsp;&nbsp; (rsetv "BLIPMODE")<BR>&nbsp;&nbsp; (setq *error* oerr)<BR>); end of resetting </DIV><DIV>(defun dxf (code ename)<BR>&nbsp; (cdr (assoc code (entget ename)))<BR>); dxf</DIV><DIV>(defun lenlyr ( / LayerList EntityList EntityLengths)<BR>&nbsp; (setq LayerList (get-lyrs)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EntityList (get-ents LayerList)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EntityLengths (do-len EntityList)<BR>&nbsp; ) ; setq<BR>&nbsp; (prin1 (read (rtos EntityLengths 2 2)))<BR>); lenlyr</DIV><DIV>(defun get-lyrs ( / isent lyr-list ss i lname)<BR>&nbsp; (setq isent nil lyr-list nil)<BR>&nbsp; (prompt <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "\nSelect object(s) on required layer(s): ")<BR>&nbsp; (setq ss nil)<BR>&nbsp; (while (not ss)<BR>&nbsp;&nbsp;&nbsp; (setq ss (ssget))<BR>&nbsp;&nbsp;&nbsp; (if (not ss)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (prompt "\nNo entities were selected.")<BR>&nbsp;&nbsp;&nbsp; ); if<BR>&nbsp; ); while<BR>&nbsp; (setq i (- 1))<BR>&nbsp; (repeat (sslength ss)<BR>&nbsp;&nbsp;&nbsp; (setq lname (dxf 8 (ssname ss (setq i (1+ i)))))<BR>&nbsp;&nbsp;&nbsp; (if (not (member lname lyr-list))&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq lyr-list (append lyr-list (list lname)))<BR>&nbsp;&nbsp;&nbsp; ); if<BR>&nbsp; ); repeat<BR>&nbsp; lyr-list<BR>); get-lyrs</DIV><DIV>(defun get-ents (LayerList / lstr lst lyr str<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filtlist i ss ename elist)<BR>&nbsp; (setq lstr (strcat (car LayerList) ","))<BR>&nbsp; (setq lst (cdr LayerList))<BR>&nbsp; (foreach lyr lst<BR>&nbsp;&nbsp;&nbsp; (setq str (strcat lyr ",")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lstr (strcat lstr str)<BR>&nbsp;&nbsp;&nbsp; ); setq<BR>&nbsp; ); foreach<BR>&nbsp; (setq lstr (substr lstr 1 (1- (strlen lstr))))<BR>&nbsp; (setq filtlist (list<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (cons 8 lstr)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(-4 . "&lt;or")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(0 . "LINE")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(0 . "ARC")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(0 . "CIRCLE")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(0 . "POLYLINE")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(0 . "LWPOLYLINE")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(-4 . "or&gt;")<BR>&nbsp;&nbsp;&nbsp; ); list<BR>&nbsp; ); setq<BR>&nbsp; (setq i (- 1) elist nil ss nil)<BR>&nbsp; (setq ss (ssget "X" filtlist))<BR>&nbsp; (if ss<BR>&nbsp;&nbsp;&nbsp; (progn<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (repeat (sslength ss)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq ename (ssname ss (setq i (1+ i))))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq elist (append elist (list ename)))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ); repeat<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (princ (strcat "\nTotal length of all "<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "entities on layer(s) " lstr ": ")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ); print<BR>&nbsp;&nbsp;&nbsp;&nbsp; ); progn<BR>&nbsp;&nbsp;&nbsp;&nbsp; (progn<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (alert (strcat "No eligible entities on "<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "layer(s) \n" lstr "\naborting."))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (exit)<BR>&nbsp;&nbsp;&nbsp;&nbsp; ); progn<BR>&nbsp;&nbsp; ); if<BR>&nbsp; elist<BR>); get-ents</DIV><DIV>(defun do-len (EntityList / TotalLength ent len)<BR>&nbsp; (setq TotalLength 0 len 0)<BR>&nbsp; (foreach ent EntityList<BR>&nbsp;&nbsp;&nbsp; (setq len (ent-len ent))<BR>&nbsp;&nbsp;&nbsp; (if len<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq TotalLength (+ len TotalLength))<BR>&nbsp;&nbsp;&nbsp; ); if<BR>&nbsp; ); foreach<BR>); do-len</DIV><DIV>(defun ent-len (en / elength)<BR>&nbsp; (setq elength<BR>&nbsp;&nbsp;&nbsp; (cond<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((= (dxf 0 en ) "LINE") (do-line en))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((= (dxf 0 en ) "ARC") (do-arc en))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((= (dxf 0 en ) "CIRCLE") (do-circle en))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((= (dxf 0 en ) "POLYLINE") (do-pline en))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((= (dxf 0 en ) "LWPOLYLINE") (do-lwpline en))<BR>&nbsp;&nbsp;&nbsp; ); cond<BR>&nbsp; ); setq<BR>&nbsp; elength<BR>); ent-len</DIV><DIV>(defun do-line (en / p10 p11 len)<BR>&nbsp; (setq p10 (dxf 10 en)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p11 (dxf 11 en)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; len (distance p10 p11)<BR>&nbsp; ); setq<BR>&nbsp; len<BR>); do-line</DIV><DIV>(defun do-arc (en / rad sang eang theta len)<BR>&nbsp; (setq rad (dxf 40 en)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sang (dxf 50 en)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eang (dxf 51 en)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; theta (- eang sang)<BR>&nbsp; ); setq<BR>&nbsp; (if (minusp theta)<BR>&nbsp;&nbsp;&nbsp; (setq theta (+ theta pi pi))<BR>&nbsp; ); if<BR>&nbsp; (setq len (* rad theta))<BR>); do-arc</DIV><DIV>(defun do-circle (en / rad len)<BR>&nbsp; (setq rad (dxf 40 en)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; len (* rad pi 2)<BR>&nbsp; ); setq<BR>&nbsp; len<BR>); do-circle</DIV><DIV>(defun do-pline (en / is-closed vlist vvlist len)<BR>&nbsp; (setq is-closed (dxf 70 en))<BR>&nbsp; (if (/= is-closed 100)<BR>&nbsp;&nbsp;&nbsp; (progn<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq en (entnext en))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq vlist nil<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vvlist nil<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ); setq<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (while (/= "SEQEND" (dxf 0 en))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq vlist (dxf 10 en)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vlist (reverse vlist)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vlist (cdr vlist)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vlist (list (reverse vlist))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ); setq<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq vlist <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (append vlist (list (dxf 42 en))))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq vvlist (append vvlist (list vlist)))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq en (entnext en))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ); while<BR>&nbsp;&nbsp;&nbsp; ); progn<BR>&nbsp; ); if<BR>&nbsp; (setq len (do-polylen vvlist is-closed))<BR>); do-pline</DIV><DIV>(defun do-lwpline (en / num-vert is-closed elist<BR>&nbsp;&nbsp;&nbsp;&nbsp; vlist vvlist len)<BR>&nbsp; (setq num-vert (dxf 90 en)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is-closed (dxf 70 en)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elist (entget en)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elist (member (assoc 10 elist) elist)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vlist nil<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vvlist nil<BR>&nbsp; ); setq<BR>&nbsp; (repeat num-vert<BR>&nbsp;&nbsp;&nbsp; (setq vlist (list (cdr (assoc 10 elist))))<BR>&nbsp;&nbsp;&nbsp; (setq vlist <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (append vlist (list (cdr (assoc 42 elist)))))<BR>&nbsp;&nbsp;&nbsp; (setq vvlist (append vvlist (list vlist)))<BR>&nbsp;&nbsp;&nbsp; (setq elist (cdr elist)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elist (member (assoc 10 elist) elist)<BR>&nbsp;&nbsp;&nbsp; ); setq<BR>&nbsp; ); repeat<BR>&nbsp; (setq len (do-polylen vvlist is-closed))<BR>); do-lwpline</DIV><DIV>(defun do-polylen (vvlist is-closed / closed seglen<BR>&nbsp;&nbsp;&nbsp;&nbsp; plen first p10 p11 bulge)<BR>&nbsp; (setq closed (logand is-closed 1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; seglen 0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; plen 0<BR>&nbsp; ); setq<BR>&nbsp; (if (= closed 1)<BR>&nbsp;&nbsp;&nbsp; (progn<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq first (car vvlist)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vvlist (append vvlist (list first))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ); setq<BR>&nbsp;&nbsp;&nbsp; ); progn<BR>&nbsp; ); if<BR>&nbsp; (repeat (1- (length vvlist))<BR>&nbsp;&nbsp;&nbsp; (setq p10 (caar vvlist)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p11 (caadr vvlist)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bulge (cadar vvlist)<BR>&nbsp;&nbsp;&nbsp; ); setq<BR>&nbsp;&nbsp;&nbsp; (setq seglen (do-seg p10 p11 bulge))<BR>&nbsp;&nbsp;&nbsp; (setq plen (+ plen seglen))<BR>&nbsp;&nbsp;&nbsp; (setq vvlist (cdr vvlist))<BR>&nbsp; ); repeat<BR>&nbsp; plen<BR>); do-polylen</DIV><DIV>(defun do-seg (p1 p2 bulg / seglen ang4 ang dis rad)<BR>&nbsp; (if (= bulg 0.0)<BR>&nbsp;&nbsp;&nbsp; (progn<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq seglen (distance p1 p2))<BR>&nbsp;&nbsp;&nbsp; ); progn<BR>&nbsp;&nbsp;&nbsp; (progn<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq ang4 (atan bulg)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ang (* 4.0 ang4)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dis (distance p1 p2)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rad (/ (/ dis 2.0) (sin (/ ang 2.0)))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; seglen (* rad ang)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ); setq <BR>&nbsp;&nbsp;&nbsp; ); progn<BR>&nbsp; ); if<BR>&nbsp; seglen<BR>); do-seg</DIV><DIV>(defun c:lnl ()<BR>&nbsp;&nbsp; (setting)<BR>&nbsp;&nbsp; (lenlyr)<BR>&nbsp;&nbsp; (resetting)<BR>&nbsp;&nbsp; (princ)<BR>); c:lnl</DIV><DIV>(prompt "\nEnter LNL to start")</DIV><DIV>&nbsp;</DIV><DIV>two:</DIV><DIV>;cumulative distance<BR>;this routine is just like the Autocad Distance command with the</DIV><DIV>;exception that it allows you to pick more than 2 consecutive points.<BR>;the routine will display the cumulative distance and the distance<BR>;between the last two points picked on the command line.<BR>(defun c:cd ()<BR>&nbsp;(setvar "cmdecho" 0)<BR>&nbsp;(graphscr)<BR>&nbsp;(setq <BR>&nbsp; p1 (getpoint "\nPick start point ")<BR>&nbsp; p2 (getpoint p1 "\nPick next point ")<BR>&nbsp; d1 (distance p1 p2)<BR>&nbsp; prdist (strcat "\nDistance: " (rtos d1))<BR>&nbsp;)<BR>&nbsp;(princ prdist)<BR>&nbsp;(setq p3 (getpoint p2 "\nPick next point or RETURN if done "))<BR>&nbsp;(while p3<BR>&nbsp; (setq<BR>&nbsp;&nbsp; d0 (distance p2 p3)<BR>&nbsp;&nbsp; d1 (+ (distance p2 p3) d1)<BR>&nbsp;&nbsp; p2 p3<BR>&nbsp;&nbsp; prdist (strcat "\nDistance: " (rtos d0) ", Cumulative distance: " (rtos d1))<BR>&nbsp; )<BR>&nbsp; (princ prdist)<BR>&nbsp; (setq p3 (getpoint p2 "\nPick Next Point "))<BR>&nbsp;)<BR>&nbsp;(setq cumd (strcat "Cumulative distance --&gt; " (rtos d1)))<BR>&nbsp;(prompt cumd)<BR>&nbsp;(princ)<BR>)<BR>(princ "\nType CD to run Cumulative Distance")<BR>(princ)</DIV><span style="font-size:10px"><br /><br />Edited by msplcdykee69 - 29.Mar.2009 at 21:49</span>]]>
   </description>
   <pubDate>Sun, 29 Mar 2009 21:47:20 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum_en/forum_posts.asp?TID=1854&amp;PID=5113&amp;title=extract-polyline-total-length#5113</guid>
  </item> 
 </channel>
</rss>