PDA

View Full Version : Mirror placement of objects, but not the objects themselves?



Julesagain
2009-02-03, 10:03 PM
I don't know if this is possible, but I thought I'd throw it out there. I have an array of assorted blocks, with the attributes edited, along a wire. They are all the exact same distance apart. The problem is, I lined them up in the opposite order from how they need to go. I was just wondering if there is a way to mirror the line-up without mirroring the actual objects themselves. I guess what I need is a MIRRTEXT for the objects. I hope this makes sense. There aren't that many, so I'm going to just move them where they need to go, but it sure would be handy if I had about 50 of them all in a line, and needed them to be lined up in the opposite direction!

Thanks,
Jules

dzatto
2009-02-03, 11:04 PM
The first thing that comes to mind is to create a dynamic block with a mirror command in it. That way, you could mirror all your blocks, then go through and hit the mirror grip for each one to flip it back where it should be.

It's still a bit of work if you had 50 of them, but it would be quicker than placing them all again.

dzatto
2009-02-03, 11:07 PM
Just thought of something else even better that I think will work. You'll have to try it though.

Mirror the entire string of blocks, which should put the attributes in the correct order. The problem would be that the block geometry is now mirrored. Just block edit one of the blocks, fix it, then save your changes. It should fix all the blocks at once. You might have to edit the block first.

Richard.Kent
2009-02-04, 03:57 AM
I don't know if this is possible, but I thought I'd throw it out there. I have an array of assorted blocks, with the attributes edited, along a wire. They are all the exact same distance apart. The problem is, I lined them up in the opposite order from how they need to go. I was just wondering if there is a way to mirror the line-up without mirroring the actual objects themselves. I guess what I need is a MIRRTEXT for the objects. I hope this makes sense. There aren't that many, so I'm going to just move them where they need to go, but it sure would be handy if I had about 50 of them all in a line, and needed them to be lined up in the opposite direction!

Thanks,
Jules


Mirror them, pick them, go to properties and change the X scale from negative number to positive.
Assuming you mirror along a zero degree line. I just tried it and it worked fine. Hopefully it will work in your exact application.

You can also rotate them all and then use properties to change the rotation back.

irneb
2009-02-04, 11:22 AM
There might be a problem with the attributes. A normal mirror will place the attributes correctly & (with MIRRTEXT=0) will not mirror the attributes back-to-front.

However, the change properties will disregard the MIRRTEXT variable. So your attributes will then get "mirrored" back-to-front. The usual way of fixing them, would then require ATTSYNC (or BATTMAN-->Sync). Unfortunately these would then also move, size & rotate all attributes to their defaults ... so if you've modified any attribute properties (font, size, rotation, etc.) or moved them using grip-edit, these changes would be lost.

irneb
2009-02-04, 12:10 PM
Just had a look if Lisp could help, try this one:
;;; Mirror with blocks mirrored back again individualy
(defun c:MirrorB (/ ss en ed n pt1 pt2 ang erase MirrBlock)
(ErrorTrap '((("CMDECHO" . 0)) nil t))
;; Get selection of objects to mirror
(setq ss (ssget))

;; Get mirror points
(setq pt1 (getpoint "Specify first point of mirror line: ")
pt2 (getpoint pt1 "Specify second point of mirror line: ")
) ;_ end of setq

;; Get erase original
(initget "Yes No")
(setq erase (getkword "\nErase source objects? [Yes/No] <N>: "))

(setq en (entlast)) ;Get the last entity in the drawing (in case of No answer)

;; Perform normal mirror
(command "._MIRROR" ss "" "_non" pt1 "_non" pt2 erase)

(defun MirrBlock (en ed /)
;; Mirror block around its insertion point
(command "._MIRROR"
en
""
"_non"
(cdr (assoc 10 ed))
"_non"
(strcat "@100<<" (angtos ang))
"_Yes"
) ;_ end of command
) ;_ end of defun

;; Get the angle of mirror
(setq ang (angle pt1 pt2))

(if (= erase "Yes")
(progn ;Step through selection
(setq n 0) ;Initialize counter to zero
(while (< n (sslength ss)) ;Step through all entities in selection
(setq en (ssname ss n) ;Get nth entity in selection
ed (entget en) ;And its data
) ;_ end of setq
;; Check if block
(if (= "INSERT" (cdr (assoc 0 ed)))
(MirrBlock en ed) ;Mirror the block about its insertion point
) ;_ end of if
(setq n (1+ n)) ;Increment counter
) ;_ end of while
) ;_ end of progn
(progn ;Else step through new objects
(setq en (entnext en)) ;Get next new object after the mirror command
(while en ;While there's a new object
(setq ed (entget en)) ;Get its data
;; Check if block
(if (= "INSERT" (cdr (assoc 0 ed)))
(MirrBlock en ed) ;Mirror the block about its insertion point
) ;_ end of if
(setq en (entnext en)) ;Get the following new object
) ;_ end of while
) ;_ end of progn
) ;_ end of if

(ErrorTrap nil)
(princ)
) ;_ end of defunCommand is MirrorB, it works the same as the normal Mirror, but then mirrors each block around its insertion point again.

And save the attached file somewhere so it's loaded before the above. This is simply my error handling (in case the user presses Esc).