Zoltan Posted January 13, 2022 Posted January 13, 2022 I need a lisp that draws a polyline at the intersections of other polylines and where these intersections will be verticies. On the picture below, where the blue lines cross the red line, i want the lisp to draw a polyline where the crossing points will be vertices. Could someone help me with this? I have no clue how to do it. Thanks, Zoltan https://ibb.co/443gYg5 Quote
mhupp Posted January 13, 2022 Posted January 13, 2022 (edited) Pulled mostly from here (defun c:interset (/ spm sel lst) (vl-load-com) (if (setq sel (ssget)) (setq lst (LM:intersectionsinset sel)) ;Sort points left to right (setq tlst (mapcar 'cadr (vl-sort tlst '(lambda (a b) (if (equal (caar a) (caar b) 1e-6) (< (car (car a)) (car (car b))) ) ) ) ) ) ) (entmake (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length lst)) (cons 70 0) ) (mapcar (function (lambda (p) (cons 10 p))) lst) ) ) (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) ) Edited January 13, 2022 by mhupp added prompts Quote
BIGAL Posted January 13, 2022 Posted January 13, 2022 Turn off Blue lines, add end lines to the 2 plines, do Bpoly, delete the 2 end lines, turn on blues lines. No complicated code needed. Could be done in a lisp. So if this is for hatch can do selecting bpoly. Quote
ronjonp Posted January 13, 2022 Posted January 13, 2022 (edited) You could also use CAB's break code then pedit join. Edited January 13, 2022 by ronjonp 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.