@a.tawkXHKN6 wrote:
thanks for your reply. Can we consider the case when we have a rotated block so that the mirror line should be rotated as well? see attached image.
You don't need a Mirror command for this, nor to extract the insertion point, nor calculate the direction of the appropriate axis, nor translate between coordinate systems, nor account for the possibility of running Object Snap modes, etc. In the case of a Block defined in the way your image shows, you can just change the X scale factor to the negative of its current value. In simplest terms:
(defun C:BMIP (/ blk bdata) ; = Block "Mirror" about Insertion Point
(setq
blk (car (entsel "\nSelect Block to Mirror: "))
bdata (entget blk)
)
(entmod
(subst
(cons 41 (- (cdr (assoc 41 bdata))))
(assoc 41 bdata)
bdata
)
)
(princ)
)
If you want to flip one about the horizontal axis in relation to your base Block definition, just change the 41's to 42's to use the Y scale factor instead of X.
Kent Cooper, AIA