What wrong in my lisp,anybody can you check this program,I don't know why while or loop can't run,thakns for help. Best regards Ade Suharna ; Regis is Registration of drawing from drawing sheet to database (under construction) ; Design by Ade Suharna ; 24 March , 2004 ; Edit by Ade Suharna 13 July 2004 ; Ade Suharna 04 August 2004 1). ; 13 August 2004 2). ; NOT YET PERFECT !!! (defun c:reg() (setq oldosmode (getvar "osmode")) ; get osmode setting (setvar "osmode" 0) ; osmode set to 0 (setq oldcmdecho (getvar "cmdecho")) ; get cmdecho setting (setvar "cmdecho" 0) ; cmdecho set to 0 (vl-load-com) ; to automatic call (setq loclist nil) ; 2). (while (setq loc (entsel "\CLICK TEXT WOULD YOU CHANGE: ") deg (getstring T "\nENTER NEW TEXT FOR REPLACE IT: " )); 1). (progn (setq tex "TEXT" listpos (entget (car loc)) degpos1 (cdr (assoc 1 listpos)) texs (cdr (assoc 0 listpos))) (if loc (cond ((/= tex texs)(princ "YOUR CHOOSE OBJECT INVALID")) ((= tex texs) (progn (setq degpos2 deg) (setq ed (subst (cons 1 degpos2) (assoc 1 listpos) listpos)) (entmod ed) (entupd listpos) ))))loc) (setq loclist (append loclist (list loc)))) ; 2). (setvar "osmode" oldosmode) ; return setting (setvar "cmdecho" oldcmdecho) (princ) ) ;------------------------------------------------------
Hi Ade, I have it modified and comment (defun c:reg(); NOTE!! all the vars (oldcmdecho loclist loc deg listpos degpos1 texs) are global ;;;(setq oldosmode (getvar "osmode")) ; get osmode setting --> not necessary ;;;(setvar "osmode" 0) ; osmode set to 0 --> not necessary (setq oldcmdecho (getvar "cmdecho")) ; get cmdecho setting (setvar "cmdecho" 0) ; cmdecho set to 0 ;;;(vl-load-com) ; to automatic call --> not necessary (setq loclist nil) ; 2). --> not used in this function (while (setq loc (entsel "\nCLICK TEXT WOULD YOU CHANGE: ")); --> look at \nClick (n added) (setq deg (getstring T "\nENTER NEW TEXT FOR REPLACE IT: " ); 1). listpos (entget (car loc)) degpos1 (cdr (assoc 1 listpos)) texs (cdr (assoc 0 listpos))) (cond ((not (wcmatch texs "*TEXT"))(princ "YOUR CHOOSE OBJECT INVALID")); --> for all not text entity ((= deg "")(princ "NULL STRING NOT ALLOWED.")); Not null string allowed. ("") else modify MTEXT or TEXT or ALIGNEDTEXT (T (setq degpos2 deg) (setq ed (subst (cons 1 degpos2) (assoc 1 listpos) listpos)) (entmod ed) (entupd (car loc)); --> entity name (not the list) )); end cond (setq loclist (append loclist (list loc))) ; 2). --> not used in this function ); end while ;;;(setvar "osmode" oldosmode) ; return setting --> not necessary (setvar "cmdecho" oldcmdecho) (princ) ) Cheers Harrie
Hi zeha, it work perfect,thanks a lot. INVALID")); --> for all not text entity ("") else modify MTEXT or TEXT or ALIGNEDTEXT