auto lisp 中求一段多段线的坐标保存在一个表中,然后在每个点上画圆。求改函数
每次运行提示错误:函数错误:<图元名:-279f28>,cons函数真心不会用,在线等,太急了(defunc:pwline(/)(setqpline_name(car(e...
每次运行提示错误: 函数错误: <图元名: -279f28>,cons函数真心不会用,在线等,太急了
(defun c:pwline( / )
(setq pline_name (car(entsel"请选择需要标注的多段线:")))
(setq pline_content (entget(pline_name)))
(setq l (length pline_content))
(setq n 0)
(setq zb (list '(a b)))
(while (< n l)
(setq el (nth n pline_content))
(setq ele (car el))
(if (equal ele 10)
(setq zb (cons '(cdr el) 'zb))
)
(setq n (1+ n))
)
;;;;;;;;;;;;;
(setq l(length zb))
(setq m 0)
(while(< m l)
(setq p (nth m zb))
(command "circle" p 10)
)
;;;;;;;;;;;;;;
) 展开
(defun c:pwline( / )
(setq pline_name (car(entsel"请选择需要标注的多段线:")))
(setq pline_content (entget(pline_name)))
(setq l (length pline_content))
(setq n 0)
(setq zb (list '(a b)))
(while (< n l)
(setq el (nth n pline_content))
(setq ele (car el))
(if (equal ele 10)
(setq zb (cons '(cdr el) 'zb))
)
(setq n (1+ n))
)
;;;;;;;;;;;;;
(setq l(length zb))
(setq m 0)
(while(< m l)
(setq p (nth m zb))
(command "circle" p 10)
)
;;;;;;;;;;;;;;
) 展开
展开全部
你的程序第三行中(entget(pline_name))是错误的,pline_name不应该有括号。
程序编写过于复杂,简化程序如下:
(defun c:pwline (/ pline_name pline_content c)
(setq pline_name (car (entsel "请选择需要标注的多段线:"))
pline_content (entget pline_name)
c (assoc 10 pline_content)
)
(while c
(command "circle" (cdr c) 10)
(setq pline_content (cdr (member c pline_content))
c (assoc 10 pline_content)
)))
程序编写过于复杂,简化程序如下:
(defun c:pwline (/ pline_name pline_content c)
(setq pline_name (car (entsel "请选择需要标注的多段线:"))
pline_content (entget pline_name)
c (assoc 10 pline_content)
)
(while c
(command "circle" (cdr c) 10)
(setq pline_content (cdr (member c pline_content))
c (assoc 10 pline_content)
)))
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询