A lisp program about changing linetypes

A lisp program about changing linetypes

Anonymous
Not applicable
3,538 Views
9 Replies
Message 1 of 10

A lisp program about changing linetypes

Anonymous
Not applicable

I was wondering if there was a possible program that could change the linetype of a drawing but have the appearance of all the other lines remain constant. (the linetype of those lines does not matter). I have been experimenting with msltscale, but have found that when I turn that off and regenerate the program the lines return to their previous scale, any ideas? I'm relatively new to AutoCAD (2016 version), so anything helps.

0 Likes
Accepted solutions (1)
3,539 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable

@Anonymous I do not understand you.
SELECTSIMILAR on all lines and Change PROPERTIES, Not working?
Please post an example of your .dwg explaining better.

 

0 Likes
Message 3 of 10

Anonymous
Not applicable

It's not a specific drawing that I'm working on. I'm trying to change the LTscale for any drawing and have the lines change linetype scale accordingly. For example, say a line has a scale of 16 and my global ltscale is 1. I want to change my global ltscale to 2 and have my line look the same. When i change the global ltscale from 1 to 2, the linetype scale of the line stays 16 but actually resembles 32. So what I'm trying to do is select all lines and divide by the new scale so they will look the same when the global ltscale is changed if that makes sense.

0 Likes
Message 4 of 10

Anonymous
Not applicable

I've reread my first message and meant to add "scale" after linetype, i see why you were confused, my mistake.

0 Likes
Message 5 of 10

Anonymous
Not applicable

@Anonymous Something like ?

(defun c:Demo (/ ss id ls)
  (setq ss (ssget "_X" '((0 . "LINE")))
	id 0)
  (setq ls (getreal "\nNew Scale: "))
  (repeat
    (sslength ss)
    (command "_.Chprop" ss "" "ltScale" ls "")
    (setq id (1+ id))
    )
  (princ)
  )

Demo.gif

Message 6 of 10

Anonymous
Not applicable

Very close to that! Instead of changing the linetype scales of all lines to the new linetype scale, is there a way to divide them by the new linetype scale instead?

0 Likes
Message 7 of 10

Anonymous
Not applicable
Accepted solution

A simple way to do this is to add one more in the ssget (48 . 0.1) change the pink text to the scale of your line. so the program will only select lines from this scale.

(defun c:Demo (/ ss id ls)
  (setq ss (ssget "_X" '((0 . "LINE")(48 . 0.1)))
	id 0)
  (setq ls (getreal "\nNew Scale: "))
  (repeat
    (sslength ss)
    (command "_.Chprop" ss "" "ltScale" ls "")
    (setq id (1+ id))
    )
  (princ)
  )

d2.gif

"Accept as Solution" if it has solved the problem.

Message 8 of 10

Anonymous
Not applicable

That's perfect, thank you! I was having trouble getting the selection sets.

 

Best!

Message 9 of 10

Anonymous
Not applicable

Sorry. @Anonymous
unnecessary variable!

(defun c:Demo1 (/ ss ls)
  (setq ss (ssget "_X" '((0 . "LINE")(48 . 0.1))))
  (setq ls (getreal "\nNew Scale: "))
  (repeat
    (sslength ss)
    (command "_.Chprop" ss "" "ltScale" ls "")
    )
  (princ)
  )
0 Likes
Message 10 of 10

Anonymous
Not applicable

That's fine! you've been a great help! Is there anyway we could replace the 0.1 with a variable that checks all numbers from 1 to 100 instead of just 0.1?

0 Likes