I am attempting to flip a bunch of items over an arc. I don't want to flip the arc however. Currently I have an arc and everything is drawn on the top of the arc, mirroring the radius of the arc. However I need all of this to run along the bottom of the arc now. I understand there will probably be some spacing issues I need to correct but I was wondering if there is a way I could essentiall mirror these objects or flip them to the other side of the arc?
Thanks!
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
Solved by Kent1Cooper. Go to Solution.
A quickie, mildly tested:
;; MirrorAcrossObject.lsp [command name = MAO]
;; To Mirror selected object(s) across any appropriate object as a mirror
;; path or axis. Mirrors each object across the point on the axis object
;; closest to the middle of the mirrored object's bounding box.
;; Kent Cooper, 15 May 2014
(vl-load-com)
(defun C:MAO ; = Mirror Across Object
(/ mobj ss inc ent mid mobjnea)
(prompt "\nTo Mirror objects Across another Object,")
(setq
ss (ssget ":L")
mobj (vlax-ename->vla-object (car (entsel "\nSelect object to Flip things across:")))
); setq
(repeat (setq inc (sslength ss))
(setq ent (ssname ss (setq inc (1- inc))))
(vla-getboundingbox (vlax-ename->vla-object ent) 'minpt 'maxpt)
(setq
mid (mapcar '/ (mapcar '+ (vlax-safearray->list minpt) (vlax-safearray->list maxpt)) '(2 2 2))
mobjnea (vlax-curve-getClosestPointTo mobj mid)
); setq
(command "_.mirror" ent ""
mobjnea ; first point of mirror axis
(polar ; point in tangent direction at nearest point on mobj
mobjnea
(angle '(0 0 0) (vlax-curve-getFirstDeriv mobj (vlax-curve-getParamAtPoint mobj mobjnea)))
1
); polar
"_yes" ; delete source object
); command
); repeat
(princ)
); defun -- C:MAO
(prompt "\nType MAO to Mirror object(s) Across another Object.")
Since the operation would be the same, it works not only with an Arc but also with a whole mess of other object types as the mirroring axis [Line, Circle, Polyline, Ellipse, Spline, Ray, Xline, etc.]. It can use an error handler, object-type restrictions on selecting the Mirroring axis object, and various other bells and whistles.
I appreciate you taking the time to help me here and sorry it took a bit to get back to you. I ran the lisp and am having a bit of a problem. After selecting the objects I select the line I wish to flip over and get the error,
"Points must be distinct
; error: Function cancelled"
It then sends the objects north of the flip line.
Thanks again!
@ryled wrote:
...I select the line I wish to flip over and get the error,
"Points must be distinct
; error: Function cancelled"
...
Another thing it could use, that I forgot to include, is object-snap control. I suspect you have some running Osnap mode(s) on. Either build in turning running Osnap off [preferably saving its initial value and restoring it later], or just change these lines:
(command "_.mirror" ent ""
mobjnea ; first point of mirror axis
(polar ; point in tangent direction at nearest point on mobj
to these, to override Osnap for just those two points:
(command "_.mirror" ent ""
"_none" mobjnea ; first point of mirror axis
"_none" (polar ; point in tangent direction at nearest point on mobj
It also occurs to me that it ought to have the option to keep the selected Mirrored objects or not, rather than always not keeping them as it now stands [it sounded like that's what you were doing]. I'll work that in, and the other stuff, and post an update some time fairly soon.
@Kent1Cooper wrote:
@ryled wrote:
...I select the line I wish to flip over and get the error, ....
Another thing it could use, that I forgot to include, is object-snap control. ....
It also occurs to me that it ought to have the option to keep the selected Mirrored objects or not, rather than always not keeping them as it now stands [it sounded like that's what you were doing]. I'll work that in, and the other stuff, and post an update some time fairly soon.
Here's a fully-developed version, MirrorAcrossObject.lsp with its MAO command, with all the bells and whistles I could think to incorporate [see comments at the top of the file].
Hello Kent,
Great lisp, but It works only in World UCS. If I'm in a different UCS its not working. Can you solve this?
Thanks in advance!
Kind Regards,
Peter
@PeterLabs wrote:
....
Great lisp, but It works only in World UCS. If I'm in a different UCS its not working. Can you solve this?
....
That's the one bell and/or whistle I obviously didn't think to incorporate.... It will involve some (trans) functions, but it's not quite a straightforward application of that, since (angle) works in the current UCS, (vlax-curve-getFirstDeriv) works in the WCS, and (polar) seems [from its description in Help] to be hybrid about it. Give me a bit to make sure I get it right -- I think I have another routine that works with a similar condition, but I need to find which one.