alhlhli Posted February 15 Posted February 15 Hi All Engineer Here is the door or window symbol and its number below it I need to merge the two texts into one text I was using the txt2mtxt function But you only need to select every two that are close together If all are selected, there will be a problem Is there a Lisp for this process? So that it recognizes writings that are close to each other and combines them https://www12.0zz0.com/2024/02/15/09/496206091.png Quote
alhlhli Posted February 15 Author Posted February 15 By artificial intelligence I extracted this lisp but it didn't work It may need a little modification (defun c:MergeCloseTexts ( ) (setq entlist (ssget)) (while (entnext entlist) (setq ent (entnext entlist)) (if (and (eq (enttype ent) "TEXT") (not (zerop (distance (getpoint ent) (getpoint (entnext ent)))))) (command "_.txt2mtxt" ent (entnext ent)) ) ) ) FF_DOOR_WINDOWS.dwg Quote
fuccaro Posted February 15 Posted February 15 I am not as smart as AI, so my program is longer: (defun c:pp() (setq ss (ssget "I" (list '(0 . "TEXT"))) d (getdist "max distance? ")) (while (> (sslength ss) 0) (setq t1 (ssname ss 0) poz1 (cdr (assoc 10 (entget t1)))) (ssdel t1 ss) (setq i -1 gotIt nil) (while (not gotIt) (setq t2 (ssname ss (setq i (1+ i))) poz2 (cdr (assoc 10 (entget t2))) gotIt (< (distance poz1 poz2) d)) ) (ssdel t2 ss) (bind t1 t2) ) ) (defun bind (a b) (setq ya (caddr (assoc 10 (entget a))) yb (caddr (assoc 10 (entget b))) lst (if (> ya yb) (list a b) (list b a)) el (entget (car lst)) tx (cdr (assoc 1 el)) tx (strcat tx " / " (cdr (assoc 1 (entget (cadr lst))))) el (subst (cons 1 tx) (assoc 1 el) el) ) (entmod el) (entdel (cadr lst)) ) When it asks for "max distance" enter how close is a text to its pair. You may answer with two clicks to define the distance, or by entering it from the keyboard. For a given text, the program will search its pair within that distance. Edit: I just seen that you try to make an Mtext... This program will make a Text. Sorry, no more time to change the Lisp... Quote
Steven P Posted February 15 Posted February 15 1 hour ago, fuccaro said: I am not as smart as AI, so my program is longer: ... but your programme works? Quote
fuccaro Posted February 15 Posted February 15 @alhlhli In the program I posted for you, you could change the call for the bind function (bind t1 t2) with a call for the text2mtxt and you will get the result as mtext 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.