mgonzales 发表于 2022-7-6 12:24:00

缩放列表编辑问题

我有一些问题,这个lisp例行有人可以帮我。
出于某种原因,它将删除比例列表,但不会继续并添加列出的比例。
 
下面是例行公事。
(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")
)
 
哦,是的,我也想用这个例程来清理图纸中的regapps。

alanjt 发表于 2022-7-6 12:41:15

你需要用这个“替换你所有的”(英寸)。
“1”=10“将变为“1 \”=10”

bjonz 发表于 2022-7-6 12:57:37

为什么以下操作失败?
(我将其用于包含所有
默认比例,包括1:2)
 
(定义c:sss()
(命令“-scalelistedit”“d”“”“1:2”“”“e”“)
)
 
下面是我运行命令时发生的情况:
 
命令:sss
-scalelistedit输入选项[?/Add/Delete/Reset/Exit]:d输入比例名称
删除:未找到比例。
输入选项[?/添加/删除/重置/退出]:1:2
选项关键字无效。
; 错误:功能已取消
 
顺便说一句,当我运行上面列出的例程时,同样的错误也会发生
根据原始海报。(我删除了他的添加比例部分,因为我没有
需要它;我只想删除除1:1和自定义之外的所有比例。)
 
(使用Acad 2009,SP0)(不太擅长autoLISP!)

alanjt 发表于 2022-7-6 13:02:57

(command "-scalelistedit" "d" "" "1:2" "" "e" "")
您的通话中有一个额外的“”。删除并重试。

bjonz 发表于 2022-7-6 13:17:40

谢谢你的快速帮助!
看起来我吃的太多了“
 
这项工作:
(命令“-scalelistedit”“d”“1:2”“e”)
 
知道多少的秘密是什么
(或何时使用“”)?
 
当我在命令行运行命令时,
每次输入后,我都必须使用enter键,
但AutoLISP并非如此。

alanjt 发表于 2022-7-6 13:24:48

 
在Lisp中,字符串包含其自身的回车等价项。
页: [1]
查看完整版本: 缩放列表编辑问题