blubossa Guest Feb 11, 2009 #1 come posso mettere un suffisso, od un prefisso, ad un testo selezionato??
blubossa Guest Feb 12, 2009 #4 PlannerRoad said: illustra la soluzione se vuoi... Click to expand... eccola qui sotto: ;; ;; ;procedura per inserire un suffisso ad uno o più testi selezionati ;; ;;con la stessa logica è facile gestire anche un prefisso, od una qualsiasi stringa da aggiungere;; (defun c:txs1 () (setvar "cmdecho" 0) (initget 1 "sx dx") (setq risposta (getkword "\n scegli la mano: sx dx:" )) (if (= risposta "sx") (setq suf "_sx") (setq suf "_dx") );if (prompt "\nseleziona i testi: ") (setq testo1 (ssget)) (setq lunghezza (sslength testo1)) (setq conta 0) (repeat lunghezza (setq bb (ssname testo1 conta)) (setq aa (entget bb)) (if (equal (cons 0 "text") (assoc 0 aa)) (progn (setq sold (cdr (assoc 1 aa))) (setq snew (strcat sold suf)) (entmod (subst (cons 1 snew) (assoc 1 aa) aa)) (entupd (cdr (assoc -1 aa))) ) ;progn ) ; if (setq conta (1+ conta)) );repeat (princ) );def
PlannerRoad said: illustra la soluzione se vuoi... Click to expand... eccola qui sotto: ;; ;; ;procedura per inserire un suffisso ad uno o più testi selezionati ;; ;;con la stessa logica è facile gestire anche un prefisso, od una qualsiasi stringa da aggiungere;; (defun c:txs1 () (setvar "cmdecho" 0) (initget 1 "sx dx") (setq risposta (getkword "\n scegli la mano: sx dx:" )) (if (= risposta "sx") (setq suf "_sx") (setq suf "_dx") );if (prompt "\nseleziona i testi: ") (setq testo1 (ssget)) (setq lunghezza (sslength testo1)) (setq conta 0) (repeat lunghezza (setq bb (ssname testo1 conta)) (setq aa (entget bb)) (if (equal (cons 0 "text") (assoc 0 aa)) (progn (setq sold (cdr (assoc 1 aa))) (setq snew (strcat sold suf)) (entmod (subst (cons 1 snew) (assoc 1 aa) aa)) (entupd (cdr (assoc -1 aa))) ) ;progn ) ; if (setq conta (1+ conta)) );repeat (princ) );def