AUTOCAD IS MY LIFE Posted March 28 Share Posted March 28 Is there any way connect the same text by polyline? help me Quote Link to comment Share on other sites More sharing options...
Jonathan Handojo Posted March 28 Share Posted March 28 Maybe explain it in a better detail, with some images or even a dwg file. Because right now, it's too abstract. 1 Quote Link to comment Share on other sites More sharing options...
AUTOCAD IS MY LIFE Posted March 28 Author Share Posted March 28 when i check the cad drawing, I want to connect texts with the same content by polyline. It wil help me check faster. Is there any lisp that can help with that? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted March 28 Share Posted March 28 A couple of problems may occur is cc0501 only twice in the dwg ? If it is multiple times wrong text may join. Yes can get a bounding box of the 2 text and draw a pline between them, that is the easy part maybe. Before any code answer question one and supply a sample dwg with more than 1 pair of text. 1 Quote Link to comment Share on other sites More sharing options...
AUTOCAD IS MY LIFE Posted March 28 Author Share Posted March 28 I want to find the decripsion and cable no of equip.no ( The equip.no is listed). If similar texts are connected, finding the information of eqip.no will be faster than if based on that polyline. CHECK_LISP..dwg Quote Link to comment Share on other sites More sharing options...
AUTOCAD IS MY LIFE Posted March 28 Author Share Posted March 28 (edited) EACH CODE WILL ONLY APPEAR ONCE IN THE BLOCK DIAGRAMS IF IT APPEARS MULTIPLE TIMES THEN WHEN THE SAME TEXTS ARE CONNECTED I WILL QUICKLY SPOT WHAT IS WRONG Edited March 28 by AUTOCAD IS MY LIFE Quote Link to comment Share on other sites More sharing options...
Romero Posted March 28 Share Posted March 28 (edited) Al revisar el archivo adjunto que compartió, noto que solo contiene una tabla con una descripción del equipo. Sin embargo, he observado que el equipo número 2 y el número 6 son idénticos. Si tu objetivo es identificar textos que sean exactamente iguales, puedes utilizar la siguiente rutina. En la primera selección se te pedirá que elijas el texto a identificar, o simplemente presionar enter para ingresarlo manualmente, mientras que en la segunda selección deberás seleccionar en una ventana los posibles textos duplicados. Al final, los textos idénticamente duplicados permanecerán seleccionados. En mi opinión esta estrategia es más práctica que unir los textos con una línea o polilínea. ;Select similar identical text v 1.0 ;Romero... March 2024 (defun C:SST ( / s1 obj lst s2 str) (princ "\nSelect the text string or enter to indicate manually :") (if (or (if (setq s1 (cadr (ssgetfirst))) (setq str (if (= 1 (sslength s1)) (cdr (assoc 1 (entget (ssname s1 0)))) (car (sssetfirst nil nil)) ) ) ) (if (setq s1 (car (entsel))) (setq str (cdr (assoc 1 (entget s1)))) ) (/= (setq str (getstring t "\nEnter the text to select: ")) "") (setq str "*") ) (progn (princ "\nSelect the other text objects...") (sssetfirst nil nil) (setq flst (list '(0 . "*TEXT") (cons 1 str))) (if (setq s2 (ssget (list '(0 . "*TEXT") (cons 1 str)))) (princ (strcat (itoa (sslength s2)) " objects")) ) (cadr (sssetfirst nil s2)) ) ) (if (zerop (getvar 'cmdactive)) (princ) (cadr (sssetfirst nil s2))) ) Edited March 28 by Romero 2 Quote Link to comment Share on other sites More sharing options...
AUTOCAD IS MY LIFE Posted March 29 Author Share Posted March 29 In the reality project has 1 equipment table and many table with the decripsion. If there was a line connecting the same contents text, it would be easier to find the descriptions of this equipment. Your lisp works very well at finding similar texts, but it would be even better if there was a straight line between the two texts. Can you help me develop Lisp? Quote Link to comment Share on other sites More sharing options...
fuccaro Posted March 29 Share Posted March 29 I wrote a Lisp for you, but when I ran it on the drawing you uploaded, I got a lot of lines -mostly unwanted, I suppose. Anyway, here is the Lisp: (defun c:pp( / ss ss2) (setq ss (ssget "X" '((0 . "TEXT")))) (repeat (setq i (sslength ss)) (setq en1 (ssname ss (setq i (1- i))) el1 (entget en1) a1 (assoc 1 el1) a10 (assoc 10 el1) ss2 (ssget "X" (list '(0 . "TEXT") a1))) (repeat (setq j (sslength ss2)) (setq a11 (cons 11 (cdr (assoc 10 (entget (ssname ss2 (setq j (1- j)))))))) (entmake (list '(0 . "LINE") a10 a11)) ) ) ) For the moment it draws two superposed lines for each pair of texts, but that can be changed with a few more lines of code... Quote Link to comment Share on other sites More sharing options...
Tsuky Posted March 29 Share Posted March 29 My suggestion that works with your example. To use it in other situations you will have to modify the arguments constituting the filters (ssget "_W" and "_X") for it to work. (defun c:FOO ( / ss_o ss_t n dxf_ent lst_o) (setq ss_o (ssget "_W" '(2027.9092 -426.6579) '(2327.9092 373.3421) '((0 . "TEXT") (8 . "TEXT") (62 . 2) (40 . 30.0) (7 . "GHS")))) (cond (ss_o (setq ss_t (ssget "_X" '((0 . "TEXT") (8 . "0") (62 . 7) (6 . "ByBlock") (40 . 3.4) (7 . "Single")))) (cond (ss_t (repeat (setq n (sslength ss_o)) (setq dxf_ent (entget (ssname ss_o (setq n (1- n)))) lst_o (cons (cons (cdr (assoc 1 dxf_ent)) (list (cdr (assoc 10 dxf_ent)))) lst_o) ) ) (repeat (setq n (sslength ss_t)) (setq dxf_ent (entget (ssname ss_t (setq n (1- n))))) (cond ((member (cdr (assoc 1 dxf_ent)) (mapcar 'car lst_o)) (entmake (list (cons 0 "LINE") (cons 10 (cdr (assoc 10 dxf_ent))) (cons 11 (cadr (assoc (cdr (assoc 1 dxf_ent)) lst_o))) ) ) ) ) ) ) ) ) ) (prin1) ) 1 Quote Link to comment Share on other sites More sharing options...
fuccaro Posted March 29 Share Posted March 29 I spent some more time with your drawing, here is the Lisp slightly adjusted. Now it searches only for texts that are at least 4 characters long. Also all the lines are placed on a new layer so you can delete them at once after the job is done. (defun c:pp( / ss ss2) (setq ss (ssget "X" '((0 . "TEXT")))) (setq a8 '(8 . "ConnectLines")) (repeat (setq i (sslength ss)) (setq en1 (ssname ss (setq i (1- i))) el1 (entget en1) a1 (assoc 1 el1)) (cond ((> (strlen (cdr a1)) 3) (setq a10 (assoc 10 el1) ss2 (ssget "X" (list '(0 . "TEXT") a1))) (repeat (setq j (sslength ss2)) (setq a11 (cons 11 (cdr (assoc 10 (entget (ssname ss2 (setq j (1- j)))))))) (cond ((/= a10 a11) (entmake (list '(0 . "LINE") a10 a11 a8)))) ) ) ) ) ) 1 Quote Link to comment Share on other sites More sharing options...
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.