Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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. I'm using a modified version of Lee Mac's C:Interset http://www.lee-mac.com/intersectionfunctions.html to make this comparison.
(defun C:inttest (/ id1 id2 od1 od2)
(setq origin (getpoint "\nSelect Origin Point"))
(setq ss (ssget '((-4 . "<NOT") (0 . "HATCH") (-4 . "NOT>"))))
(setq id1 (sslength ss))
(while (and (not (equal origin rtnpt 0.003)) (not (equal id1 0)))
(setq ob1 (vlax-ename->vla-object (ssname ss (setq id1 (- id1 1)))))
(repeat (setq id2 id1)
(setq ob2 (vlax-ename->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)
)
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.
Any insight into why this is happening?
Solved! Go to Solution.