I once wrote a lisp routine to change the colour and linetype of selected objects to bylayer and allow selection of a new target layer.
The change colour and linetype (and ltscale) part really only needs a macro.
|
I once wrote a lisp routine to change the colour and linetype of selected objects to bylayer and allow selection of a new target layer.
The change colour and linetype (and ltscale) part really only needs a macro.
Here it is.
Note that the function name "REG" needs to be changed because "reg" is now an alias for the "region" command.
You may only need a script or macro based on the part in red.Code:;****************************************************************************** ;REG.LSP by John A Bogie of FactorEdge Ltd. (01623-452726) ;October 1994. ;Change entities' layers and change colour and linetype to `bylayer'. ;****************************************************************************** (defun regerr (s) (if (/= s "Function cancelled") ; If an error (such as CTRL-C) occurs (princ (strcat "\nError: " s)) ; while this command is active... ) (setq group1 nil) ; Free selection set (setvar "cmdecho" cmde) ; reset sysvar (setq *error* olderr ) ; Restore old *error* handler (princ) ) ;****************************************************************************** (defun c:reg ( / cmd group1 nlayer ) (setq cmde (getvar "cmdecho")) (setvar "cmdecho" 0) (if *error* ; Set new error handler (setq olderr *error*) (setq *error* regerr) ) (setq group1 (ssget)) (setq nlayer (getstring "new layer: ")) (command "chprop" group1 "" "la" nlayer "c" "bylayer" "lt" "bylayer" "") (setq group1 nil) (setvar "cmdecho" cmde) (setq *error* olderr) ; Restore old *error* handler (princ) ) ;****************************************************************************** (princ "\n `REG' loaded: changes entity colour and linetype to `bylayer'.") (princ "\n Optionally changes entity layer.") (princ) ;******************************************************************************
Thanks for the lisp, now if I only knew what to do with it. I'm just now getting back to AutoCAD after almost 7 years on Microstation. Haven't used, written or even seen these "lisp" thing's in action yet.
Maybe I can figure it out. Any help from anyone is appreciated.
Question - I use Match Prop a lot - but for some reason it won't recognize the command in the drawing I'm working on at this moment. It did on an earlier one today - but when I opened this one, it has stopped working.
For some reason my "match prop." stopped working as it used do. I checked the settings for it and they are still ok. Any suggestions? BTW, I am on Autocad 2009.
thanks!
caddiva
I know that this is an old post, but I'm currently experiencing issues with the matchprop command. Specifically, when I match text elements, it ignores the font. Is there a setting that I'm missing?
Yes, it is mtext.
It doesn't seem to matter if the text has been modified or is just set to a standard text style. Matchprop has no effect on it.
Example, mtext is placed using a text style named CAD.
When I match other mtext that is placed using a style named Standard nothing happens.
Previously, it changed.
You can select the objects you want to change, go up to the layer pull down and select the layer you want.
I use a simple lisp routine to do exactly what you want.
(defun C:CCC (/ ss cly)
(setvar "cmdecho" 0)
(setq cly (GETVAR "clayer"))
(setq ss (ssget))
(command "chprop" ss "" "la" cly "color" "bylayer" "lt" "bylayer" "")
(setvar "cmdecho" 1)
)
Copy the above and save it in a text file named CCC.lsp to a folder on your harddrive. Since you are using autocad again you will want to have a folder for lisp files. I keep mine simple and have it at C:\ACAD.
Now in AutoCAD start the APPLOAD command, pick on the Contents button in the lower right, pick add, navigate to the file, add, close, close. Now when you start autocad again in the future you will be able to type CCC, enter, pick objects and hit enter, they will be on the current layer.