Intersection points

Intersection points

Anonymous
Not applicable
719 Views
3 Replies
Message 1 of 4

Intersection points

Anonymous
Not applicable

Any lsp program for searching/selecting/calculating the number of intersecting points ? If yes, can we number them in autocad ex. 1, 2, 3, 4 etc. 

Thanks in advance 😊

0 Likes
720 Views
3 Replies
Replies (3)
Message 2 of 4

hak_vz
Advisor
Advisor

@Anonymous wrote:

Any lsp program for searching/selecting/calculating the number of intersecting points ? If yes, can we number them in autocad ex. 1, 2, 3, 4 etc. 

Thanks in advance 😊


Almost everything can be done, but try to be more specific. Describe your problem in details, what and how you want it to be done, provide sample drawing.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 3 of 4

ВeekeeCZ
Consultant
Consultant

Perhaps something like this, from HERE 

 

(defun c:NumberOfIntersections ( / sel int)
    (if (setq sel (ssget))
      (princ (itoa (length (cond ((setq int (LM:intersectionsinset sel)))
				 ('()))))))
    (princ)
)
(vl-load-com) (princ)


;; Intersections in Set  -  Lee Mac
;; Returns a list of all points of intersection between all objects in a supplied selection set.
;; sel - [sel] Selection Set

(defun LM:intersectionsinset ( sel / id1 id2 ob1 ob2 rtn )
    (repeat (setq id1 (sslength sel))
        (setq ob1 (vlax-ename->vla-object (ssname sel (setq id1 (1- id1)))))
        (repeat (setq id2 id1)
            (setq ob2 (vlax-ename->vla-object (ssname sel (setq id2 (1- id2))))
                  rtn (cons (LM:intersections ob1 ob2 acextendnone) rtn)
            )
        )
    )
    (apply 'append (reverse rtn))
)

;; 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)
)
0 Likes
Message 4 of 4

Anonymous
Not applicable

Thanks @ВeekeeCZ 

 

I will test it and get back on this. 

 

 

0 Likes