Jump to content

ACAD 2007: Mirror lisp: axis at "Mid between 2 Points" lisp


onzki

Recommended Posts

I am always caught in situation where I need to mirror using "Mid between 2 Points" that's why I am looking for a shortcut. Is there an Lisp for the following sequence:

1. MIRROR

2. Mid between 2 Points

3. (now, I select the 2 points)

4. Finally, automatically answers "N" to the question (erase source object?)

 

That's it, I attached an image for reference. Thank you! :)

 

mirrorbetween2point.jpg

 

Uploaded with ImageShack.us

Link to comment
Share on other sites

I am always caught in situation where I need to mirror using "Mid between 2 Points" that's why I am looking for a shortcut. Is there an Lisp for the following sequence:

 

(defun c:test (/ ss )
(setq ss (ssget))
(command "._mirror" ss "" "mtp" pause pause "@1<90" "n")
)

 

this works but wait for a better way:lol:

 

____

I sorry for my "ghettoway" definition. I thought I'd have a little fun but decided against it.

Link to comment
Share on other sites

[quote=Lt Dan's legs;340979this works but wait for a better way:lol:

 

(defun c:test (/ ss p1 p2)
(setq ss (ssget))
(setq p1 (getpoint "\nSpecify first point: "))
(setq p2 (getpoint  "\nSpecify second point: "))
(setvar "CMDECHO" 0)
(command "._mirror" ss "" "mtp" p1 p2 "@1<90" "n")
(setvar "CMDECHO" 1)
(PRINC)
)

 

A little better but I'm sure someone will blow this one out of the water.

Link to comment
Share on other sites

for some reason I thought you said m2p is better. I'm in desperate need of caffeine!!

 

Nah, I just meant instead of writing a whole LISP, just use Mirror with the m2p/mtp snap. :)

Link to comment
Share on other sites

@Lt. Dan's Legs:

Thanks for sharing the code. However, I noticed it only mirrors horizontally (side by side), even when two points are vertical. Is it still possible to tweak this one to be more flexible in mirroring both horizontal/vertical depending on the points I select.

By the way, If it would be easier- I am okay of having two LISP one for horizontal (what we have above), other one for vertical.

 

Thanks!

Link to comment
Share on other sites

Hi,

 

This one uses the bissector (perpendicular to the midlle of the segment) of the two points as axis for the mirror.

 

(defun c:test (/ ss p1 p2 mid p3)
 (and
   (setq ss (ssget))
   (setq p1 (getpoint "\nFirst point: "))
   (setq p2 (getpoint p1 "\nSecond point: "))
   (setq mid (mapcar '(lambda (x1 x2) (/ (+ x1 x2) 2.)) p1 p2))
   (setq p3 (polar mid (+ (angle p1 p2) (/ pi 2.)) 1.))
   (command "_.mirror" ss "" "_non" mid "_non" p3 "_no")
 )
 (princ)
)

Link to comment
Share on other sites

Hi,

 

This one uses the bissector (perpendicular to the midlle of the segment) of the two points as axis for the mirror.

 

 

Amazing, this is very helpful. Thanks for sharing! :D

Link to comment
Share on other sites

Hi,

 

This one uses the bissector (perpendicular to the midlle of the segment) of the two points as axis for the mirror.

 

(defun c:test (/ ss p1 p2 mid p3)
 (and
   (setq ss (ssget))
   (setq p1 (getpoint "\nFirst point: "))
   (setq p2 (getpoint p1 "\nSecond point: "))
   (setq mid (mapcar '(lambda (x1 x2) (/ (+ x1 x2) 2.)) p1 p2))
   (setq p3 (polar mid (+ (angle p1 p2) (/ pi 2.)) 1.))
   (command "_.mirror" ss "" "_non" mid "_non" p3 "_no")
 )
 (princ)
)

 

Nice gile. As you can tell I'm a beginner & wasn't sure how I was going to do the angle.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...