它工作得很好。虽然它没有把盒子放在我目前的线型刻度“12”上。我该怎么做。我更改了一些内容,以便将其放在不同的层上。
- (defun c:f6 ( / _offsetoutside _corners->list ss )
- ;; © Lee Mac 2011
- (defun _offsetoutside ( a b )
- (mapcar
- (function
- (lambda ( b c )
- (mapcar
- (function
- (lambda ( b c ) ((eval b) c a))
- )
- b c
- )
- )
- )
- '((- -) (+ -) (+ +) (- +))
- b
- )
- )
- (defun _corners->list ( a b )
- (mapcar
- (function
- (lambda ( a b ) (list (car a) (cadr b)))
- )
- (list a b b a) (list a a b b)
- )
- )
- (setq clyr (getvar "clayer"))
- (command "-layer" "m" "Face 6" "c" "red" "" "lt" "Dashed" "Face 6" "")
- (if (setq ss (ssget '((0 . "~VIEWPORT"))))
- (entmakex
- (append
- (list
- (cons 0 "LWPOLYLINE")
- (cons 100 "AcDbEntity")
- (cons 100 "AcDbPolyline")
- (cons 8 "Face 6")
- (cons 90 4)
- (cons 70 1)
- )
- (mapcar
- (function
- (lambda ( x ) (cons 10 x))
- )
- (_offsetoutside 2.0
- (apply '_corners->list (LM:SSBoundingBox ss))
- )
- )
- )
- )
- )
- (princ)
- (setvar "clayer" clyr)
- )
- ;;--------------=={ SelectionSet BoundingBox }==--------------;;
- ;; ;;
- ;; Returns the lower-left and upper-right points of a ;;
- ;; rectangle bounding all objects in a supplied SelectionSet ;;
- ;;------------------------------------------------------------;;
- ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;
- ;;------------------------------------------------------------;;
- ;; Arguments: ;;
- ;; ss - SelectionSet for which to return the BoundingBox ;;
- ;;------------------------------------------------------------;;
- ;; Returns: Point List decribing BoundingBox (in WCS) ;;
- ;;------------------------------------------------------------;;
- (defun LM:SSBoundingBox ( ss / i l1 l2 ll ur )
- (repeat (setq i (sslength ss))
- (vla-getboundingbox (vlax-ename->vla-object (ssname ss (setq i (1- i)))) 'll 'ur)
- (setq l1 (cons (vlax-safearray->list ll) l1)
- l2 (cons (vlax-safearray->list ur) l2)
- )
- )
- (mapcar '(lambda ( a b ) (apply 'mapcar (cons a b))) '(min max) (list l1 l2))
- )
- (vl-load-com) (princ)
|