AutoCAD 2010/2011/2012

Reply
Valued Contributor
ryled
Posts: 63
Registered: ‎03-31-2014
Message 1 of 8 (156 Views)
Accepted Solution

Flip objects over arc

156 Views, 7 Replies
05-15-2014 07:15 AM

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!

*Expert Elite*
Kent1Cooper
Posts: 5,246
Registered: ‎09-13-2004
Message 2 of 8 (150 Views)

Re: Flip objects over arc

05-15-2014 07:38 AM in reply to: ryled

ArcMirror.png

 

That would certainly be doable.

Kent Cooper
Valued Contributor
ryled
Posts: 63
Registered: ‎03-31-2014
Message 3 of 8 (142 Views)

Re: Flip objects over arc

05-15-2014 08:14 AM in reply to: Kent1Cooper

Yes that is what I'm looking for!

*Expert Elite*
Kent1Cooper
Posts: 5,246
Registered: ‎09-13-2004
Message 4 of 8 (126 Views)

Re: Flip objects over arc

05-15-2014 12:14 PM 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
Valued Contributor
ryled
Posts: 63
Registered: ‎03-31-2014
Message 5 of 8 (118 Views)

Re: Flip objects over arc

05-15-2014 02:01 PM 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!

*Expert Elite*
Kent1Cooper
Posts: 5,246
Registered: ‎09-13-2004
Message 6 of 8 (113 Views)

Re: Flip objects over arc

05-15-2014 03:12 PM 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
Valued Contributor
ryled
Posts: 63
Registered: ‎03-31-2014
Message 7 of 8 (111 Views)

Re: Flip objects over arc

05-15-2014 03:17 PM in reply to: Kent1Cooper

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

*Expert Elite*
Kent1Cooper
Posts: 5,246
Registered: ‎09-13-2004
Message 8 of 8 (85 Views)

Re: Flip objects over arc

05-16-2014 12:09 PM 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community




Connect with AutoCAD

Twitter

Facebook

Blogs

Pinterest

Youtube