这是另一篇文章中的问题,但我想我会尝试一些东西,它使用一种简单的方法2x40在X方向复制对象2次,相隔40,它也适用于Y,它在编写时考虑了正交即X和Y轴,但如果使用临时UCS,它在角度上工作。它支持2x-40转另一种方式。
它可能有用。
- ; copy multiple objects along x or y axis
- ; use 2x40 etc
- ; by Alan H aug 2017
- (defun c:cd ( / ss num ans)
- (defun copyx ( / x)
- (setq howmany (atoi (substr ans 1 num)))
- (setq dist (atof (substr ans (+ num 2)(- (strlen ans) (+ num 1)))))
- (setq x 1.0)
- (repeat howmany
- (command "copy" ss "" (list 0 0) (list (* dist x) 0))
- (setq x (+ x 1.0))
- )
- (setq ss nil)
- )
- (defun copyy ()
- (setq howmany (atoi (substr ans 1 num)))
- (setq dist (atof (substr ans (+ num 2)(- (strlen ans) (+ num 1)))))
- (setq x 1.0)
- (repeat howmany
- (command "copy" ss "" (list 0 0) (list 0 (* dist x) ))
- (setq x (+ x 1.0))
- )
- (setq ss nil)
- )
- (princ "\nPlease pick objects <Cr> to exit")
- (setq oldsnap (getvar 'osmode))
- (setvar 'osmode 0)
- (while (/= (setq ss (ssget)) nil)
- (setq ans (strcase (getstring "Enter num XY offset 2x40")))
- (cond
- ((/= (setq num (vl-string-search "X" ans )) nil)(copyx))
- ((/= (setq num (vl-string-search "Y" ans )) nil)(copyy))
- (alert "You have Entered an incorrect value")
- )
- )
- )
|