<?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: Request for advice regarding an intersection counting LISP in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712516#M53530</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;- I see what you mean now - yes they are quite different.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I gave yours a shot and I can't seem to get it to return intersections. Maybe I'm just missing something silly? It ends up returning the "Please select more than 1 object" as if there were no selections by the bounding box portion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;--------------------------------------------------------------------&lt;BR /&gt;;EONE Intersect Count from Kent Cooper with crossing select&lt;BR /&gt;;--------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;(defun c:EONEinterscountmod ( / c i l s x ent sel2 LL UR ) ;;define function&lt;BR /&gt;(if&lt;BR /&gt;(and&lt;BR /&gt;(setq ent (car (entsel (Select Zone Polyline)))) ;;selects Zone polyline&lt;BR /&gt;&lt;BR /&gt;(vla-getboundingbox (vlax-ename-&amp;gt;vla-object ent) 'minpt 'maxpt) ;gets bounding box of zone polyline&lt;BR /&gt;&lt;BR /&gt;(setq&lt;BR /&gt;LL (vlax-safearray-&amp;gt;list minpt); [ = Lower Left corner ]&lt;BR /&gt;UR (vlax-safearray-&amp;gt;list maxpt); [ = Upper Right corner ]&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(setq sel2 (ssget "_C" '(LL) '(UR) '((0 . "LINE") (8 . "LPSLAT")))) ;;selects lateral lines based on min and max points of bounding box&lt;BR /&gt;)&lt;BR /&gt;(progn ; wrap into ONE 'then' expression&lt;BR /&gt;(setq s (ssadd ent sel2)) ;;adds zone and laterals to same selection set&lt;/P&gt;&lt;P&gt;(repeat (setq i (sslength s)) ; selection set to list of VLA objects&lt;BR /&gt;(setq&lt;BR /&gt;i (1- i)&lt;BR /&gt;l (cons (vlax-ename-&amp;gt;vla-object (ssname s i)) l)&lt;BR /&gt;) ; setq&lt;BR /&gt;) ; repeat&lt;/P&gt;&lt;P&gt;(setq c 0)&lt;BR /&gt;(while (setq x (car l))&lt;BR /&gt;(foreach y (setq l (cdr l))&lt;BR /&gt;(setq c (+ c (/ (length (vlax-invoke x 'intersectwith y acextendnone)) 3)))&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(princ (strcat "\n" (itoa c) " intersection" (if (= 1 c) "" "s") " between " (itoa (sslength s)) " objects."))&lt;BR /&gt;) ; progn [end of 'then' expression]&lt;BR /&gt;(princ "\nPlease select more than one object.") ; 'else' expression&lt;BR /&gt;) ; if&lt;BR /&gt;(princ) ;;clean exit&lt;BR /&gt;) ; defun&lt;/P&gt;</description>
    <pubDate>Mon, 25 Oct 2021 18:44:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-10-25T18:44:40Z</dc:date>
    <item>
      <title>Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10711641#M53521</link>
      <description>&lt;P&gt;I posted about syntax error resulting from this code &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/syntax-error-on-load-requesting-help-to-figure-it-out/m-p/10706719#M422366" target="_blank" rel="noopener"&gt;last week&lt;/A&gt; - We solved the syntax issue and now I'm looking for help on improving the LISP for my application so I figured I'd title it something new.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The end goal of the LISP is to prompt the user to select a polyline, automatically select &lt;EM&gt;all&lt;/EM&gt; or &lt;EM&gt;likely&lt;/EM&gt; intersecting lines, count the intersections, and then print the # of intersections to an mtext object at the halfway point of the polyline. If the code could cycle through a # of selected polylines that would be a bonus but as long as it is one-click it will fit into our workflow fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have right credit to&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt; now counts intersections of selected polyline and lines and prints to the command line. It worked very well when i selected only a small portion of the lines in the drawing near the polyline but counts many extra intersections if i use a command to automatically select ALL lines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:EONEinterscountKC ( / c i l s x ent sel2 ) ;;define function&lt;BR /&gt;(if&lt;BR /&gt;(and&lt;BR /&gt;(setq ent (car (entsel))) ;;selects Zone polyline&lt;BR /&gt;(setq sel2 (ssget '((0 . "LINE") (8 . "LPSLAT")))) ;;selects lateral lines&lt;BR /&gt;)&lt;BR /&gt;(progn ; wrap into ONE 'then' expression&lt;BR /&gt;(setq s (ssadd ent sel2)) ;;adds zone and laterals to same selection set&lt;/P&gt;&lt;P&gt;(repeat (setq i (sslength s)) ; selection set to list of VLA objects&lt;BR /&gt;(setq&lt;BR /&gt;i (1- i)&lt;BR /&gt;l (cons (vlax-ename-&amp;gt;vla-object (ssname s i)) l)&lt;BR /&gt;) ; setq&lt;BR /&gt;) ; repeat&lt;/P&gt;&lt;P&gt;(setq c 0)&lt;BR /&gt;(while (setq x (car l))&lt;BR /&gt;(foreach y (setq l (cdr l))&lt;BR /&gt;(setq c (+ c (/ (length (vlax-invoke x 'intersectwith y acextendnone)) 3)))&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(princ (strcat "\n" (itoa c) " intersection" (if (= 1 c) "" "s") " between " (itoa (sslength s)) " objects."))&lt;BR /&gt;) ; progn [end of 'then' expression]&lt;BR /&gt;(princ "\nPlease select more than one object.") ; 'else' expression&lt;BR /&gt;) ; if&lt;/P&gt;&lt;P&gt;(princ) ;;clean exit&lt;BR /&gt;) ; defun&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My questions are as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Is there a good way to select all lines in the vicinity of the polyline instead of all lines in the drawing?&lt;/P&gt;&lt;P&gt;2. Is there any reason it might be returning incorrect #s when all lines are selected?&lt;/P&gt;&lt;P&gt;3. What is the easiest way to create an Mtext object with the number of intersections 5 units below the center of the pline?&lt;/P&gt;&lt;P&gt;4. can the code be adjusted easily to loop through all selected polylines?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice that anyone can provide is massively appreciated by me. I am doing my best to get a crash course in Autolisp so that I can do more of this myself.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;lease also let me know if there is any more information I can provide or if the format of my post is not appropriate for the forum and I will adjust.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 12:34:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10711641#M53521</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-25T12:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10711992#M53522</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;1. Is there a good way to select all lines in the vicinity of the polyline instead of all lines in the drawing?&lt;/P&gt;&lt;P&gt;2. Is there any reason it might be returning incorrect #s when all lines are selected?&lt;/P&gt;&lt;P&gt;3. What is the easiest way to create an Mtext object with the number of intersections 5 units below the center of the pline?&lt;/P&gt;&lt;P&gt;4. can the code be adjusted easily to loop through all selected polylines?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;@Anonymous&amp;nbsp; Attach sample drawing so that we can test your code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Is there a good way to select all lines in the vicinity of the polyline instead of all lines in the drawing?&lt;/P&gt;&lt;P&gt;You can add selection filter to ssget like "W" ....&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;</description>
      <pubDate>Mon, 25 Oct 2021 14:38:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10711992#M53522</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2021-10-25T14:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712016#M53523</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;....&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;1. Is there a good way to select all lines in the vicinity of the polyline instead of all lines in the drawing?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;2. Is there any reason it might be returning incorrect #s when all lines are selected?&lt;/P&gt;
