本帖最后由 作者 于 2004-12-25 19:40:40 编辑
;;;试试:- (defun c:test ()
- (setq SS (ssget "x" '((0 . "LINE")))
- i -1
- )
- (command"UNDO""BE")
- (while (setq s1 (ssname ss (setq i (1+ i))))
- (if (= (vla-get-Length (vlax-ename->vla-object s1)) 35);可以改变35的数值
- (progn
- (setq pt0 (dxf 10 (entget s1))
- pt2 (dxf 11 (entget s1))
- pt1 (_midp pt0 pt2)
- ll 5
- )
- (setvar "osmode" 0)
- (mkla "中点" 1)
- (command "line" (POLAR PT1 0 ll) (POLAR PT1 PI ll) "")
- (command "line"
- (POLAR PT1 (/ PI 2) ll)
- (POLAR PT1 (* PI 1.5) ll)
- ""
- ))
- )
- )
- (command"UNDO""E")
- )
- (defun dxf (code elist) (cdr (assoc code elist)))
- (defun _midp (p1 p2)
- (list (+ (/ (- (car p1) (car p2)) 2) (car p2))
- (+ (/ (- (cadr p1) (cadr p2)) 2) (cadr p2))
- )
- )
- (defun mkla (name color)
- (If (= (Tblsearch "layer" name) nil)
- (Command "layer" "m" name "c" color name "")
- (Command "layer" "t" name "s" name "c" color name "")
- )
- )
|