<?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: Comparing intersection points in a selection set in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9713617#M70897</link>
    <description>&lt;P&gt;Not an answer to your question, but your selection filter can be simplified to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq ss (ssget '((0 . "~HATCH"))))&lt;/LI-CODE&gt;&lt;P&gt;Just tested your code; Picked the end of the leader then selected all. It returned: 'Success!'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the purpose of this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Aug 2020 19:21:13 GMT</pubDate>
    <dc:creator>ronjonp</dc:creator>
    <dc:date>2020-08-26T19:21:13Z</dc:date>
    <item>
      <title>Comparing intersection points in a selection set</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9713309#M70895</link>
      <description>&lt;P&gt;I'm trying to allow a user to select a point, then perform a check to see if it's a valid intersection between all selected entities which will then return the entities that resulted in the intersection.&amp;nbsp; I'm using a modified version of Lee Mac's C:Interset&amp;nbsp;&lt;A href="http://www.lee-mac.com/intersectionfunctions.html" target="_blank"&gt;http://www.lee-mac.com/intersectionfunctions.html&lt;/A&gt;&amp;nbsp;to make this comparison.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun C:inttest (/ id1 id2 od1 od2)
	(setq origin (getpoint "\nSelect Origin Point"))
	(setq ss (ssget '((-4 . "&amp;lt;NOT") (0 . "HATCH") (-4 . "NOT&amp;gt;"))))
	(setq id1 (sslength ss))
	
	(while (and (not (equal origin rtnpt 0.003)) (not (equal id1 0))) 
		(setq ob1 (vlax-ename-&amp;gt;vla-object (ssname ss (setq id1 (- id1 1)))))
		(repeat (setq id2 id1)
			(setq ob2 (vlax-ename-&amp;gt;vla-object (ssname ss (setq id2 (1- id2)))))
			(if (setq rtnpt (car (LM:intersections ob1 ob2 acextendboth)))
				(setq rtn (cons rtnpt rtn))
			)
		)
	)
(if (not (equal origin rtnpt 0.003)) (progn (alert "Part origin not found, please try again") (Quit))) ;Parity Check
(princ "\nSuccess!")
)


;; Intersections  -  Lee Mac
;; Returns a list of all points of intersection between two objects
;; for the given intersection mode.
;; ob1,ob2 - [vla] VLA-Objects
;;     mod - [int] acextendoption enum of intersectwith method

(defun LM:intersections ( ob1 ob2 mod / lst rtn )
    (if (and (vlax-method-applicable-p ob1 'intersectwith)
             (vlax-method-applicable-p ob2 'intersectwith)
             (setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
        )
        (repeat (/ (length lst) 3)
            (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
                  lst (cdddr lst)
            )
        )
    )
    (reverse rtn)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;In the attached drawings, I've drawn a leader pointing to the only intersection in my test document that passes the parity check. I can't seem to determine why as it should be able to pass when any intersection point is selected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any insight into why this is happening?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 16:28:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9713309#M70895</guid>
      <dc:creator>SORONW</dc:creator>
      <dc:date>2020-08-26T16:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing intersection points in a selection set</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9713606#M70896</link>
      <description>&lt;P&gt;Does this provide the expected result:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:test ( / pt ss fuzz ctr1 ctr2 obj1 obj2 entsLst)

(if (and
(setq pt (getpoint "\nPick a point, to check for intersections: "))
(setq ss (ssget '((-4 . "&amp;lt;NOT") (0 . "HATCH") (-4 . "NOT&amp;gt;"))))
)
(progn

(setq ctr1 0 fuzz 0.003)
(repeat (sslength ss)
(setq obj1 (vlax-ename-&amp;gt;vla-object (ssname ss ctr1)))

(if (vlax-method-applicable-p obj1 'intersectwith)
(progn

(setq ctr2 0)
(repeat (sslength ss)
(setq obj2 (vlax-ename-&amp;gt;vla-object (ssname ss ctr2)))
(if (vlax-method-applicable-p obj2 'intersectwith)
(if (and (equal (vlax-invoke obj1 'intersectwith obj2 acextendboth) pt fuzz)
	 (not (vl-position (list (ssname ss ctr2) (ssname ss ctr1)) entsLst))
	 )
(setq entsLst (cons (list (ssname ss ctr1) (ssname ss ctr2)) entsLst))
)
)
(setq ctr2 (1+ ctr2))
);repeat inner

));if obj1 can intersect

(setq ctr1 (1+ ctr1))
);repeat

(if entsLst
(alert (strcat "\nThese entities intersect at " (vl-princ-to-string pt) " :\n" (vl-princ-to-string entsLst)))
(alert (strcat "\nNo entities intersect at " (vl-princ-to-string pt)))
)
));if ss and pt

(princ)
);defun&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 19:11:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9713606#M70896</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2020-08-26T19:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing intersection points in a selection set</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9713617#M70897</link>
      <description>&lt;P&gt;Not an answer to your question, but your selection filter can be simplified to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq ss (ssget '((0 . "~HATCH"))))&lt;/LI-CODE&gt;&lt;P&gt;Just tested your code; Picked the end of the leader then selected all. It returned: 'Success!'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the purpose of this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 19:21:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9713617#M70897</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2020-08-26T19:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing intersection points in a selection set</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9713649#M70898</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1166654"&gt;@doaiena&lt;/a&gt;I've only tested it a little bit, but it looks like this will work better than my approach, especially with how it handles potential multiple intersections.&amp;nbsp; Thank you for the help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/593837"&gt;@ronjonp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, I never knew that the "~" could be used as a modifier like that, is that standard for selection set filters?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should have worded it more clearly, the leader was the only point where the code worked, but my understanding was that it should have succeeded at all the intersecting points of the shape.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its a segment from a larger lisp for processing a selection set to transfer coordinate data to a profile fabrication database. This segment was to define the origin point, validate it as a potential origin, and retrieve the lines that intersected&amp;nbsp; to get the relative angle of the shape.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 19:34:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9713649#M70898</guid>
      <dc:creator>SORONW</dc:creator>
      <dc:date>2020-08-26T19:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing intersection points in a selection set</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9713897#M70899</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/593837"&gt;@ronjonp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, I never knew that the "~" could be used as a modifier like that, is that standard for selection set filters?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its a segment from a larger lisp for processing a selection set to transfer coordinate data to a profile fabrication database. This segment was to define the origin point, validate it as a potential origin, and retrieve the lines that intersected&amp;nbsp; to get the relative angle of the shape.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The filters are mostly common for WCMATCH input .. take a look &lt;A href="http://docs.autodesk.com/ACD/2011/ENU/filesALR/WS1a9193826455f5ff1a32d8d10ebc6b7ccc-6754.htm" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is some quick code to spit out intersections of a selection set .. have fun &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(defun c:test (/ lm:intersections i o r ss)
  ;; Intersections  -  Lee Mac
  ;; Returns a list of all points of intersection between two objects
  ;; for the given intersection mode.
  ;; ob1,ob2 - [vla] VLA-Objects
  ;;     mod - [int] acextendoption enum of intersectwith method
  (defun lm:intersections (ob1 ob2 mod / lst rtn)
    (if	(and (vlax-method-applicable-p ob1 'intersectwith)
	     (vlax-method-applicable-p ob2 'intersectwith)
	     (setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
	)
      (repeat (/ (length lst) 3)
	(setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
	      lst (cdddr lst)
	)
      )
    )
    (reverse rtn)
  )
  (if
    ;; RJP » 2020-08-26
    (and (setq ss (ssget '((0 . "~HATCH"))))
	 (setq ss (mapcar 'vlax-ename-&amp;gt;vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))))
    )
     (progn (while (cadr ss)
	      (setq o (car ss))
	      (foreach x (setq ss (cdr ss))
		(if (setq i (lm:intersections o x acextendnone))
		  (setq r (cons i r))
		)
	      )
	    )
	    (print (apply 'append (reverse r)))
     )
  )
  (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 22:20:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9713897#M70899</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2020-08-26T22:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing intersection points in a selection set</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9714022#M70900</link>
      <description>&lt;P&gt;I like the way you set up the ss var&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/593837"&gt;@ronjonp&lt;/a&gt;&amp;nbsp;. It's a bit harder to read/understand, but i admire the approach. Also, your way of cycling the objects doesn't allow for the error that i made (i check an object against itself).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Compact and to the point. Should be marked as a solution, as i feel the code is better than what i provided.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 00:55:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9714022#M70900</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2020-08-27T00:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing intersection points in a selection set</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9715434#M70901</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1166654"&gt;@doaiena&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I like the way you set up the ss var&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/593837"&gt;@ronjonp&lt;/a&gt;&amp;nbsp;. It's a bit harder to read/understand, but i admire the approach. Also, your way of cycling the objects doesn't allow for the error that i made (i check an object against itself).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Compact and to the point. Should be marked as a solution, as i feel the code is better than what i provided.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks for the compliment!&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":clinking_beer_mugs:"&gt;🍻&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":clinking_beer_mugs:"&gt;🍻&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 15:10:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9715434#M70901</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2020-08-27T15:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing intersection points in a selection set</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9715545#M70902</link>
      <description>&lt;P&gt;After brief testing, I found that selecting more than 2 lines fails, but selecting just 2 lines that appear to intersect is successful.&amp;nbsp; I think this is due to the repeat, which may find a qualified rtnpt for the first comparisons (say #1 and #2) but subsequently does not for #1 and #3.&lt;/P&gt;
&lt;P&gt;Try skipping the repeat line.&amp;nbsp; Your while loop should take care of things without the repeat because it will stop at the first qualified intersection.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 15:59:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/comparing-intersection-points-in-a-selection-set/m-p/9715545#M70902</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2020-08-27T15:59:18Z</dc:date>
    </item>
  </channel>
</rss>

