CAD中插件代码问题 50
1.我用给下面的代码的命令的时候,对象捕捉为什么全部被清空了,就是变成都没勾选了?2.还有一个问题是,这个两点间阵列的插件,可是比输入阵列数少一个,比如输入5,只阵列了4...
1.我用给下面的代码的命令的时候,对象捕捉为什么全部被清空了,就是变成都没勾选了?
2.还有一个问题是,这个两点间阵列的插件,可是比输入阵列数少一个,比如输入5,只阵列了4个出来。
有没有高手知道为什么,帮忙改下代码?
==================================
(defun c:ay (/ os ss p1 p2 d y y1 a)
(setvar "cmdecho" 0)
(setq os (getvar "osmode")
oer *error*
*error* clmerr
)
(command "osnap" "cen")
(setq ss (ssget))
(setq p1 (getpoint "\nFirst point:"))
(setq p2 (getpoint p1 "\nSecond point:"))
(setvar "osmode" 0)
(setq d (distance p1 p2))
(setq y (getint "\nTotal number:"))
(if (<= y 2)
(exit)
)
(setq y1 (- y 1))
(setq a (/ d y1))
(command "ucs" "z" p1 p2)
(command "array" ss "" "r" "" y1 a)
(command "ucs" "")
(setvar "osmode" os)
(princ)
) 展开
2.还有一个问题是,这个两点间阵列的插件,可是比输入阵列数少一个,比如输入5,只阵列了4个出来。
有没有高手知道为什么,帮忙改下代码?
==================================
(defun c:ay (/ os ss p1 p2 d y y1 a)
(setvar "cmdecho" 0)
(setq os (getvar "osmode")
oer *error*
*error* clmerr
)
(command "osnap" "cen")
(setq ss (ssget))
(setq p1 (getpoint "\nFirst point:"))
(setq p2 (getpoint p1 "\nSecond point:"))
(setvar "osmode" 0)
(setq d (distance p1 p2))
(setq y (getint "\nTotal number:"))
(if (<= y 2)
(exit)
)
(setq y1 (- y 1))
(setq a (/ d y1))
(command "ucs" "z" p1 p2)
(command "array" ss "" "r" "" y1 a)
(command "ucs" "")
(setvar "osmode" os)
(princ)
) 展开
1个回答
展开全部
以下为修改后的代码。
==================================
(defun c:ay (/ os ss p1 p2 d y y1 a)
(setvar "cmdecho" 0)
(setq os (getvar "osmode")
oer *error*
*error* clmerr
)
(setq ss (ssget))
(setq p1 (getpoint "\nFirst point:"))
(setq p2 (getpoint "\nSecond point:"))
(setvar "osmode" 0)
(setq d (distance p1 p2))
(setq y (getint "\nTotal number:"))
(if (<= y 0)
(exit)
)
(setq y1 (+ y 1))
(setq a (/ d y1))
(command "ucs" "z" p1 p2)
(command "array" ss "" "r" "" y1 a)
(command "ucs" "")
(setvar "osmode" os)
(princ)
)
==================================
(defun c:ay (/ os ss p1 p2 d y y1 a)
(setvar "cmdecho" 0)
(setq os (getvar "osmode")
oer *error*
*error* clmerr
)
(setq ss (ssget))
(setq p1 (getpoint "\nFirst point:"))
(setq p2 (getpoint "\nSecond point:"))
(setvar "osmode" 0)
(setq d (distance p1 p2))
(setq y (getint "\nTotal number:"))
(if (<= y 0)
(exit)
)
(setq y1 (+ y 1))
(setq a (/ d y1))
(command "ucs" "z" p1 p2)
(command "array" ss "" "r" "" y1 a)
(command "ucs" "")
(setvar "osmode" os)
(princ)
)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询