visual LISP程序解读
哪位大虾能帮忙解释一下下面这个程序每一步的意思。急急急!!!!(defunc:bs(/scuopp2nn1cnx1y1)(setvar"cmdecho"0)(setvar...
哪位大虾能帮忙解释一下下面这个程序每一步的意思。急急急!!!!
(defun c:bs(/ sc uo p p2 n n1 cn x1 y1)
(setvar "cmdecho" 0)
(setvar "blipmode" 0)
(setq sc (getvar "dimscale"))
(setq uo (getvar "ucsorg"))
(setq p (getpoint "\n Insert point : "))
(setq n (getint "\n Enter n line polygon (the int more than 2):"))
(setq r (getreal "\n Enter the radius out of the polygon:"))
(setq cn 0)
(setq A0 (/ PI n))
(setq A1 (* 2 A0))
(setq A2 (* 1.5 PI))
(setq A3 (+ A2 A0))
(setq A4 (- A3 A1))
(command "ucs" "o" p
"style" "" "" "0" "" "" "" "" "" )
(while (< cn n)
(setq x1 (* r (cos A3)))
(setq y1 (* r (sin A3)))
(setq x2 (* r (cos A4)))
(setq y2 (* r (sin A4)))
(setq pt1 (list x1 y1))
(setq pt2 (list x2 y2))
(command "line" pt1 pt2 "")
(setq cn (+ 1 cn))
(setq A3 A4)
(setq A4 (- A3 A1))
)
(command "ucs" "" "ucs" "o" uo)
(setvar "blipmode" 1)
(setvar "cmdecho" 1)
) 展开
(defun c:bs(/ sc uo p p2 n n1 cn x1 y1)
(setvar "cmdecho" 0)
(setvar "blipmode" 0)
(setq sc (getvar "dimscale"))
(setq uo (getvar "ucsorg"))
(setq p (getpoint "\n Insert point : "))
(setq n (getint "\n Enter n line polygon (the int more than 2):"))
(setq r (getreal "\n Enter the radius out of the polygon:"))
(setq cn 0)
(setq A0 (/ PI n))
(setq A1 (* 2 A0))
(setq A2 (* 1.5 PI))
(setq A3 (+ A2 A0))
(setq A4 (- A3 A1))
(command "ucs" "o" p
"style" "" "" "0" "" "" "" "" "" )
(while (< cn n)
(setq x1 (* r (cos A3)))
(setq y1 (* r (sin A3)))
(setq x2 (* r (cos A4)))
(setq y2 (* r (sin A4)))
(setq pt1 (list x1 y1))
(setq pt2 (list x2 y2))
(command "line" pt1 pt2 "")
(setq cn (+ 1 cn))
(setq A3 A4)
(setq A4 (- A3 A1))
)
(command "ucs" "" "ucs" "o" uo)
(setvar "blipmode" 1)
(setvar "cmdecho" 1)
) 展开
1个回答
展开全部
请参考一下,不明白加Q群再问。
;;程序以园的形式用LINE直线命令绘制指定边数的多边形
(defun c:bs (/ sc uo p p2 n n1 cn x1 y1)
(setvar "cmdecho" 0);;禁止命令行回显
(setvar "blipmode" 0);;关闭控制点标记
;(setq sc (getvar "dimscale"));;获取DIMSCALE系统变量的值,在此段程序中无用
(setq uo (getvar "ucsorg")) ;;获取UCSORG系统变量的值,存储当前空间当前视口的当前坐标系原点。
;(setq p (getpoint "\n Insert point : "))
(setq p (getpoint "\n 输入插入点:"))
;(setq n (getint "\n Enter n line polygon (the int more than 2):"))
(setq n (getint "\n 输入多边形边数 (大于2):"))
;(setq r (getreal "\n Enter the radius out of the polygon:"))
(setq r (getreal "\n 输入多边形半径:"))
(setq cn 0)
(setq A0 (/ PI n))
(setq A1 (* 2 A0))
(setq A2 (* 1.5 PI))
(setq A3 (+ A2 A0))
(setq A4 (- A3 A1))
(command "ucs" "o" p "style" "" "" "0" "" "" "" "" "" );;指定新的坐标新原点
(while (< cn n);;用line命令循环绘制指定多边形
(setq x1 (* r (cos A3)))
(setq y1 (* r (sin A3)))
(setq x2 (* r (cos A4)))
(setq y2 (* r (sin A4)))
(setq pt1 (list x1 y1))
(setq pt2 (list x2 y2))
(command "line" pt1 pt2 "")
(setq cn (+ 1 cn))
(setq A3 A4)
(setq A4 (- A3 A1))
);end while
(command "ucs" "" "ucs" "o" uo);;恢复原坐标新原点
(setvar "blipmode" 1);;打开控制点标记
(setvar "cmdecho" 1);;恢复命令行回显
(princ);;静默退出
);end defun
;;程序以园的形式用LINE直线命令绘制指定边数的多边形
(defun c:bs (/ sc uo p p2 n n1 cn x1 y1)
(setvar "cmdecho" 0);;禁止命令行回显
(setvar "blipmode" 0);;关闭控制点标记
;(setq sc (getvar "dimscale"));;获取DIMSCALE系统变量的值,在此段程序中无用
(setq uo (getvar "ucsorg")) ;;获取UCSORG系统变量的值,存储当前空间当前视口的当前坐标系原点。
;(setq p (getpoint "\n Insert point : "))
(setq p (getpoint "\n 输入插入点:"))
;(setq n (getint "\n Enter n line polygon (the int more than 2):"))
(setq n (getint "\n 输入多边形边数 (大于2):"))
;(setq r (getreal "\n Enter the radius out of the polygon:"))
(setq r (getreal "\n 输入多边形半径:"))
(setq cn 0)
(setq A0 (/ PI n))
(setq A1 (* 2 A0))
(setq A2 (* 1.5 PI))
(setq A3 (+ A2 A0))
(setq A4 (- A3 A1))
(command "ucs" "o" p "style" "" "" "0" "" "" "" "" "" );;指定新的坐标新原点
(while (< cn n);;用line命令循环绘制指定多边形
(setq x1 (* r (cos A3)))
(setq y1 (* r (sin A3)))
(setq x2 (* r (cos A4)))
(setq y2 (* r (sin A4)))
(setq pt1 (list x1 y1))
(setq pt2 (list x2 y2))
(command "line" pt1 pt2 "")
(setq cn (+ 1 cn))
(setq A3 A4)
(setq A4 (- A3 A1))
);end while
(command "ucs" "" "ucs" "o" uo);;恢复原坐标新原点
(setvar "blipmode" 1);;打开控制点标记
(setvar "cmdecho" 1);;恢复命令行回显
(princ);;静默退出
);end defun
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询