leonucadomi Posted Friday at 10:56 PM Posted Friday at 10:56 PM hello all: I need a routine that first asks me to enter "a word" and this word is added to the value of the dimension below the line example The modified dimension shows this Does anyone know of any code that can help me? thanks Quote
Lee Mac Posted Friday at 11:08 PM Posted Friday at 11:08 PM Here's a quick one - (defun c:dimsub ( / enx grp idx new pos sel str ) (cond ( (= "" (setq str (getstring t "\nSpecify string: ")))) ( (setq sel (ssget "_:L" '((0 . "*DIMENSION")))) (repeat (setq idx (sslength sel)) (setq idx (1- idx) enx (entget (ssname sel idx)) grp (assoc 1 enx) ) (if (setq pos (vl-string-search "\\X" (cdr grp))) (setq new (cons 1 (strcat (substr (cdr grp) 1 pos) "\\X" str))) (setq new (cons 1 (strcat "<>\\X" str))) ) (entmod (subst new grp enx)) ) ) ) (princ) ) 1 Quote
leonucadomi Posted Friday at 11:15 PM Author Posted Friday at 11:15 PM 7 minutes ago, Lee Mac said: Here's a quick one - (defun c:dimsub ( / enx grp idx new pos sel str ) (cond ( (= "" (setq str (getstring t "\nSpecify string: ")))) ( (setq sel (ssget "_:L" '((0 . "*DIMENSION")))) (repeat (setq idx (sslength sel)) (setq idx (1- idx) enx (entget (ssname sel idx)) grp (assoc 1 enx) ) (if (setq pos (vl-string-search "\\X" (cdr grp))) (setq new (cons 1 (strcat (substr (cdr grp) 1 pos) "\\X" str))) (setq new (cons 1 (strcat "<>\\X" str))) ) (entmod (subst new grp enx)) ) ) ) (princ) ) i will try master thanks Quote
leonucadomi Posted Friday at 11:21 PM Author Posted Friday at 11:21 PM EXCELLENT... You can make it so that by default it suggests the word "typ" so that with just one enter I can continue the routine and if in the future I need to add another word I can change it. Quote
Lee Mac Posted Friday at 11:58 PM Posted Friday at 11:58 PM 36 minutes ago, leonucadomi said: You can make it so that by default it suggests the word "typ" so that with just one enter I can continue the routine and if in the future I need to add another word I can change it. For a "fixed" default, you can use something like the following: (defun c:dimsub ( / enx grp idx new pos sel str ) (if (= "" (setq str (getstring t "\nSpecify string <TYP>: "))) (setq str "TYP") ) (if (setq sel (ssget "_:L" '((0 . "*DIMENSION")))) (repeat (setq idx (sslength sel)) (setq idx (1- idx) enx (entget (ssname sel idx)) grp (assoc 1 enx) ) (if (setq pos (vl-string-search "\\X" (cdr grp))) (setq new (cons 1 (strcat (substr (cdr grp) 1 pos) "\\X" str))) (setq new (cons 1 (strcat "<>\\X" str))) ) (entmod (subst new grp enx)) ) ) (princ) ) For a "dynamic" default, you can use one of the methods I describe here. Quote
BIGAL Posted yesterday at 06:02 AM Posted yesterday at 06:02 AM Interesting ""Windows Speech Recognition," and then use the shortcut Windows logo key + Ctrl + S to activate it. Typed dimsub then spoke T Y P a box appeared then did accept. !typ = "TYP " very close. It did 1st go put EYP in command line. So I think I need to train it more. Can turn on and off microphone by voice. If I have time may play more. 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.