TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: SPDCad on March 29, 2007, 04:44:12 PM

Title: Scalelistedit - command
Post by: SPDCad on March 29, 2007, 04:44:12 PM
In what version of AutoCAD did the "scalelistedit" command come into play?
I am writing a lisp for someone and would like to use the command to store/edit scales in my programme.
Also how does autocad keep track of the scales in the list (text file, library, Xdata)?

Any help would be appreciated...
SPD
Title: Re: Scalelistedit - command
Post by: Guest on March 29, 2007, 05:02:11 PM
I believe '07 but am not 100% sure.   We skipped '06 and went from '05 to '07.  I see in your profile info you have 2006.  Does 2006 have it?  I know for a FACT that '05 did NOT have it.
Title: Re: Scalelistedit - command
Post by: T.Willey on March 29, 2007, 05:05:15 PM
Works in '06
Title: Re: Scalelistedit - command
Post by: Guest on March 30, 2007, 08:23:27 AM
Works in '06
Well, there's your answer!
Title: Re: Scalelistedit - command
Post by: Crank on March 30, 2007, 02:19:58 PM
In acad2006/2007 the scale list is stored in the registry. From acad2008 the scale list is part of your drawing.

This is a lisp from the Spago forum by Daniel Altamura:
Code: [Select]
(defun GETSCALELIST (/ MASSOC ScaleList ScaleListDict ScaleListEnts ScaleListNumber ScaleListUnits N DIGIT ACAD-KEY)
(defun MASSOC (KEY ALIST / X NLIST)
(foreach X ALIST
(if (eq KEY (car X))
(setq NLIST (cons (cdr X) NLIST))
)
)
(reverse NLIST)
)

(if (>= (atof (substr (getvar "acadver") 1 4)) 17.1)
(progn ; 2008+
(setq ScaleListDict (dictsearch (namedobjdict) "ACAD_SCALELIST")
ScaleListEnts (MASSOC 350 ScaleListDict)
ScaleList (list "")
            N 0
)
(repeat (length ScaleListEnts)
(setq ScaleList (cons (cdr (assoc 300 (entget (nth N ScaleListEnts)))) ScaleList)
N (1+ N)
)
)
(setq ScaleList (cdr (reverse ScaleList)))
)
(progn ; 2007-
(setq ACAD-KEY (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Scale List"))
(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)))
))
)
)
(if (= (vlax-product-key) "Software\\Autodesk\\AutoCAD\\R17.0\\ACAD-5004:409")
(progn ; ADT 2007 ONLY
(foreach ScaleListUnits (list "Feet" "Inches" "Metric")
(setq ACAD-KEY (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\AEC\\5.0\\AecBase50\\Scales\\" ScaleListUnits))
(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 "0" (itoa N)))
)
(setq ScaleList (cons (vl-registry-read ACAD-KEY (strcat DIGIT ".ScaleName")) ScaleList)
N (1+ N)
)
)
(cond
((= ScaleListUnits "Feet") (setq ScaleListFeet (cdr (reverse ScaleList))))
((= ScaleListUnits "Inches") (setq ScaleListInches (cdr (reverse ScaleList))))
((= ScaleListUnits "Metric") (setq ScaleListMetric (cdr (reverse ScaleList))))
)
))
)
(setq ScaleList (append ScaleListFeet ScaleListInches ScaleListMetric))
)
)
ScaleList
)
Title: Re: Scalelistedit - command
Post by: SPDCad on March 30, 2007, 03:02:11 PM
I see in your profile info you have 2006. I know for a FACT that '05 did NOT have it.

I was wondering if 2005 had the command, oh well i guess i will have to write something similar. My client only has 2005.

I guess I need to update my profile, I am 2008 user and thanks for the tip on 2008 scale edit list Crank!.

To everyone who helped, thanks much appreciated!  :mrgreen: