Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
can someone help me with this error
...; error: bad argument type: numberp: "1:60"
;; Utilities to clean-up scale lists ;; Command to remove all XREF scale lists (defun c:ScaleListRemXRef (/) (princ (strcat "\n" (itoa (DelScaleListMatch "*XREF*" (GetScaleListEntities))) " XREF scales deleted." ) ;_ end of strcat ) ;_ end of princ (princ) ) ;_ end of defun ;; Command to remove all Imperial scales (defun c:ScaleListRemImperial (/) (princ (strcat "\n" (itoa (DelScaleListMatch "*=*" (GetScaleListEntities))) " Imperial scales deleted." ) ;_ end of strcat ) ;_ end of princ (princ) ) ;_ end of defun ;; Command to remove all Metric Scales (defun c:ScaleListRemMetric (/) (princ (strcat "\n" (itoa (DelScaleListMatch "*:*" (GetScaleListEntities))) " Metric scales deleted." ) ;_ end of strcat ) ;_ end of princ (princ) ) ;_ end of defun ;; Command to ensure Imperial scales are present (defun c:ScaleListImperial (/) (princ (strcat "\n" (itoa (InstallScaleList StdImplScaleList)) " scales added")) (princ) ) ;_ end of defun ;; Command to ensure ISO scales are present (defun c:ScaleListMetric (/) (princ (strcat "\n" (itoa (InstallScaleList StdISOScaleList)) " scales added")) (princ) ) ;_ end of defun ;; Command to remove incorrect scales & ensure standard scales ;; in relation to the MEASUREMENT sysvar (defun c:ScaleListStandard (/) (princ "\nRemoving XREF scales ...") (c:ScaleListRemXRef);Remove XREF scales (if (= 0 (getvar "MEASUREMENT")) (progn (prompt "\nRemoving Metric scales ...") (c:ScaleListRemMetric) (prompt "\nInstalling Standard Imperial scales ...") (c:ScaleListImperial) ) (progn (prompt "\nRemoving Imperial scales ...") (c:ScaleListRemImperial) (prompt "\nInstalling Standard Metric scales ...") (c:ScaleListMetric) ) ) (princ) ) ;; ---------------------------------- ;; Utility functions ;; ---------------------------------- ;; List of standard Imperial scales as per AutoCAD (setq StdImplScaleList '(("1:1" 1.0 . 1.0) ;Scale type A ("1\" = 5'\"" "1:60") ;Scale type B ("1\" = 10'\"" "1:120") ;Scale type C ("1\" = 20'\"" "1:240") ;Scale type D ("1\" = 30'\"" "1:360") ;Scale type E ("1\" = 40'\"" "1:480") ;Scale type F ("1\" = 50'\"" "1:600") ;Scale type G ("1\" = 60'\"" "1:720") ;Scale type H ("1\" = 80'\"" "1:960") ;Scale type I ("1\" = 100'\"" "1:1200") ;Scale type J ("1\" = 200'\"" "1:2400") ;Scale type K ("1\" = 300'\"" "1:3600") ;Scale type L ("1\" = 400'\"" "1:4800") ;Scale type M ("1\" = 500'\"" "1:6000") ;Scale type N ("1\" = 600'\"" "1:7200") ;Scale type O ("1\" = 1000'\"" "1:12000") ;Scale type P ("1\" = 2000'\"" "1:24000") ;Scale type Q ("1\" = 3000'\"" "1:36000") ;Scale type R ("1\" = 4000'\"" "1:48000") ;Scale type S ("1\" = 5000'\"" "1:60000") ;Scale type T ("1\" = 6000'\"" "1:72000") ;Scale type U ) ) ;_ end of setq ;; List of standard ISO scales (from ISO 13567) (setq StdISOScaleList '(("1:1" 1.0 . 1.0) ;Scale type A ("1:10" 1.0 . 10.0) ;Scale type B ("1:20" 1.0 . 20.0) ;Scale type C ("1:30" 1.0 . 30.0) ;Scale type D ("1:40" 1.0 . 40.0) ;Scale type E ("1:50" 1.0 . 50.0) ;Scale type F ("1:60" 1.0 . 60.0) ;Scale type G ("1:80" 1.0 . 80.0) ;Scale type H ("1:100" 1.0 . 100.0) ;Scale type I ("1:200" 1.0 . 200.0) ;Scale type J ("1:300" 1.0 . 300.0) ;Scale type K ("1:400" 1.0 . 400.0) ;Scale type L ("1:500" 1.0 . 500.0) ;Scale type M ("1:600" 1.0 . 600.0) ;Scale type N ("1:1000" 1.0 . 1000.0) ;Scale type O ("1:2000" 1.0 . 2000.0) ;Scale type P ("1:3000" 1.0 . 3000.0) ;Scale type Q ("1:4000" 1.0 . 4000.0) ;Scale type R ("1:5000" 1.0 . 5000.0) ;Scale type S ("1:6000" 1.0 . 6000.0) ;Scale type T ) ) ;_ end of setq ;; Function to obtain list of scale entity names (defun GetScaleListEntities (/ lst item) (setq lst nil) (foreach item (dictsearch (namedobjdict) "ACAD_SCALELIST") (if (= 350 (car item)) (setq lst (cons (cdr item) lst)) ) ;_ end of if ) ;_ end of foreach lst ) ;_ end of defun ;; Function to obtain list of scale types in current drawing (defun GetScaleList (/ lst lst1 item data) (setq lst (GetScaleListEntities) lst1 nil ) ;_ end of setq (foreach item lst (setq data (entget item)) (setq lst1 (cons (vl-list* (cdr (assoc 300 data)) (cdr (assoc 140 data)) (cdr (assoc 141 data)) ) ;_ end of vl-list* lst1 ) ;_ end of cons ) ;_ end of setq ) ;_ end of foreach ;; Sort the list - most detailed to least (setq lst (vl-sort lst1 '(lambda (s1 s2) (> (/ (cadr s1) (cddr s1)) (/ (cadr s2) (cddr s2))) ) ;_ end of lambda ) ;_ end of vl-sort ) ;_ end of setq ) ;_ end of defun ;; Function to delete scale matching a wildcard name (defun DelScaleListMatch (pattern lst / item data count) (setq count 0) (foreach item lst (setq data (entget item)) (if (wcmatch (cdr (assoc 300 data)) pattern) (progn (entdel item) (setq count (1+ count)) ) ;_ end of progn ) ;_ end of if ) ;_ end of foreach count ) ;_ end of defun ;; Function to ensure list of scale are installed (defun InstallScaleList (stdlst / lst item cmd) (setq lst (GetScaleList)) ;Get list of scale entity names ;; Remove items from stdlst which is already in the drawing (setq stdlst (vl-remove-if '(lambda (e) (/= nil (assoc (car e) lst))) stdlst ) ;_ end of vl-remove-if ) ;_ end of setq (setq cmd (getvar "CMDECHO")) (setvar "CMDECHO" 0) (command "._undo" "_Begin") ;; Start scalelist edit if needed (if (> (length stdlst) 0) (command ".-scalelistedit") ) ;; Step through remainder of stdlst (foreach item stdlst (command "_Add" (car item) (strcat (rtos (cadr item)) ":" (rtos (cddr item)))) ) ;_ end of foreach ;; End scalelist edit if needed (if (> (length stdlst) 0) (command "_Exit") ) (command "._undo" "_End") (setvar "CMDECHO" cmd) (length stdlst) ) (princ) ;|«Visual LISP© Format Options» (72 2 40 2 T "end of " 60 9 0 0 0 T T nil T) ;*** DO NOT add text below the comment! ***|;
Allen Robberson
Credit where credit is due! Give kudos or accept as solution whenever you can.
Credit where credit is due! Give kudos or accept as solution whenever you can.
Solved! Go to Solution.