hi pipefitter72高
欢迎来到论坛
我假设你的管道是直线物体。。
- (defun c:Test1 (/ *error* ss s p i e cm es)
- (defun *error* (x)
- (if cm
- (setvar 'cmdecho cm)
- ) ;_ end of if
- (princ "\n*Cancel*")
- ) ;_ end of defun
- (if (and (setq ss (ssget))
- [color="gray"];;; (setq ss (osnap (cadr es) "mid")) ;<---- incorrect due ss not consp [/color]
- (setq s (ssget "_:L"))
- (setq p (getpoint "\n Specify base point :"))
- ) ;_ end of and
-
- (progn (setq cm (getvar 'cmdecho))
- (setvar 'cmdecho 0)
- (command "_._copybase" "_non" p s "")
- (repeat (setq i (sslength ss))
- (setq e (entget (ssname ss (setq i (1- i)))))
-
- [color="gray"];;; (foreach pt e
- ;;; (if (eq (car pt) 10)
- ;;; (command "_.pasteclip" (cdr pt))
- ;;; )
- ;;; )[/color]
-
- [color="#696969"];;suggest by hanhphuc (for line only)[/color]
- [color="red"] (if (eq (cdr (assoc 0 e)) "LINE") ;<--- assume the pipe object is line
- (command "_.pasteclip"
- (apply 'mapcar
- (cons ''((a b) (/ (+ a b) 2.)) (mapcar ''((x) (cdr (assoc x e))) '(10 11)))
- ) ;_ end of apply
- ) ;_ end of command
- ) ;_ end of if[/color]
-
- ) ;_ end of repeat
- (setvar 'cmdecho cm)
- ) ;_ end of progn
- ) ;_ end of if
- ) ;_ end of defun
|