mgonzales Posted September 25, 2009 Posted September 25, 2009 i have some problems with this lisp routine can someone help me. for some reason it will delete the scale list but it will not continue and add the scales listed. here is the routine. (defun dwgcln (/) ;; reset all scales (command "_.-scalelistedit" "_r" "_y" "_e") ;; set current annoscale (setvar "cannoscale" "1:1") ;; issue scalelistedit command (command "_.-scalelistedit") ;; process list of scales to delete (foreach x '("1:4" "1:5" "1:8" "1:10" "1:16" "1:20" "1:30" "1:40" "1:50" "1:100" "2:1" "4:1" "8:1" "10:1" "100:1") (command "_d" x) ) ;; process list of scales to add (foreach x '((cons "1"=10'" "1:120") (cons "1"=20'" "1:240") (cons "1"=30'" "1:360") (cons "1"=40'" "1:480") (cons "1"=50'" "1:600") (cons "1"=60'" "1:720") (cons "1"=70'" "1:840") (cons "1"=80'" "1:960") (cons "1"=90'" "1:1080") (cons "1"=100'" "1:1200") (cons "1:2" "1:2") (cons "1:5" "1:5") (cons "1:10" "1:10") (cons "1:20" "1:20") (cons "1:30" "1:30") (cons "1:40" "1:40") (cons "1:50" "1:50") (cons "1:60" "1:60") (cons "1:100" "1:100") (cons "1:200" "1:200") (cons "1:300" "1:300") (cons "1:400" "1:400") (cons "1:500" "1:500") (cons "1:600" "1:600") (cons "1:1000" "1:1000") (cons "1:2000" "1:2000")) (command "_A" (car x) ("cdr x")) ) ;; exit scalelistedit (command "_e") ;; purge regapps (command "_.-purge" "_regapps" "*" "_n") ) oh yeah i had also wanted this routine to clean up the regapps in the drawing. Quote
alanjt Posted September 25, 2009 Posted September 25, 2009 You need to replace all your " (inches) with this \". "1"=10'" would become "1\"=10'" Quote
bjonz Posted October 19, 2009 Posted October 19, 2009 Why does the following fail? (I am using it for a drawing which contains all of the default scales, including 1:2) (defun c:sss () (command "-scalelistedit" "d" "" "1:2" "" "e" "") ) Here is what happens when I run the command: Command: sss -scalelistedit Enter option [?/Add/Delete/Reset/Exit] : d Enter scale name to delete: Scale not found. Enter option [?/Add/Delete/Reset/Exit] : 1:2 Invalid option keyword. ; error: Function cancelled By the way, the same error occurs when I run the routine listed above by the original poster. (I deleted his add-scales part because I do not need that; all I want to do is delete all scales but 1:1 & custom.) (Using Acad 2009, SP0)(not very good at autoLISP!) Quote
alanjt Posted October 19, 2009 Posted October 19, 2009 (command "-scalelistedit" "d" [color=Red]""[/color] "1:2" "" "e" "") You have an extra "" in your call. Remove and try again. Quote
bjonz Posted October 19, 2009 Posted October 19, 2009 Thanks for the quick help! Looks like I had 3 too many "" This works: (command "-scalelistedit" "d" "1:2" "e") What is the secret to knowing how many "" (or when to use "")? When I run the command at the command line, I have to use the enter key after each entry, but this is not the case with AutoLISP. Quote
alanjt Posted October 19, 2009 Posted October 19, 2009 Thanks for the quick help!Looks like I had 3 too many "" This works: (command "-scalelistedit" "d" "1:2" "e") What is the secret to knowing how many "" (or when to use "")? When I run the command at the command line, I have to use the enter key after each entry, but this is not the case with AutoLISP. In Lisp, the string includes it's own carriage return equivalent. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.