Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/03/2024 in all areas

  1. @Jamesclark64 This can do the job? (vl-load-com) (defun cut@point (ss lst_pt / n ename dxf_10 rtn_ss pt_brk lst_brk lst_sort dxf_obj dxf_43 dxf_38 dxf_39 dxf_10 dxf_40 dxf_41 dxf_42 dxf_210 ltmp lst_tmp where count nwent indx) (repeat (setq n (sslength ss)) (setq ename (ssname ss (setq n (1- n))) dxf_10 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ename))) rtn_ss (ssadd) ) (foreach el (mapcar '(lambda (x) (trans x 0 ename)) lst_pt) (setq pt_brk el lst_brk (cons el lst_brk) ) ) (setq lst_sort (mapcar '(lambda (x) (list (vlax-curve-GetDistAtPoint ename (trans x ename 0)) (list (car x) (cadr x)))) lst_brk) lst_brk (reverse (mapcar 'cadr (mapcar '(lambda (x) (assoc x lst_sort)) (vl-sort (mapcar 'car lst_sort) '<)))) dxf_obj (entget ename) ) (if (cdr (assoc 43 dxf_obj)) (setq dxf_43 (cdr (assoc 43 dxf_obj))) (setq dxf_43 0.0) ) (if (cdr (assoc 38 dxf_obj)) (setq dxf_38 (cdr (assoc 38 dxf_obj))) (setq dxf_38 0.0) ) (if (cdr (assoc 39 dxf_obj)) (setq dxf_39 (cdr (assoc 39 dxf_obj))) (setq dxf_39 0.0) ) (setq dxf_10 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) dxf_obj)) dxf_40 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 40)) dxf_obj)) dxf_41 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 41)) dxf_obj)) dxf_42 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 42)) dxf_obj)) dxf_210 (cdr (assoc 210 dxf_obj)) ) (if (not (zerop (boole 1 (cdr (assoc 70 dxf_obj)) 1))) (setq dxf_10 (append dxf_10 (list (car dxf_10))) dxf_40 (append dxf_40 (list (car dxf_40))) dxf_41 (append dxf_41 (list (car dxf_41))) dxf_42 (append dxf_42 (list (car dxf_42))) ) ) (repeat (1+ (length lst_brk)) (setq ltmp nil lst_tmp (vl-member-if '(lambda (x) (and (equal (car x) (caar lst_brk) 1E-08) (equal (cadr x) (cadar lst_brk) 1E-08))) dxf_10) where (if lst_tmp (vl-position (car lst_tmp) dxf_10) 0) ) (repeat (setq count (- (length dxf_10) where)) (setq ltmp (cons (mapcar '(lambda (x y) (cons y (nth where x))) (list dxf_10 dxf_40 dxf_41 dxf_42) (list 10 40 41 42)) ltmp)) (setq where (1+ where)) ) (entmake (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (assoc 67 dxf_obj) (assoc 410 dxf_obj) (assoc 8 dxf_obj) (if (assoc 62 dxf_obj) (assoc 62 dxf_obj) (cons 62 256)) (if (assoc 6 dxf_obj) (assoc 6 dxf_obj) (cons 6 "BYLAYER")) (if (assoc 370 dxf_obj) (assoc 370 dxf_obj) (cons 370 -1)) (cons 100 "AcDbPolyline") (cons 90 (length ltmp)) (cons 70 (boole 1 (cdr (assoc 70 dxf_obj)) 128)) (cons 38 dxf_38) (cons 39 dxf_39) ) (apply 'append (reverse ltmp)) (list (cons 210 dxf_210)) ) ) (repeat (1- count) (setq dxf_10 (reverse (cdr (reverse dxf_10))) dxf_40 (reverse (cdr (reverse dxf_40))) dxf_41 (reverse (cdr (reverse dxf_41))) dxf_42 (reverse (cdr (reverse dxf_42))) ) ) (setq lst_brk (cdr lst_brk) ltmp nil nwent (entlast) rtn_ss (ssadd nwent rtn_ss)) ) (setq indx (1- (sslength rtn_ss))) (repeat (sslength rtn_ss) (if (eq (boole 1 indx 1) 1) (entdel (ssname rtn_ss indx)) ) (setq indx (1- indx)) ) (entdel ename) ) ) (defun c:altern_poly ( / ss n ss_save ent dxf_ent lst_pt brk_pt) (while (not (setq ss (ssget '((0 . "LWPOLYLINE")))))) (repeat (setq n (sslength ss)) (setq ss_save (ssadd) ent (ssname ss (setq n (1- n))) ss_save (ssadd ent ss_save) dxf_ent (entget ent) lst_pt (mapcar 'cdr (vl-remove-if '(lambda (x) (/= (car x) 10)) dxf_ent)) ) (if (equal (append (car lst_pt) (list (getvar "ELEVATION"))) (vlax-curve-getendpoint ent) 1E-08) (setq lst_pt (append lst_pt (list (car lst_pt)))) ) (if (>= (length lst_pt) 3) (progn (setq brk_pt nil) (while (and lst_pt (cadddr lst_pt)) (setq brk_pt (cons (caddr lst_pt) brk_pt) lst_pt (cdddr lst_pt) brk_pt (cons (car lst_pt) brk_pt) ) ) (if (eq (boole 1 (cdr (assoc 70 dxf_ent)) 1) 1) (setq brk_pt (cdr brk_pt))) (cut@point ss_save brk_pt) ) ) ) (prin1) )
    1 point
  2. I believe any command that is built-in to AutoCAD is proprietary product and cannot be disclosed to the public. However, some built-in AutoLISP commands, for example, the Express Tools of AutoCAD, are all saved in your local computer and can be viewed anytime under your directory "C:\Program Files\Autodesk\AutoCAD 2021\Express" (assuming your CAD version is 2021). Anyways, that aside, just as the previous comment suggested, finding a point that overlaps with basically any curve is relatively easy. But finding the overlaps of two curves, even between two polylines as shown below, is not easy.
    1 point
  3. Best thing is to post a sample dwg to see what exactly you want. To find overlapping POLYLINE & POINT, or in other words find points on polyline is relatively easy
    1 point
  4. Sorry, I forgot to mention.. ATTIPE=1 will use Full Text Editor with Attributes.
    1 point
×
×
  • Create New...