andyb57J Posted April 30 Posted April 30 (edited) is there a way to update the attached lisp so that you can select and enter new layer names without the underscore between each piece of text. Layers within the drawing are current labeled similar to POD Building Pads. When I attempt to nominate the layer it doesn't accept the space within the text and steps to make new layer within the lisp. I would like to retain the current layer naming convention as this is what is used within company. (defun c:MoveLayerAllLayouts ( / oldLayer newLayer ss) ;; Prompt for source layer (setq oldLayer (getstring "\nEnter the name of the layer to move FROM: ")) ;; Prompt for target layer (setq newLayer (getstring "\nEnter the name of the layer to move TO: ")) ;; Ensure target layer exists, create if not (if (not (tblsearch "layer" newLayer)) (command "_.LAYER" "_Make" newLayer "") ) ;; Select all objects in the drawing (model + layouts) on the old layer (setq ss (ssget "X" (list (cons 8 oldLayer)))) (if ss (progn ;; Change layer of all selected objects (command "_.CHPROP" ss "" "_LA" newLayer "") (princ (strcat "\nMoved all objects from layer \"" oldLayer "\" to \"" newLayer "\".")) ) (princ (strcat "\nNo objects found on layer \"" oldLayer "\".")) ) (princ) ) Edited April 30 by andyb57J Quote
mrharris78 Posted April 30 Posted April 30 (setq oldLayer (getstring T "\nEnter the name of the layer to move FROM: ")) ;; Prompt for target layer (setq newLayer (getstring T "\nEnter the name of the layer to move TO: ")) 1 Quote
mhupp Posted May 1 Posted May 1 (edited) notice your lisp name is MoveLayerAllLayouts that mean other tabs other than model? ssget "_X" wont pick up things on other tabs if they are on that layer. So if your moving everything might assume your deleting the old layer. if that's the case just rename it. no need to mess with ssget and will pick up everything. (vl-cmdf "_.-Rename" "LA" old new) Edited May 1 by mhupp 2 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.