修改一个autolisp 程序

2025-01-04 09:58:56
推荐回答(2个)
回答1:

你是要把中心线图层设置改为蓝色,0.7毫米厚还是把这个命令画出的线改为蓝色0.7毫米厚?

回答2:

;;;================================================================================================
;;;对所选择的对象进行1/2偏移,生成为中心线
(DEFUN c:offset_half (/ ent1 point1 point2)
(IF (TBLSEARCH "layer" "中心线")
(COMMAND "layer" "t" "中心线" "m" "error" "")
(COMMAND "layer" "m" "中心线" "m" "c" 5 "")
)
(setvar "clayer" "0")
(WHILE (PROGN
(SETVAR "OSMODE" 512)
(IF (SETQ point1 (GETPOINT "\n\t选择要偏移的对象或 <退出>:"))
(IF (SETQ ent1 (SSGET point1))
(IF (WCMATCH (CDR (ASSOC '0 (ENTGET (SSNAME ent1 0)))) "*LINE")
(SETQ ent1 (SSNAME ent1 0))
)
)
)
)
(REDRAW ent1 3)
(IF (SETQ point2 (GETPOINT "\n\t选择另一边的对象或 <退出>:"))
(PROGN (SETVAR "OSMODE" 0)
(COMMAND "offset" "t" ent1 (MAPCAR '* '(0.5 0.5) (MAPCAR '+ point1 point2)) "")
;(COMMAND "CHANGE" (ENTLAST) "" "P" "la" "中心线" "C" "3" "")
;p(COMMAND "pedit" (ENTLAST) "w" "0.5" "")
(COMMAND "CHANGE" (ENTLAST) "" "P" "la" "中心线" "C" "3" "lw" 0.7 "")
)
)
(REDRAW ent1 4)
)
(SETVAR "OSMODE" 0)
(PRINC)
)
;;;================================================================================================