&lt;P&gt;3. What is the easiest way to create an Mtext object with the number of intersections 5 units below the center of the pline?&lt;/P&gt;
&lt;P&gt;4. can the code be adjusted easily to loop through all selected polylines?&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;As a start on some of those:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (vla-get-boundingbox) &lt;/FONT&gt;&lt;/STRONG&gt;function will give you the extents of a Polyline:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; &lt;STRONG&gt;(vla-getboundingbox (vlax-ename-&amp;gt;vla-object &lt;FONT color="#00CCFF"&gt;PolylineEntityName&lt;/FONT&gt;) 'minpt 'maxpt)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; (setq&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; LL (vlax-safearray-&amp;gt;list minpt)&lt;/STRONG&gt;&lt;FONT color="#999999"&gt;; [ = &lt;FONT color="#000000"&gt;&lt;STRONG&gt;L&lt;/STRONG&gt;&lt;/FONT&gt;ower &lt;FONT color="#000000"&gt;&lt;STRONG&gt;L&lt;/STRONG&gt;&lt;/FONT&gt;eft corner ]&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; &amp;nbsp; &lt;STRONG&gt;UR (vlax-safearray-&amp;gt;list maxpt)&lt;/STRONG&gt;&lt;FONT color="#999999"&gt;; [ = &lt;FONT color="#000000"&gt;&lt;STRONG&gt;U&lt;/STRONG&gt;&lt;/FONT&gt;pper &lt;FONT color="#000000"&gt;&lt;STRONG&gt;R&lt;/STRONG&gt;&lt;/FONT&gt;ight corner ]&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Those corners can be used in an&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (ssget "_C") &lt;/FONT&gt;&lt;/STRONG&gt;function to select only Lines that might intersect the Polyline.&amp;nbsp; The point halfway between them will be the center of the Polyline's extents, and can be used with&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (polar) &lt;/FONT&gt;&lt;/STRONG&gt;to determine the insertion point for the [M]Text [plain Text should be sufficient, and will use less memory].&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would select Polylines with&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (ssget) &lt;/FONT&gt;&lt;/STRONG&gt;rather than&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (entsel) &lt;/FONT&gt;&lt;/STRONG&gt;if you want more than one, and use the same kind of:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;(repeat (setq i (sslength s))&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;technique to step through them to work with each.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 14:52:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712016#M53523</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-10-25T14:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712174#M53524</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is another approach&lt;/P&gt;&lt;P&gt;Select polyline, extract its coordinates, and create fence (F) selection set.&lt;/P&gt;&lt;P&gt;SSlength&amp;nbsp; will give us number of intersecting entitiels&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun ssf (pe filters / take pointlist2d po pts)
	(defun take (amount lst / ret)(repeat amount (setq ret (cons (car lst) (take (1- amount) (cdr lst))))))
	(defun pointlist2d (lst / ret) (while lst (setq	ret (cons (take 2 lst) ret) lst (cddr lst))) (reverse ret)) 
	(setq po (vlax-ename-&amp;gt;vla-object pe))
	(cond 
		((= (vlax-get po 'ObjectName) "AcDbPolyline")
			(cond 
				((not filters)(setq ss (ssget "_F" (pointlist2d (vlax-get po 'Coordinates)))))
				((and filters)(setq ss (ssget "_F" (pointlist2d (vlax-get po 'Coordinates)) filters)))
			)
		)
	)
	(if (and ss (ssmemb pe ss))(setq ss (ssdel pe ss)))
	ss
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Usage&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq ss (ssf (car(entsel)) '((0 . "LINE")(62 . 1))))&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;(setq ss (ssf (car(entsel)) nil))&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 25 Oct 2021 15:59:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712174#M53524</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2021-10-25T15:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712219#M53525</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5530556"&gt;@hak_vz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;Here is another approach&lt;/P&gt;
&lt;P&gt;Select polyline, extract its coordinates, and create fence (F) selection set.....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The possible problem with that comes when a Polyline contains&amp;nbsp;&lt;EM&gt;arc segments&lt;/EM&gt;.&amp;nbsp; If it does, depending on how far they bulge from the straight line between vertices, and depending on the relationship of the Line(s) you're looking for, a Fence selection built from the vertices might "see" Lines that do not intersection the Polyline, and/or it might &lt;EM&gt;not&lt;/EM&gt; see Lines that do.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 16:23:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712219#M53525</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-10-25T16:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712229#M53526</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;You are correct. I've created this according to sample posted in previous request from @Anonymous&amp;nbsp;&lt;/P&gt;&lt;P&gt;where he uses polyline with line segments. If selected polyline is in current view there should be no problem using this method.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 16:29:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712229#M53526</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2021-10-25T16:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712320#M53527</link>
      <description>&lt;P&gt;Regards&amp;nbsp;@Anonymous&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is possible that these lines of code for selection by fence instead of selection by window will help you.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="calderg1000_0-1635181532102.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/981451iF508E9E93F1803EE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="calderg1000_0-1635181532102.png" alt="calderg1000_0-1635181532102.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 17:10:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712320#M53527</guid>
      <dc:creator>calderg1000</dc:creator>
      <dc:date>2021-10-25T17:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712409#M53528</link>
      <description>&lt;P&gt;@&amp;nbsp;calderg1000 and&amp;nbsp;@&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;Kent1Cooper&lt;/SPAN&gt;&amp;nbsp;- It seems like you're both talking about the same method here - It looks promising to me but it seems to be underreporting in most cases. I think due to the nature of these polylines the selection box will need to be bigger. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I will attempt to troubleshoot what's happening when I select ALL lines - any insight on that would be appreciated because it seems like it should work but it overreports.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Code with select all:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;--------------------------------------------------------------------&lt;BR /&gt;;EONE Intersect Count from Kent Cooper with select all lines&lt;BR /&gt;;--------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;(defun c:EONEinterscountall ( / c i l s x ent sel2 ) ;;define function&lt;BR /&gt;(if&lt;BR /&gt;(and&lt;BR /&gt;(setq ent (car (entsel))) ;;selects Zone polyline&lt;BR /&gt;(setq sel2 (ssget "_X" '((0 . "LINE") (8 . "LPSLAT")))) ;;selects lateral lines&lt;BR /&gt;)&lt;BR /&gt;(progn ; wrap into ONE 'then' expression&lt;BR /&gt;(setq s (ssadd ent sel2)) ;;adds zone and laterals to same selection set&lt;/P&gt;&lt;P&gt;(repeat (setq i (sslength s)) ; selection set to list of VLA objects&lt;BR /&gt;(setq&lt;BR /&gt;i (1- i)&lt;BR /&gt;l (cons (vlax-ename-&amp;gt;vla-object (ssname s i)) l)&lt;BR /&gt;) ; setq&lt;BR /&gt;) ; repeat&lt;/P&gt;&lt;P&gt;(setq c 0)&lt;BR /&gt;(while (setq x (car l))&lt;BR /&gt;(foreach y (setq l (cdr l))&lt;BR /&gt;(setq c (+ c (/ (length (vlax-invoke x 'intersectwith y acextendnone)) 3)))&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(princ (strcat "\n" (itoa c) " intersection" (if (= 1 c) "" "s") " between " (itoa (sslength s)) " objects."))&lt;BR /&gt;) ; progn [end of 'then' expression]&lt;BR /&gt;(princ "\nPlease select more than one object.") ; 'else' expression&lt;BR /&gt;) ; if&lt;/P&gt;&lt;P&gt;(princ) ;;clean exit&lt;BR /&gt;) ; defun&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code with fence select:&lt;/P&gt;&lt;P&gt;;--------------------------------------------------------------------&lt;BR /&gt;;EONE Intersect Count from Kent Cooper with fence select&lt;BR /&gt;;--------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;(defun c:EONEinterscountmod ( / c i l s x ent sel2 ) ;;define function&lt;BR /&gt;(if&lt;BR /&gt;(and&lt;BR /&gt;(setq ent (car (entsel))) ;;selects Zone polyline&lt;BR /&gt;(setq entv(vlax-ename-&amp;gt;vla-object ent))&lt;BR /&gt;(setq p1(vlax-curve-getstartpoint entv)&lt;BR /&gt;p2(vlax-curve-getendpoint entv))&lt;BR /&gt;(setq sel2 (ssget "_f" (list p1 p2) '((0 . "LINE") (8 . "LPSLAT")))) ;;selects lateral lines&lt;BR /&gt;)&lt;BR /&gt;(progn ; wrap into ONE 'then' expression&lt;BR /&gt;(setq s (ssadd ent sel2)) ;;adds zone and laterals to same selection set&lt;/P&gt;&lt;P&gt;(repeat (setq i (sslength s)) ; selection set to list of VLA objects&lt;BR /&gt;(setq&lt;BR /&gt;i (1- i)&lt;BR /&gt;l (cons (vlax-ename-&amp;gt;vla-object (ssname s i)) l)&lt;BR /&gt;) ; setq&lt;BR /&gt;) ; repeat&lt;/P&gt;&lt;P&gt;(setq c 0)&lt;BR /&gt;(while (setq x (car l))&lt;BR /&gt;(foreach y (setq l (cdr l))&lt;BR /&gt;(setq c (+ c (/ (length (vlax-invoke x 'intersectwith y acextendnone)) 3)))&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(princ (strcat "\n" (itoa c) " intersection" (if (= 1 c) "" "s") " between " (itoa (sslength s)) " objects."))&lt;BR /&gt;) ; progn [end of 'then' expression]&lt;BR /&gt;(princ "\nPlease select more than one object.") ; 'else' expression&lt;BR /&gt;) ; if&lt;BR /&gt;(princ) ;;clean exit&lt;BR /&gt;) ; defun&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 17:59:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712409#M53528</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-25T17:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712459#M53529</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;@&amp;nbsp;calderg1000 and&amp;nbsp;@&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;Kent1Cooper&lt;/SPAN&gt;&amp;nbsp;- It seems like you're both talking about the same method here ....&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No, they're quite different:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kent1Cooper_0-1635186450611.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/981482i8FE2BB899F63C72B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kent1Cooper_0-1635186450611.png" alt="Kent1Cooper_0-1635186450611.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A Fence selection using only the start and end points of the Polyline will miss many of the Lines, but a Crossing-window selection using opposite corners of its bounding box will find them all.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 18:27:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712459#M53529</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-10-25T18:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712516#M53530</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;- I see what you mean now - yes they are quite different.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I gave yours a shot and I can't seem to get it to return intersections. Maybe I'm just missing something silly? It ends up returning the "Please select more than 1 object" as if there were no selections by the bounding box portion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;--------------------------------------------------------------------&lt;BR /&gt;;EONE Intersect Count from Kent Cooper with crossing select&lt;BR /&gt;;--------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;(defun c:EONEinterscountmod ( / c i l s x ent sel2 LL UR ) ;;define function&lt;BR /&gt;(if&lt;BR /&gt;(and&lt;BR /&gt;(setq ent (car (entsel (Select Zone Polyline)))) ;;selects Zone polyline&lt;BR /&gt;&lt;BR /&gt;(vla-getboundingbox (vlax-ename-&amp;gt;vla-object ent) 'minpt 'maxpt) ;gets bounding box of zone polyline&lt;BR /&gt;&lt;BR /&gt;(setq&lt;BR /&gt;LL (vlax-safearray-&amp;gt;list minpt); [ = Lower Left corner ]&lt;BR /&gt;UR (vlax-safearray-&amp;gt;list maxpt); [ = Upper Right corner ]&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(setq sel2 (ssget "_C" '(LL) '(UR) '((0 . "LINE") (8 . "LPSLAT")))) ;;selects lateral lines based on min and max points of bounding box&lt;BR /&gt;)&lt;BR /&gt;(progn ; wrap into ONE 'then' expression&lt;BR /&gt;(setq s (ssadd ent sel2)) ;;adds zone and laterals to same selection set&lt;/P&gt;&lt;P&gt;(repeat (setq i (sslength s)) ; selection set to list of VLA objects&lt;BR /&gt;(setq&lt;BR /&gt;i (1- i)&lt;BR /&gt;l (cons (vlax-ename-&amp;gt;vla-object (ssname s i)) l)&lt;BR /&gt;) ; setq&lt;BR /&gt;) ; repeat&lt;/P&gt;&lt;P&gt;(setq c 0)&lt;BR /&gt;(while (setq x (car l))&lt;BR /&gt;(foreach y (setq l (cdr l))&lt;BR /&gt;(setq c (+ c (/ (length (vlax-invoke x 'intersectwith y acextendnone)) 3)))&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(princ (strcat "\n" (itoa c) " intersection" (if (= 1 c) "" "s") " between " (itoa (sslength s)) " objects."))&lt;BR /&gt;) ; progn [end of 'then' expression]&lt;BR /&gt;(princ "\nPlease select more than one object.") ; 'else' expression&lt;BR /&gt;) ; if&lt;BR /&gt;(princ) ;;clean exit&lt;BR /&gt;) ; defun&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 18:44:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712516#M53530</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-25T18:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712556#M53531</link>
      <description>&lt;P&gt;FYI - posting your code using the '&amp;lt;/&amp;gt;' "Insert/Edit code sample' tool preserved formatting such as indents, and makes it easier to pick out from the rest of the post.&amp;nbsp; Like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun this_function ( arg1 / val1 val2)
   (princ "\nThis is a sample function.")
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 19:04:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712556#M53531</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2021-10-25T19:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712557#M53532</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Try this:&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &lt;FONT color="#000000"&gt;(setq sel2 (ssget "_C"&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;LL UR&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#000000"&gt; '((0 . "LINE") (8 . "LPSLAT"))))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;without&lt;/EM&gt; putting &lt;FONT color="#0000FF"&gt;those variable names&lt;/FONT&gt; into "quoted lists" [which, in this case, would be for coordinate numbers not requiring any evaluation the way reading a variable does].&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 19:25:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712557#M53532</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-10-25T19:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712613#M53533</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;(while (setq x (car l))&lt;BR /&gt;&amp;nbsp; (foreach y (setq l (cdr l))&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That seems an unnecessary part of the process.&amp;nbsp; It would not only look for intersections between the Polyline [main in a street?] and each Line [lateral], but also &lt;EM&gt;between every Line and every other Line&lt;/EM&gt; in the selection.&amp;nbsp; Is that really the intent?&amp;nbsp; Do the lateral Lines ever intersect each other?&amp;nbsp; [It doesn't look like it in the sample drawing.]&amp;nbsp; Can't you just look for intersections between the Polyline and each Line?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or do I misunderstand what's going on?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 19:31:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712613#M53533</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-10-25T19:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712972#M53534</link>
      <description>&lt;P&gt;For question 1:&amp;nbsp;&lt;/P&gt;&lt;P&gt;For lines, or whatever, at the initial pick point, one could use the SSGET function with the "C" argument; about a million google examples ...&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 23:24:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10712972#M53534</guid>
      <dc:creator>stevor</dc:creator>
      <dc:date>2021-10-25T23:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10713225#M53535</link>
      <description>&lt;P&gt;My $0.05 there is another intersections post recently, the method I used was to get a entity and compare it to other entities using intersectwith, the example dwg has Plines and Lines, so make 2 lists, plines and lines, get a pline and compare lines if intersects do something, and remove from lines list. Keep going till end of lines. Get new pline do again. Arc not a problem. Now where did I put it.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 03:46:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10713225#M53535</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2021-10-26T03:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10714059#M53536</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;:&lt;BR /&gt;&lt;BR /&gt;Yes I can - I am not looking for intersections between lines and other lines - your assessment of the real world application is spot-on - intersection between mains and laterals.&lt;BR /&gt;l'll look at removing this portion to make it more elegant and less error prone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDITED:&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;how would you change this to just evaluate a pline against the lines? I'm having a tough time understanding these v___ commands, any advice would be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 12:40:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10714059#M53536</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-26T12:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10714138#M53537</link>
      <description>&lt;P&gt;Good Morning all and thank you all for your help - the response has been overwhelming and very educational!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a bit of a&amp;nbsp; mini-breakthrough in troubleshooting this - I discovered that the the overcounting of intersections when I select ALL lines is due to there being duplicate laterals on top of one another - exactly 9 of them. Eliminating the portion of the code that looks at intersections between lines and lines should fix this issue and allow me to finish out the bells and whistles. - I'll look at this this morning and see what I can do to adjust that section. I did not write that portion so it may take some time for me to wrap my head around it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 11:36:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10714138#M53537</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-26T11:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10715110#M53538</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I decided to try a different approach using a called function developed by &lt;A href="http://lee-mac.com/intersectionfunctions.html" target="_blank" rel="noopener"&gt;lee mac&lt;/A&gt; to generate a list of intersection points. I then attempted to get the length of this list and use that as the number of intersections. Something is going haywire with the first two ssget lines - i don't understand why it's happening, it should be simple but it's not allowing me to select properly. I'm trying to select a single polyline and all lines as my selection sets and then generate the list with lee mac's function. Is there something simple I'm missing?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;;--------------------------------------------------------------------
;EONE Intersect Count from Kent Cooper with select all lines
;--------------------------------------------------------------------

(defun c:EONEinterscountall ( / c s x ss1 ss2 XSECL ) ;;define function

(setq ss1 (ssget ":S" '((0 . "POLYLINE")(8 . "LPS")))) ;;selects Zone polyline
(setq ss2 (ssget "_X" '((0 . "LINE") (8 . "LPSLAT")))) ;;selects lateral lines.

  (if (/= ss1 nil) ;; if ss1 exists
    
    (progn ; wrap into ONE 'then' expression 
      
      (setq XSECL (LM:intersectionsbetweensets ss1 ss2)) ;; obtains list of intersections
      
      (setq c (length XSECL)) ;; obtains number of intersection points   
      
      (princ (strcat "\n" (itoa c) " intersection" (if (= 1 c) "" "s") " between " (itoa (sslength s)) " objects."))
      
    ) ; progn [end of 'then' expression]
    (princ "\nPlease select a zone polyline.") ; 'else' expression
  ) ; if

  (princ) ;;clean exit
) ; defun&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 16:59:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10715110#M53538</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-26T16:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10715330#M53539</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp; For your particular case where lines are created so they join base polyline, here is solution that don't uses intersections at all. Start and end points of all lines in layer LPSLAT are collected into a list and then code asks you to select some polyline. For each point in point list whose distance to polyline is less then 1e-5 counter steps up. Value of counter is created at distance 5 bellow polyline center point as a text and converted to mtext.&amp;nbsp; Change value of text height ( I choose 25) and name of the function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:blabla ( / *error* pick_poly ss i pts po tp)
	(defun *error* ( msg )
		(if (not (member msg '("Function cancelled" "quit / exit abort")))
			(princ)
		)
		(setvar 'cmdecho 1)
		(princ)
	)
	(defun pick_poly ()
		(setq e (entsel "\nPick polyline &amp;gt;"))
		(if (and (not e) (= (getvar 'Errno) 7)) (pick_poly) e)
	)
	(setq 
		ss (ssget "X" '((0 . "LINE")(8 . "LPSLAT")))
		i -1
		pts nil
	)
	(while (&amp;lt; (setq i (1+ i)) (sslength ss))
		(setq lo (vlax-ename-&amp;gt;vla-object (ssname ss i)))
		(setq pts (cons (vlax-curve-getStartPoint lo) pts))
		(setq pts (cons (vlax-curve-getEndPoint lo) pts))
	)

	(while (and (setq pe (car(pick_poly))))	
		(setq i 0)
		(setq po (vlax-ename-&amp;gt;vla-object pe))
		(setq tp (mapcar '+ (vlax-curve-getpointatdist po (* 0.5 (vla-get-Length po))) '(0 -5)))
		(foreach pt pts
			(if (&amp;lt; (distance (vlax-curve-getClosestPointTo po pt) pt) 1e-5)(setq i (1+ i)))
		)
		(setvar 'cmdecho 0)
		(command "_.text" tp 25 0  (itoa i))
		(command "_.txt2mtxt" (entlast) "")
		(setvar 'cmdecho 1)
	)
	(princ "\nDone!")
	(princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 18:32:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10715330#M53539</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2021-10-26T18:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: Request for advice regarding an intersection counting LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10715397#M53540</link>
      <description>@ hak_vz - this works really well! Thanks so much for your input. I would still like to explore how to make it work with the intersection method but this will certainly work for my application and improve my workflow.</description>
      <pubDate>Tue, 26 Oct 2021 18:54:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-advice-regarding-an-intersection-counting-lisp/m-p/10715397#M53540</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-26T18:54:07Z</dc:date>
    </item>
  </channel>
</rss>

