一个lisp程序,请求高手帮我修改下
(defunc:test(/dsne)(if(setqd(ssadd)s(ssget"_:S"'((0."*LINE,ARC"))))(repeat(setqn(ssle...
(defun c:test (/ d s n e )
(if (setq d (ssadd) s (ssget "_:S" '((0 . "*LINE,ARC"))))
(repeat (setq n (sslength s))
(setq e (ssname s (setq n (1- n))))
(foreach p (list (vlax-curve-getStartPoint e) (vlax-curve-getEndPoint e))
(setq d (ssadd (entmakex (list '(0 . "CIRCLE") (cons 10 p) (cons 40 1.) '(62 . 1))) d))
))
)
(sssetfirst nil d)
(princ)
)
上面这段代码,有画红色圆并亮显的功能,我想将下面这段代码的画圆也变成上面这种,画红色圆并亮显
(defun C:w1 (/ E LST LST1 N PTS SS X)
(cond
((setq ss (ssget ":S" '((0 . "*LINE,ARC"))))
(repeat (setq n (sslength ss))
(setq e (ssname ss (setq n (1- n))))
(setq pts (cons (vlax-curve-getStartPoint e) pts))
(setq pts (cons (vlax-curve-getEndPoint e) pts))
)
(while (setq x (car pts))
(setq pts (cdr pts))
(setq lst1 nil
lst nil
)
(foreach Y pts
(cond ((equal x Y 0.1) (setq lst (cons Y lst)))
(T (setq lst1 (cons Y lst1)))
)
)
(cond ((not lst) (command "_.circle" x 5)))
(setq pts lst1)
)
)
)
) 展开
(if (setq d (ssadd) s (ssget "_:S" '((0 . "*LINE,ARC"))))
(repeat (setq n (sslength s))
(setq e (ssname s (setq n (1- n))))
(foreach p (list (vlax-curve-getStartPoint e) (vlax-curve-getEndPoint e))
(setq d (ssadd (entmakex (list '(0 . "CIRCLE") (cons 10 p) (cons 40 1.) '(62 . 1))) d))
))
)
(sssetfirst nil d)
(princ)
)
上面这段代码,有画红色圆并亮显的功能,我想将下面这段代码的画圆也变成上面这种,画红色圆并亮显
(defun C:w1 (/ E LST LST1 N PTS SS X)
(cond
((setq ss (ssget ":S" '((0 . "*LINE,ARC"))))
(repeat (setq n (sslength ss))
(setq e (ssname ss (setq n (1- n))))
(setq pts (cons (vlax-curve-getStartPoint e) pts))
(setq pts (cons (vlax-curve-getEndPoint e) pts))
)
(while (setq x (car pts))
(setq pts (cdr pts))
(setq lst1 nil
lst nil
)
(foreach Y pts
(cond ((equal x Y 0.1) (setq lst (cons Y lst)))
(T (setq lst1 (cons Y lst1)))
)
)
(cond ((not lst) (command "_.circle" x 5)))
(setq pts lst1)
)
)
)
) 展开
展开全部
你的第一个程序是缺少东西的,应该添加 (vl-load-com)。
W1程序需要建立选择集,然后利用程序修改颜色
W1程序需要建立选择集,然后利用程序修改颜色
更多追问追答
追问
第一个程序画圆和亮显的代码好像是
(setq d (ssadd (entmakex (list '(0 . "CIRCLE") (cons 10 p) (cons 40 1.) '(62 . 1))) d)))))
(sssetfirst nil d)
第二个画圆的代码是:(command "_.circle" x 5)))
我想要第二个画圆的跟第一个一样,画圆并亮显,能帮我修改一下吗?
追答
你的第一个程序是缺少东西的,应该添加 (vl-load-com)。
W1程序需要建立选择集,然后利用程序修改颜色
(defun C:w1 (/ E LST LST1 N PTS SS X)
(cond
((setq ss (ssget ":S" '((0 . "*LINE,ARC"))))
(repeat (setq n (sslength ss))
(setq e (ssname ss (setq n (1- n))))
(setq pts (cons (vlax-curve-getStartPoint e) pts))
(setq pts (cons (vlax-curve-getEndPoint e) pts))
)
(while (setq x (car pts))
(setq pts (cdr pts))
(setq lst1 nil
lst nil
)
(foreach Y pts
(cond ((equal x Y 0.1) (setq lst (cons Y lst)))
(T (setq lst1 (cons Y lst1)))
)
)
(command "color" "10" );设置当前绘制对象颜色
(cond ((not lst) (command "_.circle" x 5)))
(setq pts lst1)
(command "color" "bylayer" );恢复随层颜色
)
)
)
)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询