Alex_0518 Posted April 15, 2020 Posted April 15, 2020 Hello Folks, Hope y'all are safe. I have a question regarding getting colors, line types, and line weights. If I use (getvar 'CECOLOR), (getvar 'CELTYPE), or (getvar 'CELWEIGHT) it gives me the CURRENT values. Is there a way to get values when multiples are selected? (i.e. two lines that are set as bylayer and byblock) (defun C:test (); (princ (getvar 'cecolor)) (princ "\n") (princ (getvar 'celweight)) (princ "\n") (princ (getvar 'celtype)) (princ) ) The main reason I'm asking this is, i need to store dwg files into a different location if the drawing contains anything but bylayer property. Please help, and Thank you in advance. Quote
dlanorh Posted April 15, 2020 Posted April 15, 2020 Firstly, welcome to CADTutor To find out if "Anything" is not bylayer you would have to iterate through every entity in the drawing. Or do you mean something else? Quote
Alex_0518 Posted April 15, 2020 Author Posted April 15, 2020 7 minutes ago, dlanorh said: Firstly, welcome to CADTutor To find out if "Anything" is not bylayer you would have to iterate through every entity in the drawing. Or do you mean something else? Thank you dlanorh, Uhm Sorry, I'm kind of new to this AutoLISP programming, I'm not sure if I understood you correctly. XD I'm assuming you meant i would have to have multiple if statements? Basically, what I'm trying to do is to hit [Ctrl+A] and see if properties are set to "bylayers" as shown below If they are not set to "bylayers" I'd have to save them in a different location. Since I have almost 100k+ dwg to go through, it'd be very helpful to use AutoLISP. Quote
dlanorh Posted April 15, 2020 Posted April 15, 2020 (edited) 2 hours ago, Alex_0518 said: Thank you dlanorh, Uhm Sorry, I'm kind of new to this AutoLISP programming, I'm not sure if I understood you correctly. XD I'm assuming you meant i would have to have multiple if statements? Basically, what I'm trying to do is to hit [Ctrl+A] and see if properties are set to "bylayers" as shown below If they are not set to "bylayers" I'd have to save them in a different location. Since I have almost 100k+ dwg to go through, it'd be very helpful to use AutoLISP. So you're only interested in whether CECOLOR, CELTYPE and CELWEIGHT are set bylayer, or do you also need CELTSCALE & CETRANSPARENCY? The lisp is the simple part, you could also use ODBX to process multiple drawings in a folder and move them, although I'm not au fait with ODBX (defun c:isbylayer ( / sv_lst sv_vals clst) (setq sv_lst (list 'cecolor 'celtype 'celweight) sv_vals (list "BYLAYER" "BYLAYER" -1)) (mapcar '(lambda (x y) (if (= (type y) 'STR) (setq clst (cons (= y (strcase (getvar x))) clst)) (setq clst (cons (= y (getvar x)) clst)))) sv_lst sv_vals) (princ (if (vl-every '(lambda (x) x) clst) "All ByLayer" "NOT ByLayer")) (princ) ) Edited April 15, 2020 by dlanorh Quote
Alex_0518 Posted April 15, 2020 Author Posted April 15, 2020 1 hour ago, dlanorh said: So you're only interested in whether CECOLOR, CELTYPE and CELWEIGHT are set bylayer, or do you also need CELTSCALE & CETRANSPARENCY? The lisp is the simple part, you could also use ODBX to process multiple drawings in a folder and move them, although I'm not au fait with ODBX (defun c:isbylayer ( / sv_lst sv_vals clst) (setq sv_lst (list 'cecolor 'celtype 'celweight) sv_vals (list "BYLAYER" "BYLAYER" -1)) (mapcar '(lambda (x y) (if (= (type y) 'STR) (setq clst (cons (= y (strcase (getvar x))) clst)) (setq clst (cons (= y (getvar x)) clst)))) sv_lst sv_vals) (princ (if (vl-every '(lambda (x) x) clst) "All ByLayer" "NOT ByLayer")) (princ) ) Thank you for your reply. I'll do more digging. Quote
ronjonp Posted April 15, 2020 Posted April 15, 2020 Here's one way ( nothing nested checked ) (if (and (setq s (ssget "_X")) (vl-some '(lambda (r) (vl-some '(lambda (j) (assoc j (entget r))) '(6 62 370))) (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) ) ) (alert "Something not bylayer!") (alert "All good!") ) Quote
BIGAL Posted April 15, 2020 Posted April 15, 2020 (edited) Another way unfortunately as mentioned need to check every object, erase the objects that match what you want or don't want, then saveas but be careful as you are erasing, or move the objects a fixed distance say to the right and use wblock then move them all back. Edited April 15, 2020 by BIGAL 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.