我不确定我是否理解你的问题。
我做的:左一洞,右一洞;左或右各50个单元;在中间垂直对齐。
半径:10
还有别的事吗?
- ;; @see http://www.cadtutor.net/forum/showthread.php?44768-Entmake-Functions
- ;; draw a polyline
- (defun LWPoly (lst cls)
- (entmakex (append (list (cons 0 "LWPOLYLINE")
- (cons 100 "AcDbEntity")
- (cons 100 "AcDbPolyline")
- (cons 90 (length lst))
- (cons 70 cls))
- (mapcar (function (lambda (p) (cons 10 p))) lst))))
-
- (defun Circle (cen rad)
- (entmakex (list (cons 0 "CIRCLE")
- (cons 10 cen)
- (cons 40 rad))))
-
- ;; vertically in the middle, means: y-value is the average. => p1 + halfOf(p1, p2)
- ;; => (+ (nth 1 p1) (/ (- (nth 1 p2) (nth 1 p1)) 2))
- (defun vmiddle (p1 p2 / )
- (+ (nth 1 p1) (/ (- (nth 1 p2) (nth 1 p1)) 2))
- )
-
- (defun c:sp ( / p1 p2 y_middle lst my_poly)
- (setq p1 (getpoint "\nPoint 1:"))
- (setq p2 (getcorner p1 "\nPoint 2:"))
- ;; corners of the rectangle:
- (setq lst (list
- (list (nth 0 p1) (nth 1 p1) (nth 2 p1))
- (list (nth 0 p2) (nth 1 p1) (nth 2 p1))
- (list (nth 0 p2) (nth 1 p2) (nth 2 p1))
- (list (nth 0 p1) (nth 1 p2) (nth 2 p1))
- ))
- (setq my_poly (LWPoly lst 1))
- ;; calculate vertical middle
- (setq y_middle (vmiddle p1 p2))
- ;; circle 1 (left). x-value of p1 + 50
- (Circle
- (list (+ (nth 0 p1) 50) y_middle)
- 10.0 ;; radius
- )
- ;; circle 2 (right). x-value of p2 - 50
- (Circle
- (list (- (nth 0 p2) 50) y_middle)
- 10.0 ;; radius
- )
- (princ)
- )
|