Changing linetype scales

Changing linetype scales

Anonymous
Not applicable
7,108 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,109 Views
29 Replies
Replies (29)
Message 2 of 30

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> 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?

No, not without development.

 

But when you want to have your whole drawing to scale ALL linetypes then simply change the sysvar LTSCALE ... that changes the scaling of all displayed objects.

 

- alfred -

 

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 30

pendean
Community Legend
Community Legend
Not with any built in tool like PROPERTIES etc.

Try asking in the LISP forum for a customized solution https://forums.autodesk.com/t5/autocad-customization/ct-p/AutoCADTopic1
0 Likes
Message 4 of 30

Anonymous
Not applicable

Hi Alfred,

 

I'm currently creating a lisp to change the ltscale of the drawing but have all of the lines retain their appearance. So unfortunately I can't just change the ltscale as I'm already doing that. Iv'e been playing around with celtscale and msltscale and can't seem to get those to work either, any ideas?

0 Likes
Message 5 of 30

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> I'm currently creating a lisp to change the ltscale

>> any ideas?

Show your code.

 

>> Iv'e been playing around with celtscale and msltscale and can't

>> seem to get those to work either

Before you write an application or a tool, you need to understand the variables and get them working in manual way, by entering the command and test it with a few entities.

As long as you don't know what you really want to change you can't write a tool for that.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 6 of 30

Anonymous
Not applicable

(defun c:ltchange (/ )

(setq SC (getreal "\nNew LTSCALE : "))
(setq SC1 (/ 1 SC))
(setq ss (ssget "_X" '((0 . "arc,circle,ellipse,line,*polyline")(48 . 16)))
id 0)

(repeat
(sslength ss)
(command "_.Chprop" ss "" "ltScale" (/ 16 SC) "")
(setq id (1+ id))
)
(princ)
(setvar "ltscale" SC)
(command "regen")
)

 

Here is what I am working with right now, my only problem is getting both of the 16s to represent all numbers instead of just 16. The program changes all lines to a scale of the new linetype and then changes the linetype to the new one. Right now the program only works for 16 as I do not know how to create a list for all numbers (decimal too) between 1 and 100.

0 Likes
Message 7 of 30

Anonymous
Not applicable

Very new with autolisp so it may be sloppy and some of the variables might not be necessary. A lot of the code is something someone helped me with too, I'm just trying to get it fully operational but can't seem to find the right thread online to help.

0 Likes
Message 8 of 30

Kent1Cooper
Consultant
Consultant
Accepted solution

Try this:

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

 

It seemed easier to word the prompt generically in terms of multiplying rather than dividing.  If you want to divide all linetype scales by, for example, 3, you can be more precise than, say, 0.33333 by doing it fractionally, answering 1/3 to the prompt for a multiplier.  Or, if you're always  going smaller, you could change the prompt wording [and the 'mult' variable name], and change the  *  function to  / .  [But if you want them all 2/3 of their current ltScale, and you ask for a divisor, it would need to be 3/2, and it might be hard to word the prompt in a way to get that answer.]

 

EDIT:  If you're dealing with things in multiple spaces, that won't work -- ordinary editing commands like CHPROP can't find things that aren't in the current space.  But it could be done with (vla-put) or (subst)/(entmod) methods even on things in other spaces -- would you need that?

Also, I left your command name, but I'd suggest changing it to something like LTSchange, since it's not changing the linetypes  of objects.

Kent Cooper, AIA
Message 9 of 30

Anonymous
Not applicable

No that is perfect, I'm only dealing with one block. And I'll change the command name, that is a good suggestion. Thank you very much!

0 Likes
Message 10 of 30

ps-trigenex
Participant
Participant

This lisp is for multiplying existing "Linetype Scale".

In my drawing, there is many differents "Linetype Scale"… If I want to set all "Linetype Scale" at 0.5 for all lines or plines, or whatever… how can I do it??

0 Likes
Message 11 of 30

dlanorh
Advisor
Advisor

Try this. No local error or undo marks. Will change all line entities (polylines, lines, mlines, xlines, splines, rays arcs circles and ellipses). Will not work on lines within blocks, will fail if any entities are on locked layers

 

;set linetypescale of all line entities in drawing to entered scale
(vl-load-com)

(defun c:lts (/ lts ss cnt obj)
  (initget 7)
  (setq lts (getreal "\nEnter Line Type Scale : ")
        ss (ssget "_X" '((0 . "ARC,CIRCLE,ELLIPSE,*LINE,RAY")))
  );end_setq
  (cond (ss
          (repeat (setq cnt (sslength ss))
            (setq obj (vlax-ename->vla-object (ssname ss (setq cnt (1- cnt)))))
            (vlax-put-property obj 'linetypescale lts)
          );end_repeat
        )
  );end_cond
  (princ)
);end_defun

 

I am not one of the robots you're looking for

Message 12 of 30

ps-trigenex
Participant
Participant

I found it from Lee Mac and it worked perfectly!! https://www.cadtutor.net

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

Thank a lot!!

0 Likes
Message 13 of 30

yiannis242
Explorer
Explorer

Is it possible to change linetype scale in the blocks?

0 Likes
Message 14 of 30

Kent1Cooper
Consultant
Consultant

@ps-trigenex wrote:

This lisp is for multiplying existing "Linetype Scale".

In my drawing, there is many differents "Linetype Scale"… If I want to set all "Linetype Scale" at 0.5 for all lines or plines, or whatever… how can I do it??


The simplest way:  QSELECT to get the entity type(s) you want, and change them collectively in the Properties palette.

Kent Cooper, AIA
0 Likes
Message 15 of 30

Kent1Cooper
Consultant
Consultant

@yiannis242 wrote:

Is it possible to change linetype scale in the blocks?


It's possible, but questions arise.

 

In all Blocks, or in only selected ones?

 

Are you talking about the same linetype scale for the same parts in all insertions of any Block definition that you change it in?  That's a simple edit of the Block definition to assign that scale to the parts.

 

Or, edit the Block definitions and assign ByBlock as the linetype scale of any pieces having non-continuous linetype(s).  Then you can have different linetype scales of the same pieces in different insertions of the same Block.

Kent Cooper, AIA
0 Likes
Message 16 of 30

yiannis242
Explorer
Explorer

I'm asking about changing the scale of all

linetypes in all blocks. I'm not referring to the same scale but the same scale factor.

 

thanks in advance 

0 Likes
Message 17 of 30

Kent1Cooper
Consultant
Consultant

@yiannis242 wrote:

I'm asking about changing the scale of all linetypes in all blocks. ....


Would changing the LTSCALE System Variable setting [and related ones] in the drawing as a whole do it for you?

Kent Cooper, AIA
0 Likes
Message 18 of 30

yiannis242
Explorer
Explorer

Actually no as i want to merge 2 drawings in one and i want to scale objects of the one drawing before to paste them to new drawing.

0 Likes
Message 19 of 30

pendean
Community Legend
Community Legend

@yiannis242 You cannot have 2-separate LTSCALE settings in one DWG file in AutoCAD.

 

You could change the imported objects' linetype scale after the fact like this as a workaround if all the LISP above in this same thread are not what you seek

pendean_0-1686160636388.png

 

Test and explore.

0 Likes
Message 20 of 30

yiannis242
Explorer
Explorer

I know that it's not possible to have 2-separate LTSCALE settings in one DWG file in AutoCAD, that's why i want to change linetype scale before merge them.

0 Likes