请问有没有块原地中心左右镜像的LSP啊?有原地旋转的就不知道怎么改.求教了
(defun c:cexx(/ x k s n m en r);;;各自中心旋转(vl-load-com)
(setq x(getangle"\n输入需要旋转的角度<归0>:"))
(if(null x)(setq x 0 k nil) (setq k t))
(setq s(ssget'((0 . "INSERT"))))
(if s
(progn
(setq n(sslength s)m 0)
(while(< m n)
(setq en(ssname s m)
m(1+ m))
(if k(setq r (+ (cdr(assoc 50 (entget en))) x))(setq r x))
(vla-put-MIRROR (vlax-ename->vla-object en) r)
)))
(princ)
)
(defun C:test()
(COMMAND "mirror"
(setq ss (ssget ":E:S"))
""
(mapcar '(lambda (x) (/ x 2)) (apply 'mapcar (cons '+ (acet-ent-geomextents (ssname ss 0)))))
"90"
)
)
(defun c:cemi(/ sc a b);;;;各自中心镜像---
(while (ssget)
(vlax-for obj
(vla-get-ActiveSelectionSet
(vla-get-ActiveDocument (vlax-get-acad-object)))
(if (not (VL-CATCH-ALL-ERROR-P
(VL-CATCH-ALL-APPLY
'vla-GetBoundingBox
(list obj 'a 'b))))
(progn
(setq bp(mapcar '*'(0.5 0.5 0.5)(apply 'mapcar (cons '+ (mapcar 'vlax-safearray->list(list a b))))))
(setq ep(list (car bp) (1+ (cadr bp)) (caddr bp)))
(vla-transformby obj (vlax-tmatrix (mirror2dmat bp ep)))
)
)
)
)
(princ)
)
(defun mirror2dmat(sp ep / i a0 a1 a2 a3 t1 sp a b)
(setq i '((-1 0 0) (0 -1 0)(0 0 1)))
(setq a0(mapcar '- ep sp))
(setq a1(distance a0 (list 0 0 0)))
(setq a2(/ 1 a1))
(setq a3(mapcar '(lambda(y)(* y a2)) a0)
t1(mapcar '(lambda(x)(mapcar '(lambda(y)(* x y)) a3)) a3)
t1(mapcar '(lambda(x)(mapcar '(lambda(y)(* 2 y)) x))t1)
t1(mapcar '(lambda(x y)(mapcar '+ x y)) t1 i))
(setq sp(mapcar '- sp (mapcar '(lambda(x)(apply '+ (mapcar '* x sp))) t1)))
(setq a (car t1)
b (cadr t1))
(list
(list (car a)(cadr a)(caddr a) (car sp))
(list (car b)(cadr b)(caddr b) (cadr sp))
'(0 0 1 0)
'(0 0 0 1))
) (defun c:cesc(/ sc a b);;;;各自中心缩放
(if (null oldscale) (setq oldscale 2.0))
(initget 6)
(setq sc (getreal (strcat "\n缩放倍数<" (rtos oldscale 2 2)">:")))
(if (null sc) (setq sc oldscale) (setq oldscale sc))
(while (ssget)
(vlax-for obj
(vla-get-ActiveSelectionSet
(vla-get-ActiveDocument (vlax-get-acad-object)))
(if (not (VL-CATCH-ALL-ERROR-P
(VL-CATCH-ALL-APPLY
'vla-GetBoundingBox
(list obj 'a 'b))))
(progn
(vla-ScaleEntity
obj
(vlax-3d-point
(mapcar
'*
'(0.5 0.5 0.5)
(apply 'mapcar
(cons '+
(mapcar 'vlax-safearray->list
(list a b))))))
sc
)
)
)
)
)
(princ)
) (defun C:tt();中心镜像
(COMMAND "mirror"
(setq ss (ssget ":E:S"))
""
(setq p1 (mapcar '(lambda (x) (/ x 2)) (apply 'mapcar (cons '+ (acet-ent-geomextents (ssname ss 0))))))
(setq p2 (polar p1 (* pi 0.5) 2)) "Y"
)
) 本帖最后由 hooboxu 于 2015-5-18 09:30 编辑
@KWOK 还不行。我要想多个块左右镜像了位置还在原位。你的和原来的镜像一样的,不过还是谢谢你 镜像块文字会反 嗯,所以我要把它原地再反过来 本帖最后由 danxingpen 于 2015-5-18 15:37 编辑
danxingpen 发表于 2015-5-18 15:20 static/image/common/back.gif
(defun c:cemi(/ sc a b);;;;各自中心镜像---
(while (ssget)
(vlax-for obj
说明一下:这个是绕中心左右镜像的,如果要绕中心上下镜像则把
(setq ep(list (car bp) (1+ (cadr bp)) (caddr bp)))
改为
(setq ep(list (1+ (car bp))(cadr bp) (caddr bp))) @danxingpen 谢谢谢谢,.太感谢了.就是这个效果.
页:
[1]
2