Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
f_rivaXGG6C
526 Views, 6 Replies

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

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

Tags (3)
6 REPLIES 6
Message 2 of 7
Moshe-A
in reply to: f_rivaXGG6C

@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)
)

 

 

 

Message 3 of 7
f_rivaXGG6C
in reply to: Moshe-A

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

Message 4 of 7
Moshe-A
in reply to: f_rivaXGG6C

@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)
)

 

 

 

Message 5 of 7
f_rivaXGG6C
in reply to: Moshe-A

thank you very much
Message 6 of 7
diepkhoi90
in reply to: Moshe-A

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

Message 7 of 7
Moshe-A
in reply to: diepkhoi90

@diepkhoi90 

 

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

 

Moshe

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report