;; | ---------------------------------------------------------------------------- ;; | MI_GetScaleList ;; | ---------------------------------------------------------------------------- ;; | Function : Returns the list of defined scales in the drawing) ;; | Auguments : 'Str' - Prompt string to display ;; | 'dflt' - Default value to offer ;; | Return : A list in the format of (list DD MM YYYY) ;; | Updated : July 29, 2008 ;; | Comment : In AutoCAD 2008 and later, the scale list is stored in the named ;; | dictionary within the drawing while in older versions, it was ;; | stored in the registry. Both the variants are supported. In ;; | AutoCAD 2008 and later, the flag 290 which indicates if the ;; | scale is referenced or not also is returned. ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun MI_GetScaleList ( / ACAD-KEY ScaleList ScaleListNumber N Digit _ScaleListEntl ename entl SclN flag ) (setq ScaleList '()) (if (< #AcadVer 2008) (progn (setq ACAD-KEY (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\ScaleList")) (if (vl-registry-descendents ACAD-KEY T) (progn (setq ScaleListNumber (/ (vl-list-length (vl-registry-descendents ACAD-KEY T)) 3) ScaleList (list "") N 0 ) (repeat ScaleListNumber (if (>= N 10) (setq Digit (itoa N)) (setq Digit (strcat " " (itoa N))) ) (setq ScaleList (cons (vl-registry-read ACAD-KEY (strcat Digit ".ScaleName")) ScaleList) N (1+ N) ) ) (setq ScaleList (cdr (reverse ScaleList))) )) ) (progn (setq _ScaleListEntl (dictsearch (namedobjdict) "ACAD_SCALELIST")) (if _ScaleListEntl (progn (setq _ScaleListEntl (LI_mitem 350 _ScaleListEntl)) (if _ScaleListEntl (progn (foreach ename _ScaleListEntl (setq entl (entget ename) SclN (LI_item 300 entl) flag (LI_item 290 entl) ScaleList (cons (list SclN flag) ScaleList) ) ) (setq ScaleList (reverse ScaleList)) )) )) )) ScaleList )