- (defun c:tt ()
- (setvar "cmdecho" 0)
- (if (not spacing_a)
- (setq spacing_a 1200)
- )
- (setq Enter_value
- (getreal (strcat "\n输入分板间距 <初始值"(rtos spacing_a)">")
- )
- )
- (if (null Enter_value)
- (setq Enter_value spacing_a)
- (setq spacing_a Enter_value)
- )
- (while (and (setq pt1 (getpoint "\n指定起点: "))
- (setq pt2 (getcorner pt1 "\n指定终点: "))
- )
- (setq pt1_x (nth 0 pt1)
- pt1_y (nth 1 pt1)
- pt2_x (nth 0 pt2)
- )
- (setq gap_x (abs (- pt1_x pt2_x)))
- (setq n (rem (fix (/ gap_x spacing_a)) 2))
- (if (= n 0)
- (setq gap_x (+ (/ (abs (- pt1_x pt2_x)) 2) (/ spacing_a 2)))
- (setq gap_x (/ (abs (- pt1_x pt2_x)) 2))
- )
- (if (< pt1_x pt2_x)
- (setq gap (+ pt1_x gap_x))
- (setq gap (+ pt2_x gap_x))
- )
- (setq middle (list gap pt1_y))
- (command "rectang" pt1 pt2)
- (setq s1 (entlast))
- (command "-hatch" "p" "u" "90" spacing_a "n" "s" s1 "" "o" "s" middle "y" "")
- (command "_.erase" s1 "")
- )
- (princ)
- )
用填充确实简单多了,我加入了填充指定基点。现在可以随意框了。
还要深化把填充体放入指定图层。
|