kingisland99762 Posted January 26, 2010 Posted January 26, 2010 Looking for lisp to do the following: Changes entities to layer 0, color GREEN and nothing else. any help? Thanks jim Quote
CALCAD Posted January 27, 2010 Posted January 27, 2010 OK, change simple entities green, move them to layer zero and nothing else. (Requires preselect, so PICKFIRST must be on) (defun c:lzg (/ gsel sslen n en el) (setq gsel (ssget "I")) (setq sslen (sslength gsel)) (setq n 0) (if gsel (while (< n sslen) (setq en (ssname gsel n)) (setq el (entget en)) (setq el (subst (cons 62 3) (assoc 62 el) el)) (setq el (subst (cons 8 "0") (assoc 8 el) el)) (entmod el) (setq n (+ n 1)) ) ) (setq gsel nil) (princ) ) Quote
ronjonp Posted January 27, 2010 Posted January 27, 2010 Yikes! I hope I never have to work on your drawings.... Quote
Tiger Posted January 27, 2010 Posted January 27, 2010 Looking for lisp to do the following:Changes entities to layer 0, color GREEN and nothing else. any help? Thanks jim Not that I doubt the lisp-capability, but why not do a Ctrl+A (to select everything) then change the layer and color in the Properties palette? But I agree with above, this sounds like you'll just mess up your drawing. IF you care to let us know what the purpose is, there might be better ways to do it. Quote
Lee Mac Posted January 27, 2010 Posted January 27, 2010 CALCAD, You will need to allow for those ent's without a DXF 62 code (defun c:doit (/ i ss ent eLst) (if (setq i -1 ss (ssget "_:L")) (while (setq ent (ssname ss (setq i (1+ i)))) (setq eLst (entget ent)) (setq eLst (subst '(8 . "0") (assoc 8 eLst) eLst)) (entmod (if (assoc 62 eLst) (subst '(62 . 3) (assoc 62 eLst) eLst) (append eLst '((62 . 3))))))) (princ)) Quote
CALCAD Posted January 27, 2010 Posted January 27, 2010 Lee, You're right, of course, about handling entities without the 62 dxf code (the BYLAYER entities, I guess - are there others?) Thanks for that. But I can't get your code to work on my old Intellicad. I looked up the "_:L" option and I see that one would want to avoid selecting from locked layers, but does (ssget "_:L") select anything else? I have to substitute with (ssget "I") to make it work. Quote
Lee Mac Posted January 27, 2010 Posted January 27, 2010 Lee, You're right, of course, about handling entities without the 62 dxf code (the BYLAYER entities, I guess - are there others?) Thanks for that. But I can't get your code to work on my old Intellicad. I looked up the "_:L" option and I see that one would want to avoid selecting from locked layers, but does (ssget "_:L") select anything else? I have to substitute with (ssget "I") to make it work. Hmmm.. it works fine on ACAD2010, so it could just be an issue in Intellicad with the "_:L", although I've never had that issue reported before. As for the DXF 62 code, I would normally use VL to change color, as the property is always available, and its a quick one-liner, but, when dealing with DXF codes, I would always check, as BYLAYER ents won't have it. Quote
Lee Mac Posted January 27, 2010 Posted January 27, 2010 An alternative to "_:L" would be this I suppose: (defun c:doit (/ lock tdef i ss ent eLst) (setq lock "") (while (setq tdef (tblnext "LAYER" (not tdef))) (if (= 4 (logand 4 (cdr (assoc 70 tdef)))) (setq lock (strcat lock (cdr (assoc 2 tdef)) ",")))) (if (setq i -1 ss (ssget (list '(-4 . "<NOT") (cons 8 (substr lock 1 (1- (strlen lock)))) '(-4 . "NOT>")))) (while (setq ent (ssname ss (setq i (1+ i)))) (setq eLst (entget ent)) (setq eLst (subst '(8 . "0") (assoc 8 eLst) eLst)) (entmod (if (assoc 62 eLst) (subst '(62 . 3) (assoc 62 eLst) eLst) (append eLst '((62 . 3))))))) (princ)) Quote
David Bethel Posted January 27, 2010 Posted January 27, 2010 What about heavy polylines sequential entities? Attributes? BLOCK table entities? I actually do this a good bit. Merge only the elements of an architect's backgound that I need onto a single layer ( "1D-ARCH" I call it ). I retain the entity original color though, even if bylayer ( I make it the color of the original layer ) -David Quote
CALCAD Posted January 27, 2010 Posted January 27, 2010 And it sounded like such a simple question. Damn. Quote
kingisland99762 Posted January 27, 2010 Author Posted January 27, 2010 Hey thanks a lot guys, yeah I hate working on these drawings too, but I get paid to do what they want me to do, single layer with tiff image, two colors, one for drawing one for errors they think that needs to be changed...... If it wasn't for the low pay I'd be doing something else..... some people are brighter then others, its hard for them to shine bright when their brightness is like a single burning candle during the day. enough said, and now you have a glimps of what I have to deal with. 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.