本帖最后由 fangmin723 于 2019-11-18 08:57 编辑
- ;;说明:直线批量周向偏移 作者:fangmin723-2019.11.18
- (defun c:AO(/ dis dist edata ent lst n pte pts ss)
- (if (setq ss (ssget '((0 . "LINE"))))
- (progn
- (setq dis (getreal "\n请输入周边距离<150>:") n 0)
- (if (or (= dis nil) (= dis "") (< dis 0)) (setq dis 150))
- (while (and (setq ent (ssname ss n)) (> dis 0))
- (setq
- pts (cdr (assoc 10 (setq edata (entget ent))))
- pte (cdr (assoc 11 edata))
- dist (/ dis (sin (* pi 0.25)))
- lst (list
- (polar pts (- (angle pte pts) (* pi 0.25)) dist)
- (polar pts (+ (angle pte pts) (* pi 0.25)) dist)
- (polar pte (- (angle pts pte) (* pi 0.25)) dist)
- (polar pte (+ (angle pts pte) (* pi 0.25)) dist)
- )
- )
- (entmake
- (append
- (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length lst)) (cons 70 1))
- (mapcar '(lambda (pt) (cons 10 pt)) lst)
- )
- )
- (setq n (1+ n))
- )
- )
- )
- (princ)
- )
|