View Full Version : TextCopy Alert
abare
2008-02-03, 01:27 AM
Hi all AUGI members!
I'd like cad to show me alert message.
Please solve the problem of (alert "Error unknown name: TextString").
(defun c:TextCopy (/ #a #b #index) (prompt "( TextCopy )")
(vl-load-com)
(setq #a(vla-get-textstring(vlax-ename->vla-object(car(entsel "\nSorce Text:")))))
(PROMPT "\n Target Text : ")
(if (setq #b(ssget '((0 . "text"))))
(progn
(setq #index 0)
(repeat (sslength #b)
(vla-put-textstring(vlax-ename->vla-object(ssname #b #index))#a)
(setq #index(1+ #index)))
);;end progn
(alert "Error unknown name: TextString")
);;end if
);;end defun
Moderator Note:
How to use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)
CAB2k
2008-02-03, 06:46 PM
You can try this.
Note, limited testing.
;; SSmatchtext.lsp by CAb 02.10.2008
;; Change selection set of text or Mtext to match source string
;; Source may be Text, Mtext, Dim Override, Table Cell,
;; text or attribute within a block
(defun c:SSmatchtext (/ entity enlist txt_str)
(command ".undo" "begin")
(if (and (setq entity (nentsel "\n* Select Source Text *"))
(setq elist (entget (car entity)))
(= (type (setq txt_str (cdr (assoc 1 elist)))) 'STR))
(if (or (prompt "\n* Select Text to Change *")
(setq ss (ssget '((0 . "TEXT,MTEXT")))))
(progn
(setq enlist (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
(mapcar
'(lambda (x)
(setq elist (entget x))
(entupd
(cdr (assoc -1 (entmod (subst (cons 1 txt_str) (assoc 1 elist) elist))))
)
)
enlist
)
)
(prompt "\n*** No Text in Selection Set ***\n")
)
(prompt "\n*** No Text in Source ***\n")
)
(command ".undo" "end")
(princ)
)
(prompt "\nMatch Text by CAB, Enter MatchText to run.")
(princ)
Adesu
2008-02-03, 11:57 PM
Hi youngsoo,
want like this maybe
(defun c:textcopy (/ #a #b #index ss ssl ssn vevo vevox)
(prompt "( TextCopy )")
(vl-load-com)
(setq ss (car (entsel "\nSorce Text:")))
(setq vevo (vlax-ename->vla-object ss))
;(vlax-dump-object vevo)
(setq #a (vlax-get vevo 'TextString))
(prompt "\n Target Text : ")
(if
(setq #b (ssget '((0 . "text"))))
(progn
(setq #index 0)
(setq ssl (sslength #b))
(repeat
ssl
(setq ssn (ssname #b #index))
(setq vevox (vlax-ename->vla-object ssn))
;(vlax-dump-object vevox)
(vlax-put vevox 'TextString #a)
(setq #index (1+ #index))
) ; repeat
) ; progn
(alert "Error unknown name: TextString")
) ; if
) ; defun
Hi all AUGI members!
I'd like cad to show me alert message.
Please solve the problem of (alert "Error unknown name: TextString").
(defun c:TextCopy (/ #a #b #index) (prompt "( TextCopy )")
(vl-load-com)
(setq #a(vla-get-textstring(vlax-ename->vla-object(car(entsel "\nSorce Text:")))))
(PROMPT "\n Target Text : ")
(if (setq #b(ssget '((0 . "text"))))
(progn
(setq #index 0)
(repeat (sslength #b)
(vla-put-textstring(vlax-ename->vla-object(ssname #b #index))#a)
(setq #index(1+ #index)))
);;end progn
(alert "Error unknown name: TextString")
);;end if
);;end defun
abare
2008-02-04, 12:37 AM
Thank you very much!
My syntax is wrong.
I'd like cad to show me alert message.
Please, modify all problems here.
Anyone have any ideas?
(defun c:xx(/ ss)(prompt " + explode + ")
(if (setq ss (ssget ) )
(progn
(command "explode" ss "")
(prompt " I like autocad.")
);;end progn
(alert "The object is not able to be exploded.")
);;end if
(prin1))
Moderator Note:
How to use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)
abare
2008-02-04, 01:49 AM
I want to see the state of layer lock.
If layer is locked, I want to use the key "command" after layer unlock.
If layer is the unlock, I want to do command directly.
I realy concentrated on my work.
I saw the prompt after a while.
I think,my question is very simple.
I'd like cad to show me alert message.
abare
2008-02-20, 01:23 AM
I have not solve this problem yet.
I really amateur in autolisp.
My syntax is wrong.
Is this posible operation?
Please help.
(defun c:M() (prompt "[MOVE]" )
(LockLayer)
(command "MOVE" )
(princ)
)
(defun LockLayer()
(if LockLayerState
(alert "1 was on a locked layer." )
)
Moderator Note:
How to use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)
rkmcswain
2008-02-20, 01:03 PM
I have not solve this problem yet.
I really amateur in autolisp.
My syntax is wrong.
You are missing the closing parenthesis on the (locklayer) function.
(defun LockLayer ()
(if LockLayerState
(alert "1 was on a locked layer.")
)
)
Edit your code in the VLIDE (if you are not already), and you can use the check and format functions to assist you in finding missing parenthesis.
abare
2008-02-22, 12:15 AM
Please, modify all problems here.
It is still far from perfect.
Anyone have any ideas?
(defun c:M() (prompt "[MOVE]" )
(LockedLayer)
(command "MOVE" ) (princ))
(defun LockedLayer ()
(if (locked-layer-list)
(alert "1 was on a locked layer." )
);;;if end
)
;;;*************************************************
(defun table-list(name / dxf return)
(while (setq dxf(tblnext name(not dxf)))
(setq return(cons(cdr(assoc 2 dxf))return))
)
(reverse return)
;;(table-list"LTYPE")
;;(table-list"VIEW")
;;(table-list"STYLE")
;;(table-list"BLOCK")
;;(table-list"UCS")
;;(table-list"APPID")
;;(table-list"DIMSTYLE")
;;(table-list"VPORT")
;;(table-list"LAYER")
)
;;;;---------------------------------------------
(defun off-layer-list(/ dxf return )
(while (setq dxf(tblnext"layer"(not dxf)))
(if (<(cdr(assoc 62 dxf))0)
(setq return(cons(cdr(assoc 2 dxf))return))
)
)
(reverse return)
)
;;;--------------------------------------------
(defun frozen-layer-list(/ dxf return)
(while (setq dxf(tblnext"layer"(not dxf)))
(if (=(logand(cdr(assoc 70 dxf))1)1)
(setq return(cons(cdr(assoc 2 dxf))return))
)
)
(reverse return)
)
;;-----------------------------------------
(defun locked-layer-list(/ dxf return)
(while (setq dxf(tblnext"layer"(not dxf)))
(if (=(logand(cdr(assoc 70 dxf))4)4)
(setq return(cons(cdr(assoc 2 dxf))return))
)
)
(reverse return)
)
;;-----------------------------------------------------
(defun offfrozenlockedlayerlist ( / aa bb cc xx yy zz)
(if(or (off-layer-list) (frozen-layer-list) (locked-layer-list) )
;;--------------------------------------------------------------------
(progn
(alert " off,frozen,locked " )
(prompt "\noff=>" ) (princ (off-layer-list) )
(prompt " frozen=>") (princ (frozen-layer-list) )
(prompt " locked=>") (princ (locked-layer-list) )
);progn end
(prompt "\nAll layers are thawed, on, and unlocked!")
);;;if end
(princ)
)
Moderator Note:
How to use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)
rkmcswain
2008-02-22, 01:10 PM
If you have a specific question, someone may be able to help. But just posting some code and asking for someone to "modify all problems" probably isn't going to get you too far.
abare
2008-02-23, 01:39 AM
Thank you for listening.
Not really, but I managed to make the problem go away.
(defun c:M() (prompt "[MOVE]" )
(LockedLayer)
(command "MOVE" ) (princ))
(defun LockedLayer ()
(if (locked-layer-list)
(progn
(alert "1 was on a locked layer." )
(prompt "locked=>") (princ (locked-layer-list) )
);progn end
);;;if end
)
Moderator Note:
Please use [ CODE ] tags to display your code (http://forums.augi.com/misc.php?do=bbcode#code)
abare
2008-02-26, 12:22 AM
I apologize for what I did.
My expression is small.
I do not want to edit for entire drawing.
I want to edit for selected object.
I'd like to use sub function of move,copy,erase command.
(defun c:M() (prompt "[MOVE]" )
(LockedLayer)
(command "MOVE" ) (princ))
(defun LockedLayer ()
(if (locked-layer-list)
(progn
(alert "1 was on a locked layer." )
(prompt "locked=>") (princ (locked-layer-list) )
);progn end
);;;if end
)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.