jmerch Posted April 28, 2011 Share Posted April 28, 2011 Is there an easy way (probably LISP) to globally change objects where the linetype is set to Bylayer, and change the linetype to whatever the actual linetype of that layer is? Quote Link to comment Share on other sites More sharing options...
BlackBox Posted April 28, 2011 Share Posted April 28, 2011 (defun c:CLT () (c:ChangeLinetypes)) (defun c:ChangeLinetypes (/ ss layerItem lineType) (princ "CHANGE LINETYPES") (vl-load-com) (if (and (setq eName (car (entsel "\nSelect object on desired layer: "))) (setq ss (ssget "_x" (list (setq layerName (assoc 8 (entget eName))))))) (if (and (setq layerItem (vla-item (vla-get-layers (cond (*activeDoc*) ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object)))))) (vla-get-layer (vlax-ename->vla-object eName)))) (= :vlax-false (vla-get-lock layerItem))) (progn (vla-startundomark *activeDoc*) (vlax-for x (setq ss (vla-get-activeselectionset *activeDoc*)) (vla-put-linetype x (cond (lineType) ((setq lineType (vla-get-linetype layerItem)))))) (vla-delete ss) (vla-endundomark *activeDoc*)) (prompt "** Layer is locked ** ")) (prompt "\n** Nothing selected ** ")) (princ)) Quote Link to comment Share on other sites More sharing options...
eldon Posted April 28, 2011 Share Posted April 28, 2011 Is there an easy way (probably LISP) to globally change objects where the linetype is set to Bylayer, and change the linetype to whatever the actual linetype of that layer is? I can't quite make sense of your request. If an object already has its linetype set to BYLAYER, there is no need to change it. Perhaps I am not reading it correctly, but RenderMan seems to be on the ball. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted April 28, 2011 Share Posted April 28, 2011 I can't quite make sense of your request. If an object already has its linetype set to BYLAYER, there is no need to change it. Perhaps I am not reading it correctly, but RenderMan seems to be on the ball. I agree with you; but I was bored, so I wrote it quickly anyways. LoL Cheers! Quote Link to comment Share on other sites More sharing options...
jmerch Posted April 28, 2011 Author Share Posted April 28, 2011 I do appreciate the LISP RenderMan! I'll give it a whirl today. There is plenty reason to change the linetype from Bylayer. When I clean up architectural files I get in, I take their 500 layers and narrow them down into 6 of my own. Where they have all the linetypes set to Bylayer, I want it to be whatever it was originally on. Example, they may have 3 different furniture layers where 1 has a hidden linetype and the other two don't. I put all these onto 1 layer of mine but want each object to keep it's linetype and not become my Bylayer. Make sense? Quote Link to comment Share on other sites More sharing options...
BlackBox Posted April 28, 2011 Share Posted April 28, 2011 I do appreciate the LISP RenderMan! I'll give it a whirl today. There is plenty reason to change the linetype from Bylayer. When I clean up architectural files I get in, I take their 500 layers and narrow them down into 6 of my own. Where they have all the linetypes set to Bylayer, I want it to be whatever it was originally on. Example, they may have 3 different furniture layers where 1 has a hidden linetype and the other two don't. I put all these onto 1 layer of mine but want each object to keep it's linetype and not become my Bylayer. Make sense? The code I posted originally prompts the user to select an object, and results in all objects on that layer being modified. However, am I correct in my understanding that you are looking to open an external drawing, and simply modify all objects within that drawing (meaning for all layers)? *IF* so, then I can improve the code I posted to no longer prompt you (the user) to select one layer at a time, and instead it (the code) will automatically implement this process for all objects (i.e., all layers) in sequence... your choice. Quote Link to comment Share on other sites More sharing options...
jmerch Posted April 28, 2011 Author Share Posted April 28, 2011 Yes, I noticed your code. I have a similar code that I run to change layers per selection (mine isn't visual and is just dummied down LISP for me). I think I would like to have the change linetype be a global process that I can run in an entire drawing....I wasn't going to bother you with it and was going to play around with it today, but if you're not busy and don't mind :D Really appreciate it. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted April 28, 2011 Share Posted April 28, 2011 Yes, I noticed your code. I have a similar code that I run to change layers per selection (mine isn't visual and is just dummied down LISP for me). No worries; we all start somewhere. I think I would like to have the change linetype be a global process that I can run in an entire drawing....I wasn't going to bother you with it and was going to play around with it today, but if you're not busy and don't mind :D Really appreciate it. ... Thought so; I'll post back the revised code shortly. Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 28, 2011 Share Posted April 28, 2011 Another slow day... I apologize if I've stepped on your toes, Mat. (defun c:LT2All (/ ss i data layer lst) (if (setq ss (ssget "_X")) (repeat (setq i (sslength ss)) (entmod (append (setq data (entget (ssname ss (setq i (1- i))))) (cond ((cadr (assoc (setq layer (cdr (assoc 8 data))) lst))) ((cadar (setq lst (cons (list layer (list (assoc 6 (tblsearch "LAYER" layer)))) lst)))) ) ) ) ) ) (princ) ) It's your responsibility to unlock your layers. :wink: Quote Link to comment Share on other sites More sharing options...
BlackBox Posted April 28, 2011 Share Posted April 28, 2011 ... Thought so; I'll post back the revised code shortly. Another slow day... I wasn't sure when I'd be done with my current task; Thanks Alan. Separately (and offline?), you wouldn't want to share any pointers with me to help with my *pilot* "T" intersection corridor would you? (^^ ya know, since you're slow and all ^^) It's your responsibility to unlock your layers. :wink: I think that's a prudent step; one that I should adopt as well (especially for forum code). Quote Link to comment Share on other sites More sharing options...
jmerch Posted April 28, 2011 Author Share Posted April 28, 2011 Thanks Alan! I can add the unlock layers to the beginning of it Thanks again to you RenderMan. Quote Link to comment Share on other sites More sharing options...
eldosrajan Posted December 17, 2012 Share Posted December 17, 2012 Hi Alan Can you please modify your code to change the line type inside the blocks also. Thanks in advance Quote Link to comment Share on other sites More sharing options...
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.