motee-z Posted August 4, 2009 Posted August 4, 2009 hello to all i got this lisp from this forum it is to copy texts individualy then replace it sequantialy i try to new text to a new layer but in vain any help will be appreciated thanks sory for my english ; ;copy text then replace it sequentialy to new position to predefined layer (defun C:mmm( / tl e p) (command"ucs" "world") (setq clyr(getvar"clayer")) (setq tl nil) (while (setq e (car (entsel "\nSelect text :"))) (redraw e 3) (setq tl (append tl (list e))) ) (command "layer" "m" "moved text" "") (command "layer" "c" "1" "moved text" "") (while (> (length tl) 0) (setq p (getpoint "\nNew position:")) (command "copy" (setq e (car tl)) "" (cdr (assoc 10 (entget e))) p) (setq e1 (entlast)) (command "chprop" e1 "" "la" moved text "") (setq tl (cdr tl)) ) (setvar"clayer"clyr) ) Quote
CALCAD Posted August 4, 2009 Posted August 4, 2009 Hello motee-z, This code works for me. The comment line that talks about a "predefined layer" might be confusing. The program copies selected text to the current layer. The program creates a layer "moved text" to hold the text temporarily but restores the original layer at the end. The program is rough, with no error trap or even (princ) at the close, but it seems to work. Edit : maybe the intention was to leave the selected text on the MOVED TEXT layer. To do that change the line : (command "chprop" e1 "" "la" moved text "") to (command "chprop" e1 "" "la" "moved text" "") Quote
Lee Mac Posted August 4, 2009 Posted August 4, 2009 I don't quite understand what you want this LISP to do for you? Quote
Lee Mac Posted August 4, 2009 Posted August 4, 2009 An alternative approach to things; (defun c:cptxt (/ lay ss sel) (vl-load-com) (setq lay "Moved Text") ;; << New Layer (if (not (tblsearch "LAYER" lay)) (vla-put-color (vla-add (vla-get-layers (vla-get-ActiveDocument (vlax-get-acad-object))) lay) 1)) (if (setq ss (ssget '((0 . "*TEXT")))) (progn (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object)))) (vla-copy Obj) (vla-put-layer Obj lay) (command "_.move" (vlax-vla-object->ename Obj) "" (vlax-get Obj 'InsertionPoint) pause)) (vla-delete sel))) (princ)) Quote
motee-z Posted August 5, 2009 Author Posted August 5, 2009 thank you calcad thanks to lee mack the problem is solved mr lee mack the aim of lisp is to select text one by one and place them in new place in the same order in another layer Quote
Lee Mac Posted August 5, 2009 Posted August 5, 2009 thank you calcad thanks to lee mack the problem is solved mr lee mack the aim of lisp is to select text one by one and place them in new place in the same order in another layer Does the above work for you? Quote
CALCAD Posted August 5, 2009 Posted August 5, 2009 Motee-z, Glad you have something that works, whichever solution you used. 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.