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

sets the current layer to that of a selected copy objects

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
540 Views, 4 Replies

sets the current layer to that of a selected copy objects

hello

i need a lisp that copy selected objects to current layer.

e.g

commande: copy

Select objects: .... found

Specify base point or [Displacement/mOde/Layer] <Displacement>:L

Enter layer option for copie  objects [Current/Source] <Source>:

 

 

thanks

4 REPLIES 4
Message 2 of 5
paullimapa
in reply to: Anonymous

(defun c:cpl (/ ss)

  (princ"\nSelect Objects To Copy")

  (setq ss(ssget))

  (if ss

   (progn

     (command"_.Copy" ss "" "0,0,0" "0,0,0")

     (command"_.ChProp" ss "" "_LA" (getvar"clayer") "")

   )

   (princ"\nNo Objects Selected")

)


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 5
claytonh
in reply to: Anonymous

I've found that I like the COPYTOLAYER command better than COPY. Give this a try.

(defun c:c2c (/ curlay ss1 )
 (setq curlay (getvar "clayer"))
(while (null ss1)
 (setq ss1 (ssget))
)
 (command "COPYTOLAYER" ss1 "" curlay "")
)

 

Clayton Harrison, PE
CHC Engineers, LLC
C3D 2024
Message 4 of 5
ВeekeeCZ
in reply to: claytonh

(defun C:+c ()	
  (command "_.select" PAUSE)
  (command "_.-copytolayer" "_p" "" (getvar 'clayer) "_X")
  (princ)
)
Message 5 of 5
hmsilva
in reply to: Anonymous

Hi majdov24,


I would suggest the use of 'Copy' with the 'Layer' option, or 'Copy' and 'Chprop', or the "Copytolayer" command , or....,

but, we should test for a valid selection set, before proceeding with the copy* command...

 

 

(defun c:c2cl (/ ss)
  (if (setq ss (ssget "_:L"));to Exclude Locked Layers
    (command "_.copytolayer" ss "" (getvar 'clayer) "")
    (princ "0 found")
  )
  (princ)
)

 

Hope this helps,
Henrique 

EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost