|
本帖最后由 LM大亨 于 2013-10-25 10:13 编辑
最近学习Autolisp语言,试画一条线,然后修改这条线的属性,如层、线型及宽度等,用命令 (command "change" en "" "p" "LA" "工艺管线" "" "LT" "continuous" "" "LW" "0.7" ""),可是运行时,只能改图层,后面的属性就出错了,说是“LT”未知命令等。在我看来,是change命令没有执行下去。请教高手,这句有什么错误?该 如何修改呢?
原程序如下:
;;画主工艺管线
(defun mainline()
(setvar "blipmode" 0)
(setvar "cmdecho" 0)
(command "osmode" 15359)
(setq sp (getpoint"\n起始点:"))
(setq x 0)
(while (< x 3)
(setq ep (getpoint sp "\n到点:"))
(if (= ep nil) (setq x 5))
(if (/= ep nil)
(progn
(command "line" sp ep "")
(setq en (entlast))
(setq ed (entget en))
(setq sp (cdr (assoc 10 ed)))
(setq ep (cdr (assoc 11 ed)))
(setq hxd (distance sp ep))
(command "change" en "" "p" "LA" "工艺管线" "" "LT" "continuous" "" "LW" "0.7" "")
(setq sp (list (car ep) (cadr ep)))
) ;;;progn
) ;;;if
) ;;;while
(princ)
)
(defun C:hx_mline () (mainline))
调试已经通过了,错误在(command "change" en "" "p" "LA" "工艺管线" "" "LT" "continuous" "" "LW" 0.7 "" "")这句中多了几个双引号,改成(command "change" en "" "p" "LA" "工艺管线" "LT" "continuous" "LW" 0.7 "")就好了。
但是又有一个新问题来了,这个小程序 只是画了一种线,我想再画另外的线,比如说,仪表信号线,把这个程序复制,修改了定义的命令,里面的参数没动,执行的时候却找不到自定义的命令。这该如何修改?还是分成两个小的LISP程序分别加载?
|
评分
-
查看全部评分
|