- 积分
- 55905
- 明经币
- 个
- 注册时间
- 2005-5-26
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2012-4-21 13:16:27
|
显示全部楼层
- ;* UANGLE User interface angle function
- ;* BIT (1 for no null, 0 for none) and KWD key word ("" for none) are same as
- ;* for INITGET. MSG is the prompt string, to which a default real in rads is
- ;* added as <DEF> (nil for none), and a : is added. BPT is base point (nil for none).
- ;*
- (defun uangle (bit kwd msg def bpt / inp)
- (if def
- (setq msg (strcat "\n >> " msg " < " (angtos def) " >: ")
- bit (* 2 (fix (/ bit 2)))
- )
- (if (= " " (substr msg (strlen msg) 1)) ;no def, if last char is space
- (setq msg (strcat "\n >> " (substr msg 1 (1- (strlen msg))) " : ")) ;then strip space
- (setq msg (strcat "\n >> " msg " : ")) ;else msg OK
- ) );if,if
- (initget bit kwd)
- (setq inp
- (if bpt
- (getangle msg bpt)
- (getangle msg)
- ) )
- (if inp inp def)
- );defun
- ;* UINT User interface integer function
- ;* BIT (0 for none) and KWD key word ("" for none) are same as for INITGET.
- ;* MSG is the prompt string, to which a default integer is added as <DEF> (nil
- ;* for none), and a : is added.
- ;*
- (defun uint (bit kwd msg def / inp)
- (if def ;test for a default
- (setq msg (strcat "\n >> " msg " < " (itoa def) " >: ") ;string'em with default
- bit (* 2 (fix (/ bit 2))) ;a default and no null bit code conflict so
- ) ;this reduces bit by 1 if odd, to allow null
- (if (= " " (substr msg (strlen msg) 1)) ;no def, if last char is space
- (setq msg (strcat "\n >> " (substr msg 1 (1- (strlen msg))) " : ")) ;then strip space
- (setq msg (strcat "\n >> " msg " : ")) ;else msg OK
- ) );if,if
- (initget bit kwd)
- (setq inp (getint msg)) ;use the GETINT function
- (if inp inp def) ;compare the results, return appropriate value
- );defun
- ;* UDIST User interface distance function
- ;* BIT (0 for none) and KWD key word ("" for none) are same as for INITGET.
- ;* MSG is the prompt string, to which a default real is added as <DEF> (nil
- ;* for none), and a : is added. BPT is base point (nil for none).
- ;*
- (defun udist (bit kwd msg def bpt / inp)
- (if def ;test for a default
- (setq msg (strcat "\n >> " msg " < " (rtos def) " >: ") ;string'em with default
- bit (* 2 (fix (/ bit 2))) ;a default and no null bit code conflict so
- );setq ;this reduces bit by 1 if odd, to allow null
- (if (= " " (substr msg (strlen msg) 1)) ;no def, if last char is space
- (setq msg (strcat "\n >> " (substr msg 1 (1- (strlen msg))) " : ")) ;then strip space
- (setq msg (strcat "\n >> " msg " : ")) ;else msg OK
- ) );if,if
- (initget bit kwd)
- (setq inp
- (if bpt ;check for a base point
- (getdist msg bpt) ;and use it in the GET vl-cmdfs
- (getdist msg)
- ) );setq&if
- (if inp inp def) ;compare the results, return appropriate value
- );defun
- (defun C:AAR (/ ss ang bp cnt dist d)
- (PRINC "\n 角度阵列 ")
- (cond
- ((setq ss (ssget))
- (initget 1)
- (setq bp (getpoint "\n基点: ")
- ang (uangle 1 "" "阵列方向" *Ang* bp)
- dist (udist 7 "" "对像间距" *Dist* bp)
- cnt (uint 7 "" "对像个数" *Cnt*)
- *Ang* ang
- *Dist* dist
- *Cnt* cnt
- d 0.0
- )
- (setvar "cmdecho" 0)
- (command "_.undo" "_g" "_.copy" ss "" "_m" bp)
- (repeat (1- cnt)
- (command
- (polar bp ang (setq d (+ d dist)))
- )
- )
- (command "" "_.undo" "_e")
- )
- )
- (princ)
- )
|
|