Mirror command
I am looking to see how to create a Mirror command so that the object flips on a specific axis similar to a Rotate command I use:
"^c^c^p(command "_rotate" (ssget) "" "_non" (trans (apply 'acet-geom-mid-point (vle-getboundingbox (ssget "_P"))) 0 1) 180.0)(princ)^p"
This command spins the selection 180 degress (I also have a similar command for clockwise and counter clockwise 90 degree rotation.
I'd like to mirror something (set to it's mid-point) so it flips horizontally or vertically.\
The keyboard shortcuts to these commands then get saved to a location on a macro keyboard I use so it's a single click to execute.
Comments
-
You would just have to add any number to the X or Y coordinate of that midpoint of the diagonal of the bounding box. Then use that as the second point of the Mirror command.
I don't know how to add a number to a coordinate in lisp. It's probably very simple.
But if you don't mind a single mouse click after executing the Flip command, then a single command can be used to flip horizontally or vertically about the centroid. The mouse click determines which way to flip.
(defun c:Flip () (setq ss1 (ssget)) (setq p1 (trans (apply 'acet-geom-mid-point (vle-getboundingbox ss1)) 0 1)) (setq om1 (getvar "Orthomode")) (setvar "Orthomode" 1) (command "Mirror" ss1 "" p1 pause "y") (setvar "Orthomode" om1) (sssetfirst nil (ssget "P")) )
0 -
; Menu macro: ^c^c^p(MirSet "H")^p (defun MirSet (mode / pt ss) ; mode: "H" or "V") (if (setq ss (ssget)) (progn (setq pt (trans (apply 'acet-geom-mid-point (vle-getboundingbox ss)) 0 1)) (setvar 'cmdecho 0) (command "_.mirror" ss "" "_non" pt "_non" (mapcar '+ pt (if (= "H" (strcase (substr mode 1 1))) '(1.0 0.0 0.0) '(0.0 1.0 0.0) ) ) "_yes" ) (setvar 'cmdecho 1) ) ) (princ) )
0