Matt_ Posted March 12, 2012 Posted March 12, 2012 Hi there guys I'm looking to map layer sets from one set of drawings to another set via VL (inside a script). The problem for me is I can't find the DXF code 370 ( lineweight ename value ) when using tblnext to get the "LAYER" symbol table parameters. (have changed lineweight with layer manager to be sure) Is there afurther step I need to include past the tblnext cmd? Alternately I need the vla commands that interigate the symbol table for lineweight. (I can't even get the vla-get-freeze to work tho so the code for the collection would be helpful too.) would anyone have that elusive idea / bit of code ? Thanks in advance Matt Quote
MSasu Posted March 12, 2012 Posted March 12, 2012 Try using TBLOBJNAME instead: (entget (tblobjname "LAYER" "0")) Regards, Mircea Quote
Matt_ Posted March 12, 2012 Author Posted March 12, 2012 (edited) Thanks Mircea that worked perfectly I also worked out/borrowed the collection and lineweight using (vlax-for layers (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object))) (setq lay_linewt (vla-get-lineweight layers)) ; where default linewt = -3 ) ; end for but need to put in more code to get the result to mean anything Edited March 21, 2012 by SLW210 Quote
MSasu Posted March 12, 2012 Posted March 12, 2012 You're welcome! Also, please don't forget to add code brackets to your code excerpts. Regards, Mircea Quote
bgerico Posted March 21, 2012 Posted March 21, 2012 Hello everyone, I am new to this forum. I had the same problem as Matt, I am looking for the DXF code 370 (lineweight ename value) that is assigned to Text or Mtext. I am trying to write a lisp routine that selects all text and mtext and determines if the text lineweight is less than .012". if it is then change it to .012". Here at my company we are having a problem seeing the fonts when plotting if they are less than .012", which is our standard. We found many drawings that contained .000" or .010". Does anyone have code that would do this sort of routine. Any help would be great. Thanks, Rick Quote
MSasu Posted March 21, 2012 Posted March 21, 2012 For both TEXT and MTEXT entities the lineweight is stored on DXF code 370, which is listed when get the associated list by ENTGET. When there is no 370 code, then the lineweight is set to ByLayer. Regards, Mircea Quote
pBe Posted March 21, 2012 Posted March 21, 2012 (edited) (defun c:MTLwt (/ ss e i) (vl-load-com) (if (setq ss (ssget "_X" '((0 . "*TEXT")))) (repeat (setq i (sslength ss)) (if (< (vla-get-lineweight (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))))) 30) (vla-put-lineweight e 30)) ) ) (princ) ) Vanilla (defun c:MTLwt (/ ss e a) (if (setq ss (ssget "_X" '((0 . "*TEXT")))) (repeat (setq i (sslength ss)) (setq e (entget (ssname ss (setq i (1- i))))) (cond ((not (setq a (assoc 370 e))) (entmod (append e '((370 . 30))))) ((< (cdr a) 30) (entmod (subst '(370 . 30) a e))))))(princ) ) You can however modiy the layer where the text/mtext is currently assigned and change the linewight to 30 and change all text/mtext LW property to bylayer.. (just a thought) Edited March 21, 2012 by pBe Edit formatting.... Quote
Tharwat Posted March 21, 2012 Posted March 21, 2012 pBe , I couldn't finish my code before you modified your last post and added Vanilla one , so I should save my code into my toolbox. I guess the OP needs the lineweight to be 0.13 and neither 0.12 or 0.30 . Thanks I am trying to write a lisp routine that selects all text and mtext and determines if the text lineweight is less than .012". if it is then change it to .012". Quote
MSasu Posted March 21, 2012 Posted March 21, 2012 One comment, just don’t forget that the lineweight setting is obsolete if the font is TTF. Regards, Mircea Quote
pBe Posted March 21, 2012 Posted March 21, 2012 pBe , I couldn't finish my code before you modified your last post and added Vanilla one , so I should save my code into my toolbox. I guess the OP needs the lineweight to be 0.13 and neither 0.12 or 0.30 . Thanks 0.012" [inches] ---> 30mm Besides, i dont think you can assign floating numbers to DXF 370. Quote
Tharwat Posted March 21, 2012 Posted March 21, 2012 0.012" [inches] ---> 30mm I am sorry , I did not notice the inch mark Besides, i dont think you can assign floating numbers to DXF 370. Did not get your idea . Thanks Quote
pBe Posted March 21, 2012 Posted March 21, 2012 One comment, just don’t forget that the lineweight setting is obsolete if the font is TTF.Regards, Mircea I never knew that Mircea. Good point. Also the need to check for valid values for LW, otherwise it wont do a thing. (i.e. 14 32 invalid values) Cheers Quote
Lee Mac Posted March 21, 2012 Posted March 21, 2012 A minor optimisation: (defun c:txtwgt ( / a e i s ) (if (setq s (ssget "_X" '((0 . "*TEXT") (-4 . "<NOT") (-4 . ">=") (370 . 30) (-4 . "NOT>")))) (repeat (setq i (sslength s)) (setq e (entget (ssname s (setq i (1- i))))) (if (setq a (assoc 370 e)) (entmod (subst '(370 . 30) a e)) (entmod (append e '((370 . 30)))) ) ) ) (princ) ) Quote
pBe Posted March 21, 2012 Posted March 21, 2012 I am sorry , I did not notice the inch mark No worries tharwat Did not get your idea .Thanks 0.30 or 1.50 nor 1 12 28 Quote
Lee Mac Posted March 21, 2012 Posted March 21, 2012 ... 330-369 String representing hex object IDs 370-379 16-bit integer value 380-389 16-bit integer value ... Reference: http://docs.autodesk.com/ACD/2011/ENU/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-7a64.htm Quote
pBe Posted March 21, 2012 Posted March 21, 2012 Reference: Originally Posted by DXF Reference ... 330-369 String representing hex object IDs 370-379 16-bit integer value 380-389 16-bit integer value ... http://docs.autodesk.com/ACD/2011/ENU/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-7a64.htm Yes. that. Thank you for WiLeepedia A minor optimisation: ......(setq s (ssget "_X" '((0 . "*TEXT") (-4 . "<NOT") (-4 . ">=") (370 . 30) (-4 . "NOT>"))))..... Better Quote
bgerico Posted March 21, 2012 Posted March 21, 2012 Thanks for the quick reply. Its nice to have this in both versions. The program worked great. This is exactly what we were looking for. Thanks again. (defun c:MTLwt (/ ss e i) (vl-load-com) (if (setq ss (ssget "_X" '((0 . "*TEXT")))) (repeat (setq i (sslength ss)) (if (< (vla-get-lineweight (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))))) 30) (vla-put-lineweight e 30)) ) ) (princ) ) Vanilla (defun c:MTLwt (/ ss e a) (if (setq ss (ssget "_X" '((0 . "*TEXT")))) (repeat (setq i (sslength ss)) (setq e (entget (ssname ss (setq i (1- i))))) (cond ((not (setq a (assoc 370 e))) (entmod (append e '((370 . 30))))) ((< (cdr a) 30) (entmod (subst '(370 . 30) a e))))))(princ) ) You can however modiy the layer where the text/mtext is currently assigned and change the linewight to 30 and change all text/mtext LW property to bylayer.. (just a thought) Quote
Lee Mac Posted March 21, 2012 Posted March 21, 2012 Thank you for WiLeepedia lol, that sounds wrong Quote
pBe Posted March 22, 2012 Posted March 22, 2012 Thanks for the quick reply. Its nice to have this in both versions. The program worked great. This is exactly what we were looking for.Thanks again. Great, good for you bgerico here's another one (defun c:MTLwt (/ ss e i) (vl-load-com) (if (setq ss (ssget "_X" '((0 . "*TEXT") (-4 . "<=") (370 . 30)))) (repeat (setq i (sslength ss)) (vla-put-lineweight (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i))))) 30)) ) (princ) ) Enjoy 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.