Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/21/2021 in all areas

  1. You have many overlapping texts in many places so its better to overkill the duplicates. (defun c:Test ( / int sel ent get ins txt src tar srt) ;; Tharwat - 21.Nov.2021 ;; (and (setq int -1 sel (ssget "_:L" '((0 . "TEXT") (8 . "urb_rasante,CVL_RAS_TX")))) (while (setq int (1+ int) ent (ssname sel int)) (setq get (entget ent) ins (cdr (assoc 10 get)) txt (cdr (assoc 01 get)) ) (or (and (= (cdr (assoc 8 get)) "CVL_RAS_TX") (setq src (cons (list ins txt get) src)) ) (setq tar (cons (list ins txt get) tar)) ) ) (while (and src tar (setq itm (car tar)) (setq srt (vl-sort src (function (lambda (j k) (< (distance (car itm) (car j)) (distance (car itm) (car k))) ) ) ) ) (entmod (subst (cons 1 (cadar srt)) (assoc 1 (last itm)) (last itm))) (setq tar (cdr tar) src (cdr srt)) ) ) ) (princ) ) (vl-load-com)
    2 points
  2. @CADTutor Thanks David yup the ads are gone.
    1 point
  3. Here is what i came up with. Basically the same as yours except using foreach function looking at 72 to get the correct point. Ignore distance. so if *dist = 25 but closest text is 35 it won't change Removes changed text from selection set to speed up later searches. removing text also speed up if their are more entity's in SS1 then SS2. ;;----------------------------------------------------------------------------;; ;; Select multiples texts and copy their content to nearest texts (defun C:CMT (/ dist *dist PT1 PT2 ent ss1 ss2 obj) (setvar "cmdecho" 0) (vl-cmdf "_.undo" "_begin") (setq *osmode (getvar "osmode")) (setvar "osmode" 0) (setq SS1 (ssget "_X" '((0 . "TEXT") (8 . "cvl_ras_tx"))) ;copy SS2 (ssget "_X" '((0 . "TEXT") (8 . "urb_rasante"))) ;replace ) (if SS1 (foreach txt1 (mapcar 'cadr (ssnamex SS1)) (if (= (cdr (assoc 72 (entget txt1))) 0) (setq PT1 (cdr (assoc 10 (entget txt1)))) (setq PT1 (cdr (assoc 11 (entget txt1)))) ) (setq *dist 1000 ;change *dist value to ignore items farther away but still cloest item. ent nil ;resets ent error checking if match is made. ) (if (> (sslength SS2) 0) (progn (foreach txt2 (mapcar 'cadr (ssnamex SS2)) (if (= (cdr (assoc 72 (entget txt2))) 0) (setq PT2 (cdr (assoc 10 (entget txt2)))) (setq PT2 (cdr (assoc 11 (entget txt2)))) ) (setq dist (distance PT1 PT2)) (if (< dist *dist) (progn (setq *dist dist) (setq ent txt2) ) ) ) (if ent ;might not be any matches if beond ignore distance (progn (setq tx1 (assoc 1 (entget txt1))) (setq obj (entget ent)) (entmod (subst tx1 (assoc 1 obj) obj)) (ssdel ent SS2) ;removes changed text from selection set so later searches are faster ) ) ) ) ) ) (setvar "osmode" *osmode) (vl-cmdf "_.undo" "_end") (princ) )
    1 point
  4. mhupp looks like no for 3d lines crossing, the only idea I have is work out in 2d the xy of the intersection point then can work out the 3d pt for the two 3d lines.
    1 point
  5. Another way is use the text pt and make a polygon can be just 4 sides a few more sides can work better, then get its co-ordinates, then erase (entlast) a simple (ssget "CP" co-ords (list (cons 0 "TEXT")(cons 8 layer))) this saves searching through the other text selection set. (command "ploygon" Pt "I" rad) (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent))))) (command "erase" (entlast) "") (setq ss (ssget "CP" co-ords (list (cons 0 "TEXT")(cons 8 layer))))
    1 point
×
×
  • Create New...