bgerico Posted March 22, 2012 Posted March 22, 2012 Thanks for all those replies, so here is another question for this routine. If I wanted to add all lines that were also less than .012" but make them .004" could I add it in on this line with a follow up if statement. I guess I would have to separate the two "IF" statement to handle the "TEXT" portion and the "LINE" portion. Is this correct?: (if (setq ss (ssget "_X" '((0 . "*TEXT")(0 ."LINE")))). Still learning this stuff. Any suggestions? Thanks, Rick Quote
pBe Posted March 22, 2012 Posted March 22, 2012 sure (defun c:MTLwt (/ ss e i) (vl-load-com) (if (setq ss (ssget "_X" '((0 . "*TEXT[color=blue],LINE[/color]") (-4 . "<=") (370 . 30)))) (repeat (setq i (sslength ss)) (vla-put-lineweight (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i))))) [color=blue](if (wcmatch (vla-get-objectname e) "*Text") 30 9)[/color]) ) ) (princ) ) HTH Quote
Lee Mac Posted March 22, 2012 Posted March 22, 2012 pBe, Note that this filter: (-4 . "<=") (370 . 30) will exclude objects whose lineweight is set to ByLayer, (hence why I use the "" structure) - but then maybe that is what the OP requires. Quote
pBe Posted March 22, 2012 Posted March 22, 2012 (edited) pBe,will exclude objects whose lineweight is set to ByLayer. Odd, cant seem to duplicate that condition Lee . It doesnt exclude values less that 30 here in R2009. since -1 & -3 still less than 30. Maybe by using operand ">". (> -1 30) nil ( T will give you a different result, what do you think? Edited March 22, 2012 by pBe Quote
Lee Mac Posted March 22, 2012 Posted March 22, 2012 My apologies, you are right, the relational test does work, even though the DXF 370 group is not present in the return of entget when set to ByLayer - nice to know. Quote
pBe Posted March 22, 2012 Posted March 22, 2012 My apologies, you are right, the relational test does work, even though the DXF 370 group is not present in the return of entget when set to ByLayer - nice to know. No worries Lee, I learn more from you than any website Cheers Quote
bgerico Posted March 22, 2012 Posted March 22, 2012 Ok, you guys (Lee & pBe) are giving me great info on this text and line weight problem. I did some more testing after the last thread and found out that the new routine that was sent to me works great still with the text line weight, however, the added code for lines created a small problem. I should have said in my post that I needed all lines that were less than .004" be changed to .004". The new code changed all lines less than .012" and equal to .012" to .004". I didn't see this at first until I tested it on a good drawing. I was testing the routine on a drawing were I added text and lines to with different line weights. My fault. So is this a simple fix, I am sure it is for you guys. Can you send it back to me in Vanilla Autolisp, that Visual Lisp gets me confused. Here is the code that was sent to me: (defun c:MTLwt (/ ss e i) (vl-load-com) (if (setq ss (ssget "_X" '((0 . "*TEXT,LINE") (-4 . " (repeat (setq i (sslength ss)) (vla-put-lineweight (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i))))) (if (wcmatch (vla-get-objectname e) "*Text") 30 9)) ) ) (princ) ) Quote
Lee Mac Posted March 22, 2012 Posted March 22, 2012 Try something like this (modifying my earlier post): (defun c:test ( / a e i s x ) (if (setq s (ssget "_X" '( (-4 . "<OR") (-4 . "<AND") (0 . "*TEXT") (-4 . "<") (370 . 30) (-4 . "AND>") (-4 . "<AND") (0 . "LINE") (-4 . "<") (370 . 09) (-4 . "AND>") (-4 . "OR>") ) ) ) (repeat (setq i (sslength s)) (setq e (entget (ssname s (setq i (1- i)))) x (if (eq "LINE" (cdr (assoc 0 e))) '(370 . 9) '(370 . 30)) ) (if (setq a (assoc 370 e)) (entmod (subst x a e)) (entmod (append e (list x))) ) ) ) (princ) ) Quote
bgerico Posted March 22, 2012 Posted March 22, 2012 Thanks for the new routine, I will check it out tomorrow on some drawings and see what works. You guys are great. Cross your fingers!!!! Rick Quote
pBe Posted March 23, 2012 Posted March 23, 2012 I should have said in my post that I needed all lines that were less than .004" be changed to .004". The new code changed all lines less than .012" and equal to .012" to .004". Well in that case (-4 . "] As for a code, cant get any better than what Lee posted. [Vanilla] Cheers Quote
bgerico Posted March 23, 2012 Posted March 23, 2012 Hey Guys, I did some testing this morning and it looks like the routine is almost there. The lineweight text portion of the routine works great. All text less than .012" lineweight including bylayer text is made .012" and all text greater than and equal to .012" lineweight are not changed. So we are good there. However, the Line linweight portion still has one problem. Here is what works on the Line portion. All line lineweights .004" and greater are not changed and all lines less than .004" are changing to .004". This is good. What i didn't account for are lineweights that are set to "Bylayer". Just like in the text portion all "Bylayer" text lineweight were changed to .012". In the line portion I need any "Bylayer" lineweight also to change to .012". As the routine runs now the "Bylayer" lineweights are changing to .004" also. So can you adjust Lee's (vanilla) routine to make the "Bylayer" lineweights change to .012". This should do it. I hope this doesn't put you guys out. Seems like you all like a challenge. Thanks, Rick Quote
pBe Posted March 23, 2012 Posted March 23, 2012 (edited) remove then oops Didnt read the post long enough to understand the request.... hang on So if LINE or TEXT/MTEXT is "Bylayer" go 0.12" If LINE LW less than 0.009 go 0.004" If TEXT/MTEXT less than 0.012" go 0.012" (defun c:MTLwt (/ ss e a j) (if (setq ss (ssget "_X" '( (-4 . "<OR") (-4 . "<AND") (0 . "*TEXT") (-4 . "<") (370 . 30) (-4 . "AND>") (-4 . "<AND") (0 . "LINE") (-4 . "<") (370 . 09) (-4 . "AND>") (-4 . "OR>") ) ) ) (repeat (setq i (sslength ss)) (setq e (entget (ssname ss (setq i (1- i)))) j (if (eq (cdr (assoc 0 e)) "LINE") 9)) (cond ((not (setq a (assoc 370 e))) (entmod (append e '((370 . 30))))) (j (entmod (subst '(370 . 9) a e))) ((and a (null j)) (entmod (subst '(370 . 30) a e))) ) ) )(princ) ) BTW: what if "ByBlock"? still 0.012" for both LINE and TEXT? Edited March 23, 2012 by pBe Quote
Lee Mac Posted March 23, 2012 Posted March 23, 2012 Thanks pBe Though, it could be made more concise: (defun c:test ( / a e i s ) (if (setq s (ssget "_X" '( (-4 . "<OR") (-4 . "<AND") (0 . "*TEXT") (-4 . "<") (370 . 30) (-4 . "AND>") (-4 . "<AND") (0 . "LINE") (-4 . "<") (370 . 09) (-4 . "AND>") (-4 . "OR>") ) ) ) (repeat (setq i (sslength s)) (setq e (entget (ssname s (setq i (1- i))))) (cond ( (null (setq a (assoc 370 e))) (entmod (append e '((370 . 30)))) ) ( (eq "LINE" (cdr (assoc 0 e))) (entmod (subst '(370 . 9) a e)) ) ( (entmod (subst '(370 . 30) a e))) ) ) ) (princ) ) Quote
pBe Posted March 23, 2012 Posted March 23, 2012 Thanks pBe Though, it could be made more concise: Indeed , I had one too many vairables not needed. Cheers Lee. Quote
SLW210 Posted March 23, 2012 Posted March 23, 2012 Please read the CODE POSTING GUIDELINES. I really wasn't posting that to boost my post count. 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.