teknomatika Posted October 31, 2012 Share Posted October 31, 2012 Why is it that sometimes works and sometimes does not work? What contributes to this happen? I intend to apply the routine to change the scale factor of linetypes. (defun c:ls (/ ns a n i b1 c d b2) (setvar "cmdecho" 0) (setq ns (getreal "\nNew Scale: ")) (setq a (ssget)) (setq n (sslength a)) (setq i 0) (repeat n (setq b1 (entget (ssname a i))) (setq i (1+ i)) (setq c (assoc 48 b1)) (setq d (cons (car c) ns)) (setq b2 (subst d c b1)) (entmod b2) ) (princ) ) (prompt "\nType: LS") Quote Link to comment Share on other sites More sharing options...
Tharwat Posted October 31, 2012 Share Posted October 31, 2012 You have one mistake with function name entmode and must be without e like this entmod . The name of your current routine is belong to built-in command list . Did you try the ltscale command call ? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted October 31, 2012 Share Posted October 31, 2012 Although I am not sure if you can change the scale factor for each entity alone . Quote Link to comment Share on other sites More sharing options...
teknomatika Posted October 31, 2012 Author Share Posted October 31, 2012 You have one mistake with function name entmode and must be without e like this entmod . The name of your current routine is belong to built-in command list . Did you try the ltscale command call ? Tharwat, Fixed, but still the same inconsistency. Also, sometimes doubles the line. Quote Link to comment Share on other sites More sharing options...
MSasu Posted October 31, 2012 Share Posted October 31, 2012 Please pay attention that DXF code 48 (local linetype scale factor) appears only when the value is different than 1.0 - similar as code 62 of color or 6 for linetype. The LTSCALE is in fact a system variable and its value affect the appearance of entities by multiplying the local linetype scale factor. Quote Link to comment Share on other sites More sharing options...
MSasu Posted October 31, 2012 Share Posted October 31, 2012 The solution should be similar with the one I have suggested to you in this previous thread. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 31, 2012 Share Posted October 31, 2012 Consider the following code: (defun c:ls ( / a e i ns s ) (initget 7) (setq ns (getreal "\nNew Scale: ") ns (cons 48 ns) ) (if (setq s (ssget "_:L")) (repeat (setq i (sslength s)) (setq e (entget (ssname s (setq i (1- i))))) (if (setq a (assoc 48 e)) (setq e (subst ns a e)) (setq e (append e (list ns))) ) (entmod e) ) ) (princ) ) Also note that there is no need to alter the CMDECHO System Variable, since you are not calling any commands in your code. Please take some time to study the above code and ask if you have any questions. Quote Link to comment Share on other sites More sharing options...
teknomatika Posted October 31, 2012 Author Share Posted October 31, 2012 Consider the following code: (defun c:ls ( / a e i ns s ) (initget 7) (setq ns (getreal "\nNew Scale: ") ns (cons 48 ns) ) (if (setq s (ssget "_:L")) (repeat (setq i (sslength s)) (setq e (entget (ssname s (setq i (1- i))))) (if (setq a (assoc 48 e)) (setq e (subst ns a e)) (setq e (append e (list ns))) ) (entmod e) ) ) (princ) ) Also note that there is no need to alter the CMDECHO System Variable, since you are not calling any commands in your code. Please take some time to study the above code and ask if you have any questions. Lee, I appreciate this more help. Within my limitations, I think that I think understand the code. However, for the code that I published, I can not understand why some work and other times not. One thing I can see is that one of the characteristics of their codes is its optimization without redundant code or excess lines. This is execpcional, certainly, and only reveals its quality, but for someone whose knowledge of AutoLISP is still very basic, it becomes a little more difficult to understand the code in its step-by-step. For all, it is always a privilege to receive the help and explanations by true masters. Tanks 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.