AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

The system variable LTSCALE controls the global LineType Scale of all entities within a drawing.
But do you know that you can change the LTSCALE of individual entities?

Manual Method :

Open the Properties dialog.
Select a line.
Change the value of the LineType Scale property.
LTSCALE should change.
If it doesn't, make Rum Cake.....

Automated Method :

;AUTOLISP CODING STARTS HERE

(prompt "\n Type LTCHG to run.....")

(defun c:ltchg ( / ssets acadDocument newsset ctr item newscale)

(setq newscale (getreal "\nEnter New Linetype Scale : "))

;load the visual lisp extensions
(vl-load-com)

;retrieve a reference to the documents object
(setq acadDocument (vla-get-activedocument
(vlax-get-acad-object)))

;retrieve a reference to the selection sets object
(setq ssets (vla-get-selectionsets acadDocument))

;add a new selection set
(setq newsset (vla-add ssets "SS1"))

;select your new selection set objects
(vla-selectOnScreen newsset)

;set the counter to zero
(setq ctr 0)

;count the number of objects and loop
(repeat (vla-get-count newsset)

;retrieve each object
(setq item (vla-item newsset ctr))

;check if the entity has a color property
;and it can be updated
(setq check (vlax-property-available-p item "LinetypeScale" T))

;if it can
(if check

;change it's color
(vlax-put-property item 'LinetypeScale newscale)

);if

;increment the counter
(setq ctr (1+ ctr))

);repeat

;delete the selection set
(vla-delete (vla-item ssets "SS1"))

(princ)

);defun

(princ)

;AUTOLISP CODING ENDS HERE

The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website