Jump to content

Change the scale factor linetype


teknomatika

Recommended Posts

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")

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...