leonucadomi Posted September 25 Share Posted September 25 hello all: I use this code that was provided to me here: ;;----------------------------------------------------------------------------;; ;; Copy dimension value to another location (defun C:foo (/ dim BP LastEnt en first2 first txt name f f2 tx nam ) (vl-load-com) (setvar 'cmdecho 0) (command "_UCS" "W") (while (setq dim (car (entsel "\nSelect Dimension: "))) (setq obj (vlax-ename->vla-object dim)) (setq BP (vlax-get obj 'TextPosition)) (setq LastEnt (entlast)) (command "_.Copy" dim "" "_non" BP (getpoint BP "\nCopy to: ")) (command "_Explode" (entlast)) (if (setq en (entnext LastEnt)) (while en (cond ((= "MTEXT" (cdr (assoc 0 (entget en)))) (command "_Explode" en) ;convert mtext to text ) ((= "TEXT" (cdr (assoc 0 (entget en)))) (progn) ) (t (entdel en) ) ) (setq en (entnext en)) ) ) ) (princ) ) extracts text from a dimension and places it at a point that the user selects, I would like you to do something additional in addition to this... that when you select the end point for the text position could I give "enter" and that the text created now changes its content for example to "text1" and as long as you continue giving "enter" change to "text2" and so on cyclically until the text that interests me appears the idea is to add more texts Quote Link to comment Share on other sites More sharing options...
hosneyalaa Posted September 25 Share Posted September 25 @leonucadomi Look at this https://www.cadtutor.net/forum/topic/75587-help-with-extracting-text-from-one-dimension/ 1 Quote Link to comment Share on other sites More sharing options...
fuccaro Posted September 26 Share Posted September 26 I can't get the point. Copy the dimension text, but change it? I would use a routine to cycle the texts, and once the text is created, change it's properties as needed. Quote Link to comment Share on other sites More sharing options...
fuccaro Posted September 26 Share Posted September 26 Here is my... text roulette. (defun c:pp() (setq tx (list "text0" "text1" "text2" "text3" )) (setq i -1 el (entget (car (entsel "select text"))) next T) (while next (setq i (rem (1+ i) (length tx)) el (subst (cons 1 (nth i tx)) (assoc 1 el) el) el (entmod el) st (getstring) next (= "" st)) ) (setq el (if (> (strlen st) 0) (subst (cons 1 st) (assoc 1 el) el) el) el (entmod el)) (princ) ) Start the program, select a text and press the space bar to cycle the text through the predefined values. Press ESC to break the cycle. Or start the program, select a text and enter your own text from the keyboard -but this text can't contain spaces. At the beginning of the program, replace those "text0..." strings with the desired ones, you are not limited to 4 lines. 1 Quote Link to comment Share on other sites More sharing options...
fuccaro Posted September 26 Share Posted September 26 8 hours ago, leonucadomi said: Text roulette ^^^^ Nice expression. I like it! ^^^^ 1 Quote Link to comment Share on other sites More sharing options...
leonucadomi Posted September 26 Author Share Posted September 26 8 hours ago, fuccaro said: ^^^^ Nice expression. I like it! ^^^^ this helps me a lot Quote Link to comment Share on other sites More sharing options...
fuccaro Posted September 30 Share Posted September 30 Glad to help! 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.