本帖最后由 llsheng_73 于 2023-6-14 16:29 编辑
- (defun c:tt (/ bx pt p1 p2)
- (vl-load-com)
- (if(not(TBLOBJNAME"layer""图层9"))
- (entmakex'((0 . "LAYER")(100 . "AcDbSymbolTableRecord")(100 . "AcDbLayerTableRecord")(2 . "图层9")(70 . 0))))
- (setq bx(getdist "\n输入四周间隔: ")
- bx(list bx bx))
- (while(setq pt(princ "\n选择加框物体: ")pt(ssget))
- (setq pt(apply'append(mapcar'(lambda(x / p1 p2)
- (if(equal(type(cadr x))'ename)
- (progn (vla-getboundingbox(vlax-ename->vla-object(cadr x))'p1 'p2)
- (mapcar'vlax-safearray->list(list p1 p2)))))(ssnamex pt)))
- p1(mapcar '-(apply 'mapcar (cons 'min pt))bx)
- p2(mapcar '+(apply 'mapcar (cons 'max pt))bx))
- (entmakex(list'(0 . "lwpolyline")'(100 . "AcDbEntity")'(100 . "AcDbPolyline")'(8 . "图层9")'(90 . 4)'(70 . 1)
- (cons 10 p1)(list 10(car p1)(cadr p2))(cons 10 p2)(list 10(car p2)(cadr p1))))
- ))
|