jim78b Posted May 15, 2019 Posted May 15, 2019 i want a lisp to set property color to bylayer through command line example digit :bl (bylayer)and bk (byblock) and for linetype i want digit for bylayer lb and for byblock lk is possible? thanks Quote
ronjonp Posted May 15, 2019 Posted May 15, 2019 (edited) Your request is kind of vague, but give this quickie a try. Does not do nested items. (defun _foo (c / s) (if (setq s (ssget ":L")) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (entmod (append (entget e) (list (cons 62 c)))) ) ) (princ) ) (defun c:bl nil (_foo 256)) (defun c:bk nil (_foo 0)) (setq a 0) ;; Create c:b1 thru c:b255 for $h!+s :) (repeat 255 (eval (read (strcat "(defun c:b" (itoa (setq a (1+ a))) " nil (_foo " (itoa a) "))")))) Edited May 15, 2019 by ronjonp Quote
Jman Posted May 15, 2019 Posted May 15, 2019 (edited) (defun C:CBL () (COMMAND "CHANGE" PAUSE "" "P" "C" "BYLAYER" "") (PROMPT "nCOLOR CHANGED TO BYLAYER.")) (defun C:LTBL () (COMMAND "CHANGE" PAUSE "" "P" "LT" "BYLAYER" "") (PROMPT "nLINETYPE CHANGED TO BYLAYER.")) (defun C:PS () ;Pick entity to set layer (setvar "CMDECHO" 0) (setq EN (car (entsel "\nPick any entity to set the layer..: "))) (setq ED (entget EN)) (setq LN (cdr (assoc 8 ED ))) (command "LAYER" "S" LN "") (princ) ) Edited May 15, 2019 by Jman Quote
BIGAL Posted May 16, 2019 Posted May 16, 2019 Explain more guesses are being made. Have not transferred the crystal ball to my new laptop yet. Quote
jim78b Posted May 16, 2019 Author Posted May 16, 2019 10 hours ago, ronjonp said: Your request is kind of vague, but give this quickie a try. Does not do nested items. (defun _foo (c / s) (if (setq s (ssget ":L")) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (entmod (append (entget e) (list (cons 62 c)))) ) ) (princ) ) (defun c:bl nil (_foo 256)) (defun c:bk nil (_foo 0)) (setq a 0) ;; Create c:b1 thru c:b255 for $h!+s :) (repeat 255 (eval (read (strcat "(defun c:b" (itoa (setq a (1+ a))) " nil (_foo " (itoa a) "))")))) i want only when i write bk or bl the state of color or layer change in byblock or bylayer and not select an object ... Quote
Tharwat Posted May 16, 2019 Posted May 16, 2019 What I use: (defun c:bys nil (mapcar 'setvar '(CECOLOR CELTYPE CELWEIGHT) '("BYLAYER" "BYLAYER" -1)) (vl-cmdf "_.regen") (princ) ) (vl-load-com) 1 Quote
ronjonp Posted May 16, 2019 Posted May 16, 2019 7 hours ago, jim78b said: i want only when i write bk or bl the state of color or layer change in byblock or bylayer and not select an object ... As Tharwat eluded to: (defun c:bl nil (setvar 'cecolor "ByLayer")) (defun c:bk nil (setvar 'cecolor "ByBlock")) 1 Quote
jim78b Posted May 16, 2019 Author Posted May 16, 2019 2 hours ago, ronjonp said: As Tharwat eluded to: (defun c:bl nil (setvar 'cecolor "ByLayer")) (defun c:bk nil (setvar 'cecolor "ByBlock")) you are the best very thanks!! i make another lisp for linetype: (defun c:ll nil (setvar 'celtype "ByLayer")) (defun c:lk nil (setvar 'celtype "ByBlock")) thanks! to everyone Quote
jim78b Posted May 19, 2019 Author Posted May 19, 2019 HELLO your code is ok but i need a modify please, when i select multiple object that are set on bylayer and type the command example bk the object not change to byblock... Quote
ronjonp Posted May 21, 2019 Posted May 21, 2019 On 5/19/2019 at 2:29 AM, jim78b said: HELLO your code is ok but i need a modify please, when i select multiple object that are set on bylayer and type the command example bk the object not change to byblock... I'm confused. The code above does not do anything to existing objects. It changes the 'cecolor' variable so that new items added to the drawing will take on either bylayer or byblock properties depending on which you run. Quote
ronjonp Posted May 21, 2019 Posted May 21, 2019 32 minutes ago, jim78b said: SORRY can you even make that do that?! Already wrote that HERE. As stated before does not do nested items. Quote
jim78b Posted May 21, 2019 Author Posted May 21, 2019 Quote sorry but I want that when I have an element selected from the keyboard I type for example bk or bl and the type of color or line changes Quote
ronjonp Posted May 21, 2019 Posted May 21, 2019 6 minutes ago, jim78b said: sorry but I want that when I have an element selected from the keyboard I type for example bk or bl and the type of color or line changes Sorry, I cannot help you. Quote
Jman Posted May 21, 2019 Posted May 21, 2019 jim78b i wrote my 2 lisp routines to change existing lines that people changed the color or line type but not the layer . it put them on the correct color or line type for the layer you want to use. I threw in pick set just for fun. I use those lisp routines daily. It doesn't change everything globally 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.