Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flip objects over arc

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
ryled
4015 Views, 10 Replies

Flip objects over arc

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!

10 REPLIES 10
Message 2 of 11
Kent1Cooper
in reply to: ryled

ArcMirror.png

 

That would certainly be doable.

Kent Cooper, AIA
Message 3 of 11
ryled
in reply to: Kent1Cooper

Yes that is what I'm looking for!

Message 4 of 11
Kent1Cooper
in reply to: ryled

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.

Kent Cooper, AIA
Message 5 of 11
ryled
in reply to: Kent1Cooper

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!

Message 6 of 11
Kent1Cooper
in reply to: ryled


@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.

Kent Cooper, AIA
Message 7 of 11
ryled
in reply to: Kent1Cooper

Turining off running object snaps did what I needed.  Thanks a lot!

Message 8 of 11
Kent1Cooper
in reply to: Kent1Cooper


@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].


MirrorAcrossObject.png

Kent Cooper, AIA
Message 9 of 11
PeterLabs
in reply to: Kent1Cooper

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

Tags (1)
Message 10 of 11
Kent1Cooper
in reply to: PeterLabs


@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.

Kent Cooper, AIA
Message 11 of 11
PeterLabs
in reply to: Kent1Cooper

Hello Kent, thank for the reply and effort anyhow!

Kind regards,

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost