how to select everything in one layer and move it to another one

how to select everything in one layer and move it to another one

f_rivaXGG6C
Contributor Contributor
952 Views
6 Replies
Message 1 of 7

how to select everything in one layer and move it to another one

f_rivaXGG6C
Contributor
Contributor

I just intend to move what is in layer 0 and Defpoints (layers that always exist in the tables where I work) to a new layer called "00".
to do this i intend to use an .lsp file

I don't want to have the layers selected as I already know the names. even if the program repeats itself 2 times, I don't care.

to create and make the new layer "00" active, I have found that it is sufficient to do the following command:

(defun C:PFB (/)
    (command "_-layer" "_n" "00" "_c" "252" "00" "_s" "00" "")
    )

 

ps. i'm using a non-English version, that's why there are "_" before each command

0 Likes
Accepted solutions (1)
953 Views
6 Replies
Replies (6)
Message 2 of 7

Moshe-A
Mentor
Mentor

@f_rivaXGG6C  hi,

 

check this

 

enjoy

moshe

 

 

(defun c:chglay (/ ss)
 (if (setq ss (ssget "_X" '((8 . "0,defpoints"))))
  (progn
   (command "._layer" "_Make" "00" "_Color" 252 "00" "")
   (command "._chprop" "_si" ss "_Layer" "00" "")
  ); progn
 ); if

 (princ "\nDone.")
 (princ)
)

 

 

 

0 Likes
Message 3 of 7

f_rivaXGG6C
Contributor
Contributor

can I ask you what exactly you wrote?

tried it and it works fine, but i also need to import this command within another one

thank you very much

0 Likes
Message 4 of 7

Moshe-A
Mentor
Mentor
Accepted solution

@f_rivaXGG6C ,

 

with comments for you 😀

 

(defun c:chglay (/ ss)
 (if (setq ss (ssget "_X" '((8 . "0,defpoints"))))        ; select all objects on layer 0 + defpoints
  (progn
   (command "._layer" "_Make" "00" "_Color" 252 "00" "")  ; create layer
   (command "._chprop" "_si" ss "_Layer" "00" "")         ; change layer
  ); progn
 ); if

 (princ "\nDone.")
 (princ)
)

 

 

 

0 Likes
Message 5 of 7

f_rivaXGG6C
Contributor
Contributor
thank you very much
0 Likes
Message 6 of 7

diepkhoi90
Contributor
Contributor

Thank mate, I got some problem that I can't change layers inside blocks. Is there any solution? Sorry my English not very well

0 Likes
Message 7 of 7

Moshe-A
Mentor
Mentor

@diepkhoi90 

 

Please, open new thread attach  sample dwg contain your block, explain what do you want to change?

 

Moshe