wakibd Posted April 27, 2009 Posted April 27, 2009 If this is a new question it would be better if it was placed in a new thread. What needs replacing? and what with? Helle Lee, I like to insert parenthesis ( Brackets) into several text .is it possible to do this by using find and replace command. like if I put * (star) in to the find box .It will select all text. and then I put (*) into replace box. because i do not change any individual text. But it did not work. Quote
wakibd Posted April 27, 2009 Posted April 27, 2009 Hello Dave, I like to insert parenthesis ( Brackets) into several text .is it possible to do this by using find and replace command. like if I put * (star) in to the find box .It will select all text. and then I put (*) into replace box. because i do not change any individual text. But it did not work. regards Racel Quote
Lee Mac Posted April 27, 2009 Posted April 27, 2009 Try this: [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:ptxt [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] ss tStr[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ss [b][color=RED]([/color][/b][b][color=BLUE]ssget[/color][/b] [b][color=#ff00ff]"X"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]0[/color][/b] [b][color=#ff00ff]"*TEXT"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"CTAB"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]410[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"CTAB"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]67[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]-[/color][/b] [b][color=#009900]1[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"TILEMODE"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]foreach[/color][/b] eLst [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]entget[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]cadr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]ssnamex[/color][/b] ss[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] tStr [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]1[/color][/b] eLst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entmod[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]subst[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]1[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]chr[/color][/b] [b][color=#009900]40[/color][/b][b][color=RED])[/color][/b] tStr [b][color=RED]([/color][/b][b][color=BLUE]chr[/color][/b] [b][color=#009900]41[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]1[/color][/b] eLst[b][color=RED])[/color][/b] eLst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n<!> No Text Found <!>"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] Quote
Lee Mac Posted April 27, 2009 Posted April 27, 2009 Hello It's a long time i make lisp You have several on this page. Just take the time to translate. For the lisp pat, I'm just used to objectdbx.:wink: Nothing really wizard. @+ Thats a generous donation Patrick I suppose its because I have only just started moving into VL and so am not really experienced in this kind of programming. Cheers Lee Quote
Patrick_35 Posted April 27, 2009 Posted April 27, 2009 I have only just started moving into VL and so am not really experienced in this kind of programmingContinuous at vlisp is power AutoLISP by 10 You can enable things unimaginable. The only limit with this language is imagination. An example that much fun and shows some of the possibilities (defun autocad_qui_parle (texte / sapi) (setq sapi (vlax-create-object "Sapi.SpVoice")) (vlax-invoke sapi "Speak" texte 0) (vlax-release-object sapi) ) (defun autocad_qui_parle_debut (rea cde) (autocad_qui_parle (strcat "Command ," (car cde) " will start")) ) (defun autocad_qui_parle_inconnu (rea cde) (autocad_qui_parle (strcat "Unknown command ," (car cde))) ) (defun autocad_qui_parle_cancel (rea cde) (autocad_qui_parle (strcat "Command ," (car cde) " Cancelled")) ) (defun autocad_qui_parle_failed (rea cde) (autocad_qui_parle (strcat "Command ," (car cde) " failed")) ) (defun autocad_qui_parle_fin (rea cde) (autocad_qui_parle (strcat "Commande ," (car cde) " ended")) ) (if (not pourrir_la_vie) (setq pourrir_la_vie (vlr-command-reactor nil (list (cons :vlr-commandWillStart (function autocad_qui_parle_debut)) (cons :vlr-unknownCommand (function autocad_qui_parle_inconnu)) (cons :vlr-commandCancelled (function autocad_qui_parle_cancel)) (cons :vlr-commandFailed (function autocad_qui_parle_failed)) (cons :vlr-commandEnded (function autocad_qui_parle_fin)) ) ) ) ) (princ) A mixture of activex and reactors To remove reactors (vlr-remove pourrir_la_vie) @+ Quote
wakibd Posted April 28, 2009 Posted April 28, 2009 Patrick, how long have you been programming? Your programs are always so advanced Hello Lee, Thanks for your lisp program. But still i have the problem. I have to put dia signs (%%C) in envery text. Is it possible to do selection the text ( which text I want) from set of texts and put sign or parenthesis or coma or full stop at the end or begins or both side of the texts. If you have the lisp program please post it. Thanks again Quote
Lee Mac Posted April 28, 2009 Posted April 28, 2009 Wakibd, I just made a "blanket" program that would add parentheses (brackets) at the beginning and end of every text string. As was requested. Would you like me to make a program that will give you more options? Quote
Lee Mac Posted April 28, 2009 Posted April 28, 2009 Ok, try this (turn your speakers on) [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:tupd [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] ss dLst tmp1 tmp2 tStr[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ss [b][color=RED]([/color][/b][b][color=BLUE]ssget[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]0[/color][/b] [b][color=#ff00ff]"*TEXT"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"CTAB"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]410[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"CTAB"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]67[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]-[/color][/b] [b][color=#009900]1[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"TILEMODE"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] dLst [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b]sym:def pos:def[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=BLUE]lambda[/color][/b] [b][color=RED]([/color][/b]x y[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]or[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]boundp[/color][/b] x[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]set[/color][/b] x y[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] dLst [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=#ff00ff]"%%C"[/color][/b] [b][color=#ff00ff]"Front"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] tmp1 [b][color=RED]([/color][/b][b][color=BLUE]getstring[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=#ff00ff]"\nSpecify Symbol to be Added <"[/color][/b] sym:def [b][color=#ff00ff]">: "[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]initget[/color][/b] [b][color=#ff00ff]"Front End Both"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] tmp2 [b][color=RED]([/color][/b][b][color=BLUE]getkword[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=#ff00ff]"\nSpecify Position for Symbol [Front/End/Both] <"[/color][/b] pos:def [b][color=#ff00ff]">:"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=BLUE]lambda[/color][/b] [b][color=RED]([/color][/b]x y[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]or[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]or[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#ff00ff]""[/color][/b] x[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] x[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]set[/color][/b] y x[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] tmp1 tmp2[b][color=RED])[/color][/b] dLst[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]foreach[/color][/b] eLst [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]entget[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-remove-if[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]listp[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]cadr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]ssnamex[/color][/b] ss[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cond[/color][/b] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#ff00ff]"Front"[/color][/b] pos:def[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] tStr [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] sym:def [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]1[/color][/b] eLst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#ff00ff]"End"[/color][/b] pos:def[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] tStr [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]1[/color][/b] eLst[b][color=RED])[/color][/b][b][color=RED])[/color][/b] sym:def[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#ff00ff]"Both"[/color][/b] pos:def[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] tStr [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] sym:def [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]1[/color][/b] eLst[b][color=RED])[/color][/b][b][color=RED])[/color][/b] sym:def[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entmod[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]subst[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]1[/color][/b] tStr[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]1[/color][/b] eLst[b][color=RED])[/color][/b] eLst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]funny[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n<!> No Text Selected <!>"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] funny [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] sapi[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] sapi [b][color=RED]([/color][/b][b][color=BLUE]vlax-create-object[/color][/b] [b][color=#ff00ff]"Sapi.SpVoice"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-invoke[/color][/b] sapi [b][color=#ff00ff]"Speak"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-list->string[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=#009900]76[/color][/b] [b][color=#009900]101[/color][/b] [b][color=#009900]101[/color][/b] [b][color=#009900]32[/color][/b] [b][color=#009900]77[/color][/b] [b][color=#009900]97[/color][/b] [b][color=#009900]99[/color][/b] [b][color=#009900]32[/color][/b] [b][color=#009900]104[/color][/b] [b][color=#009900]97[/color][/b] [b][color=#009900]115[/color][/b] [b][color=#009900]32[/color][/b] [b][color=#009900]117[/color][/b] [b][color=#009900]112[/color][/b] [b][color=#009900]100[/color][/b] [b][color=#009900]97[/color][/b] [b][color=#009900]116[/color][/b] [b][color=#009900]101[/color][/b] [b][color=#009900]100[/color][/b] [b][color=#009900]32[/color][/b] [b][color=#009900]121[/color][/b] [b][color=#009900]111[/color][/b] [b][color=#009900]117[/color][/b] [b][color=#009900]114[/color][/b] [b][color=#009900]32[/color][/b] [b][color=#009900]116[/color][/b] [b][color=#009900]101[/color][/b] [b][color=#009900]120[/color][/b] [b][color=#009900]116[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-release-object[/color][/b] sapi[b][color=RED])[/color][/b][b][color=RED])[/color][/b] Quote
wakibd Posted April 28, 2009 Posted April 28, 2009 Hello Lee Thank you very much for your really nice coding with sound effect. Quote
Lee Mac Posted April 28, 2009 Posted April 28, 2009 hehe, thought you might like the sound effect Idea came from Patrick's example Quote
wakibd Posted April 29, 2009 Posted April 29, 2009 Hello Lee, I have another different problem. I am using wipeout command to remove something or portion of the drawing. When I print out it comes fine. But when I do the PDF from the drawing , the wipe out portion of the drawing comes black (in the PDF output). regards wakibd Quote
Lee Mac Posted April 29, 2009 Posted April 29, 2009 Wakibd, This question is a lot further from the topic of the original. When you have new questions it is better to post them in a new thread in the correct forum - that way you will get better answers from all the members of the community. Lee Quote
wakibd Posted May 21, 2009 Posted May 21, 2009 Hello Lee, Thanks for ur lisp program . But I have the problem with my block. I have same tag name for desined, drawn and checked as well all dates but their prompt name are different . how can i put the logic in your lisp program. I have attached my block. how can i use this lisp program in several files in one hit regards wakibd TEMPLATE.dwg Quote
dbroada Posted May 21, 2009 Posted May 21, 2009 I'm not going to attempt to answer your LISP problem but the same tag name in a single block is a recipe for disaster, irrespective of their different prompts. Dynamic blocks get totally confused and I have had problems with VBA. I'll await comments from a LISP coder. Quote
Lee Mac Posted May 21, 2009 Posted May 21, 2009 I'm not going to attempt to answer your LISP problem but the same tag name in a single block is a recipe for disaster, irrespective of their different prompts. Dynamic blocks get totally confused and I have had problems with VBA. I'll await comments from a LISP coder. I agree - The tag name is how I identify different attributes when programming - The prompt is nigh inaccessible from the block instance itself - one much dig much deeper for that. I would not use the same tag name for all attributes - this is bad practice imo, and will cause you problems in the future. Lee Quote
au-s Posted June 10, 2009 Posted June 10, 2009 This may be better suited to you: (defun c:atest (/ taglist ss ent att tnme) (setq taglist '(("ECA-AREA-NAME" . "TEST1") ("ECA-TITLE1" . "TEST2")) ; <--- List Tags and Values here. ) (if (setq ss (ssget "X" (list (cons 0 "INSERT") (cons 2 "T-A002A") (cons 66 1) (if (getvar "CTAB") (cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (foreach ent (mapcar 'cadr (ssnamex ss)) (setq att (entnext ent)) (while (not (eq "SEQEND" (cdadr (entget att)))) (setq tnme (cdr (assoc 2 (entget att)))) (if (assoc tnme taglist) (entmod (subst (cons 1 (cdr (assoc tnme taglist))) (assoc 1 (entget att)) (entget att)))) (setq att (entnext att)))) (command "_regenall")) (princ "\n<!> No Blocks Found <!>")) (princ)) I have used an associative list instead. You can list your attribute tag names in the list as shown, and what you require them to be changed to. Hope this helps some more Lee Nice one. Is it possible to make that lisp work with the attedit command. Instead of having a pre-defined taglist it calls for a command attedit in ACAD then the user changes attribute values wit hattedit command of a given block in lisp like here: T-A002A?? So its block-related but you change it with attedit command Quote
Lee Mac Posted June 10, 2009 Posted June 10, 2009 Perhaps something like this? [i][color=#990099];;; =============== AttChg.lsp ===============[/color][/i] [i][color=#990099];;; [/color][/i] [i][color=#990099];;; FUNCTION: AttChg[/color][/i] [i][color=#990099];;; Will synchronise Attributes in Multiple[/color][/i] [i][color=#990099];;; Block Instances.[/color][/i] [i][color=#990099];;; [/color][/i] [i][color=#990099];;; AUTHOR:[/color][/i] [i][color=#990099];;; Lee McDonnell (Lee Mac)[/color][/i] [i][color=#990099];;; (Contact at CADTutor.net, TheSwamp.org)[/color][/i] [i][color=#990099];;; 10th June 2009[/color][/i] [i][color=#990099];;; [/color][/i] [i][color=#990099];;; ==========================================[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:AttChg [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] *error* blkNme tdef bTest attlst[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] *error* [b][color=RED]([/color][/b]e[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] ocm [b][color=RED]([/color][/b][b][color=BLUE]setvar[/color][/b] [b][color=#ff00ff]"CMDECHO"[/color][/b] ocm[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]wcmatch[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcase[/color][/b] e[b][color=RED])[/color][/b] [b][color=#ff00ff]"*CANCEL*,*EXIT*"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=#ff00ff]"\n<< Error: "[/color][/b] e [b][color=#ff00ff]" >>"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ocm [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"CMDECHO"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setvar[/color][/b] [b][color=#ff00ff]"CMDECHO"[/color][/b] [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]while[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]initget[/color][/b] [b][color=#ff00ff]"Name"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] blkNme [b][color=RED]([/color][/b][b][color=BLUE]entsel[/color][/b] [b][color=#ff00ff]"\nSelect Block or [Name]: "[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cond[/color][/b] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]and[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-consp[/color][/b] blkNme[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#ff00ff]"INSERT"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]0[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] blkNme[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#009900]1[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]66[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] blkNme[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] blkNme [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]2[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] blkNme[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=BLUE]nil[/color][/b][b][color=RED])[/color][/b] [i][color=#990099]; Exit Loop[/color][/i] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=DARKRED]'[/color][/b]STR [b][color=RED]([/color][/b][b][color=BLUE]type[/color][/b] blkNme[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] blkNme [b][color=RED]([/color][/b][b][color=BLUE]getstring[/color][/b] [b][color=BLUE]t[/color][/b] [b][color=#ff00ff]"\nSpecify Block Name: "[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cond[/color][/b] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]and[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] tdef [b][color=RED]([/color][/b][b][color=BLUE]tblsearch[/color][/b] [b][color=#ff00ff]"BLOCK"[/color][/b] blkNme[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#009900]2[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]logand[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]70[/color][/b] tdef[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=#009900]2[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=BLUE]nil[/color][/b][b][color=RED])[/color][/b] [i][color=#990099]; Exit Loop[/color][/i] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]tblsearch[/color][/b] [b][color=#ff00ff]"BLOCK"[/color][/b] blkNme[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n<< Block Contains No Attributes >>"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]t[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n<< Block Not Found >>"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [i][color=#990099]; Keep in Loop[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]t[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\nMissed, Try Again..."[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ss [b][color=RED]([/color][/b][b][color=BLUE]ssget[/color][/b] [b][color=#ff00ff]"_X"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]0[/color][/b] [b][color=#ff00ff]"INSERT"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]2[/color][/b] blkNme[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]66[/color][/b] [b][color=#009900]1[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]initdia[/color][/b] [b][color=#009900]1[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-cmdf[/color][/b] [b][color=#ff00ff]"_.attedit"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] bTest [b][color=RED]([/color][/b][b][color=BLUE]ssname[/color][/b] ss [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]foreach[/color][/b] att [b][color=RED]([/color][/b][b][color=BLUE]vlax-safearray->list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-variant-value[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-getAttributes[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-ename->vla-object[/color][/b] bTest[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] attlst [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-TagString[/color][/b] att[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-TextString[/color][/b] att[b][color=RED])[/color][/b][b][color=RED])[/color][/b] attlst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]foreach[/color][/b] Obj [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]vlax-ename->vla-object[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]cadr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]ssnamex[/color][/b] ss[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]foreach[/color][/b] Att [b][color=RED]([/color][/b][b][color=BLUE]vlax-safearray->list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-variant-value[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-getAttributes[/color][/b] Obj[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] Tag [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-TagString[/color][/b] Att[b][color=RED])[/color][/b] attlst[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-put-TextString[/color][/b] Att [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] Tag[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=#ff00ff]"\n<< "[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]rtos[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]sslength[/color][/b] ss[b][color=RED])[/color][/b] [b][color=#009900]2[/color][/b] [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b] [b][color=#ff00ff]" Block Instances Updated >>"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n<< No Block Instances Found in Drawing >>"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setvar[/color][/b] [b][color=#ff00ff]"CMDECHO"[/color][/b] ocm[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] Quote
au-s Posted June 10, 2009 Posted June 10, 2009 thanx Sir!!! is it possible to "NOT" select block. Is it possible for that program to skip the block-selection and go instantly to attedit for a specific blockname ... like in previous examples... ??? (defun c:test1 () (setq blk "stamp") (command "Attchg" "N" blk) ) (defun c:test2 () (setq blk2 "stamp2") (command "Attchg" "N" blk2) ) Above example? Can I do something like that? So I can call your command and change diffrent block-names? I get an error Unknown command "ATTCHG". Press F1 for help. Unknown command "N". Press F1 for help. Unknown command "STAMP". Press F1 for help. Thanx in advance 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.