Changing linetype scales

Changing linetype scales

Anonymous
Not applicable
7,118 Views
29 Replies
Message 1 of 30

Changing linetype scales

Anonymous
Not applicable

My goal is to change the linetype scale of all the lines at once by dividing by a constant. When I select all and go to CHANGE>PROPERTIES>LTSCALE it gives me <varies>. Is there a way to take all the values and divide them all by a constant or do I have to do them all one by one? 

0 Likes
Accepted solutions (1)
7,119 Views
29 Replies
Replies (29)
Message 21 of 30

yiannis242
Explorer
Explorer

Did anyone find lisp changing lts in all blocks by a factor? I found lisp setting a new lts but not changing it by a factor.

0 Likes
Message 22 of 30

ps-trigenex
Participant
Participant

@yiannis242 Did you try with code in my last message ??

(defun c:ltschange ( / doc scl )
    (initget 6)
    (if (setq scl (getreal "\nSpecify new linetype scale: "))
        (vlax-for blk (vla-get-blocks (setq doc (vla-get-activedocument (vlax-get-acad-object))))
            (if (= :vlax-false (vla-get-isxref blk))
                (vlax-for obj blk
                    (if (and (vlax-write-enabled-p obj) (vlax-property-available-p obj 'linetypescale t))
                        (vla-put-linetypescale obj scl)
                    )
                )
            )
        )
    )
    (vla-regen doc acallviewports)
    (princ)
)

 

0 Likes
Message 23 of 30

yiannis242
Explorer
Explorer

Yes but this one sets a new linetype scale. I don't want to set a new scale, i want to change the existing by a factor.

0 Likes
Message 24 of 30

pendean
Community Legend
Community Legend

@yiannis242 wrote:

Yes but this one sets a new linetype scale. I don't want to set a new scale, i want to change the existing by a factor.


pendean_0-1686234444947.png

 

0 Likes
Message 25 of 30

Kent1Cooper
Consultant
Consultant

@yiannis242 wrote:

.... i want to change the existing by a factor.


Just to clarify, I think [but others apparently are not interpreting it this way] that you mean you want to multiply the current linetype scale [factor] of the object by a multiplier [your "factor" above].  So if your "factor"/multiplier is 2 [meaning "increase all linetype scales by a factor of 2"], and an object's linetype scale is currently 5, you want its linetype scale to become 10.  Is that a correct interpretation?

Kent Cooper, AIA
0 Likes
Message 26 of 30

yiannis242
Explorer
Explorer

Exactly! Like global scale factor but i need something changing scale of each line.

0 Likes
Message 27 of 30

yostmNFKEX
Community Visitor
Community Visitor

if you want to change block ltscales - themselves, do a BEdit. Pick your objects and change the ltscale. This will change it universally.

0 Likes
Message 28 of 30

yiannis242
Explorer
Explorer

I need a routine make this automatically.

 

This routine change linetype scale as i want but it does not work for blocks.

(defun c:ltchange (/ mult ss n ent)
  (setq mult (getreal "\nMultiplier to apply to all objects' linetype scales: "))
  (setq ss (ssget "_X" '((0 . "arc,circle,ellipse,line,*polyline"))))
  (repeat (setq n (sslength ss))
    (command "_.chprop" (setq ent (ssname ss (setq n (1- n)))) ""
      "_ltScale" (* (cond ((cdr (assoc 48 (entget ent)))) (1)) mult)
;; [no (assoc 48) entry if object's ltScale is 1] "" ) ); repeat (princ) )

 

This routine works for blocks but it does not change the scale by a factor. It asks for a new scale.

 

(defun c:ltschange ( / doc scl )
    (initget 6)
    (if (setq scl (getreal "\nSpecify new linetype scale: "))
        (vlax-for blk (vla-get-blocks (setq doc (vla-get-activedocument (vlax-get-acad-object))))
            (if (= :vlax-false (vla-get-isxref blk))
                (vlax-for obj blk
                    (if (and (vlax-write-enabled-p obj) (vlax-property-available-p obj 'linetypescale t))
                        (vla-put-linetypescale obj scl)
                    )
                )
            )
        )
    )
    (vla-regen doc acallviewports)
    (princ)
)

 

 

Is there any way to combine them?

 

Thanks in advance. 

0 Likes
Message 29 of 30

Kent1Cooper
Consultant
Consultant

Try this modification of the one for the Block parts:

 

(defun c:ltschange ( / doc scl )
  (initget 6)
  (if (setq scl (getreal "\nSpecify linetype scale multiplier factor: "))
    (vlax-for blk (vla-get-blocks (setq doc (vla-get-activedocument (vlax-get-acad-object))))
      (if (= :vlax-false (vla-get-isxref blk))
        (vlax-for obj blk
          (if (and (vlax-write-enabled-p obj) (vlax-property-available-p obj 'linetypescale t))
            (vla-put-linetypescale obj (* scl (vla-get-linetypescale obj)))
          )
        )
      )
    )
  )
  (vla-regen doc acallviewports)
  (princ)
)

Kent Cooper, AIA
0 Likes
Message 30 of 30

yiannis242
Explorer
Explorer

Thank you. This is absolut what i need!

0 Likes