BKRao Posted April 4, 2019 Posted April 4, 2019 Hello everybody, Can anyone help me my requirement, I want text copy from "layer1" to "layer2" requesting for code With regards. BKRao Quote
BIGAL Posted April 5, 2019 Posted April 5, 2019 (edited) 1 You can manually type lisp code on the command line so you can use ssget to make a selection, and then use Copy etc. (ssget '((0 . "Text"))) 2 The Filter command is the same just select text then it detects the selection made. 3 Qselect ? 4 You can make a shorthand using the ssget mentioned aboved so Copy 'ssgt the 'ssgt is a shorthand command that is tranparently called, its a preloaded lisp you could have a few of these for pre defined selections. The use of transparent commands is one of those hidden options in Autocad. Some examples at command line type copy 'ssgt <Enter> pick pick text is copied. Chprop 'ssgt "" la newlayer Note the apostrophe ' before the command this makes it transparent. (defun c:ssgp () (ssget '((0 . "LWPOLYLINE"))) ) (defun c:ssgt () (ssget '((0 . "Text"))) ) (defun c:ssgm() (ssget '((0 . "MText"))) ) (defun c:ssgl () (ssget '((0 . "LINE"))) ) (defun c:ssmt () (ssget '((0 . "*text"))) ) ; (defun c:ssct ( / ss) (setq ss (ssget '((0 . "*Text")))) (command "chprop" ss "" "la" (getstring "new layer") "") ) Edited April 5, 2019 by BIGAL 1 Quote
BKRao Posted April 5, 2019 Author Posted April 5, 2019 (edited) 22 hours ago, Aftertouch said: Copy or move? copy not move Sir Edited April 5, 2019 by BKRao Quote
BKRao Posted April 5, 2019 Author Posted April 5, 2019 (edited) Thank U "BIGAL" Sir I am traying with below code kindly correct it Sir. (defun c:ssct (/ ss sel) (setq ss (ssget '((0 . "*Text")))) (command "copy" ss "" "" "") (setq sel (vlax-ename->vla-object (entlast))) (vlax-put-property sel 'layer "layer2") ) Edited April 5, 2019 by BKRao Quote
dlanorh Posted April 5, 2019 Posted April 5, 2019 (edited) On 05/04/2019 at 13:19, BKRao said: Thank U "BIGAL" Sir I am traying with below code kindly correct it Sir. (defun c:ssct (/ ss sel) (setq ss (ssget '((0 . "*Text")))) (command "copy" ss "" "" "") (setq sel (vlax-ename->vla-object (entlast))) (vlax-put-property sel 'layer "layer2") ) You need to loop through the selection set You can either (defun c:ssct (/ ss cnt obj n_obj) (setq ss (ssget '((0 . "*Text") (8 . "layer1")))) (repeat (setq cnt (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq cnt (1- cnt)))) n_obj (vla-copy obj) ) (vlax-put-property n_obj 'layer "layer2") ) ) or (defun c:ssct (/ ss cnt sel) (setq c_doc (vla-get-activedocument (vlax-get-acad-object)) ss (ssget '((0 . "*Text") (8 . "layer1"))) ) (vlax-for obj (vla-get-activeselectionset c_doc) (setq n_obj (vla-copy obj)) (vlax-put-property n_obj 'layer "layer2") ) ) The text will exactly overwrite the existing text so you will have two text items at each location. Did you by change mean to copy and move? Edited April 7, 2019 by dlanorh corrected code 1 Quote
BIGAL Posted April 6, 2019 Posted April 6, 2019 Copy and move (defun c:ssct (/ ss pt1 pt2 layer2) (setq layer2 (getstring "\nEnter layer name")) (setq ss (ssget '((0 . "*Text")))) (setq pt1 (getpoint "\npick start point ")) (setq pt2 (getpoint pt1 "\npick end point")) (repeat (setq x (sslength ss)) (command "copy" (ssname ss (setq x (- x 1))) "" pt1 pt2) (command "chprop" (entlast) "" "la" Layer2 "" ) ) ) 1 Quote
RaKaMa Posted April 6, 2019 Posted April 6, 2019 Is this not the same as "copytolayer" command? Quote
BKRao Posted April 8, 2019 Author Posted April 8, 2019 Quote Thanking U everyone above program sufficient for my requirement. BKRao 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.