Creating a Script for Changing LTS to 1 in all drawings

Creating a Script for Changing LTS to 1 in all drawings

jcruickshanks
Explorer Explorer
627 Views
6 Replies
Message 1 of 7

Creating a Script for Changing LTS to 1 in all drawings

jcruickshanks
Explorer
Explorer

Hi all, 

I'm quite new to using scripts and trying to create one to change LTS to 1 in a large batch of drawings where the LTS seems to vary (drawings were created by several people over many years). I tried to write a simple script but it doesn't seem to be working:

 

ltscale
1
qsave

 

It seems as if it gets stuck after typing 1, can someone please advise what I'm doing wrong

0 Likes
Accepted solutions (1)
628 Views
6 Replies
Replies (6)
Message 2 of 7

Kent1Cooper
Consultant
Consultant

@jcruickshanks wrote:

....

It seems as if it gets stuck after typing 1, can someone please advise what I'm doing wrong


Define "it gets stuck."  What happens?  What does the Command line show?  Is there any error message?  Etc., etc.

Kent Cooper, AIA
0 Likes
Message 3 of 7

Nathan_Tigner
Advocate
Advocate

If it is an actual script (.scr), make sure you have a blank space at the end of the script that cad recognizes as ENTER. Maybe this is why it's getting stuck after 1.

0 Likes
Message 4 of 7

ronjonp
Advisor
Advisor
Accepted solution

Maybe this?

(setvar 'ltscale 1)
"_.qsave _.close"

 

Or use THIS tool and use this as the input _.open *file* (setvar 'ltscale 1) _.close

Message 5 of 7

calderg1000
Mentor
Mentor

Regards @jcruickshanks 

Try the following code

(defun c:tsc ( / s i e)
  (setq s (ssget "_X"))
  (repeat (setq i (sslength s))
    (setq e (ssname s (setq i (1- i))))
    (setq en (vlax-ename->vla-object e))
    (vla-put-linetypeScale en 1)
  )
)

 


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

0 Likes
Message 6 of 7

jcruickshanks
Explorer
Explorer

Thanks, the first script didn't seem to work again but I used the tool you suggested and the second script worked perfectly (I added _.qsave before close).

0 Likes
Message 7 of 7

ronjonp
Advisor
Advisor

@jcruickshanks wrote:

Thanks, the first script didn't seem to work again but I used the tool you suggested and the second script worked perfectly (I added _.qsave before close).


Good catch on the _.qsave ... it's been a minute since I've ran scripts 🙂

0 Likes