+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16
  1. #1
    Full Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2016
    Join Date
    Nov 2017
    Posts
    61

    Default Quick mirror help

    Registered forum members do not see this ad.

    SO i was browsing around lee mac's website and came across his
    HTML Code:
    http://www.lee-mac.com/quickmirror.html
    lisp.

    not sure if this is something that could be done or not (and not saying that lee mac's works isnt good) but rather than doing a mirror the old fashion way by selecting the object, pick a point, drag the mouse, click and then type yes to delete old or no to keep old. lee mac's is a very quick routine to do such a thing. however you have to pick a line in order to mirror said object. i am wondering if there is something out there that someone has that would allow you to do the following:

    select object (line, polyline, block etc.)type command and drag mouse to the left or to the right and click. so to say have this only be able to mirror on a horizontal plan, and the objects selection point. like below

    <~~~~~~~~ do command ~~~~~~~~~> and get that. (hope this makes sense)


    not sure if this is something that is out there or not but i have yet to find anything.

    thank you all

  2. #2
    Full Member
    Discipline
    Civil
    Using
    Civil 3D 2015
    Join Date
    Mar 2017
    Posts
    28

    Default

    I think this might be close to what you want. I just tweaked an old one I made as I was learning to write lisp.
    Code:
    (defun C:testmirror ( / obj objinfo objpt pt dist ang midpt midend)
      (setq obj (entsel "\nSelect Object to Mirror: "))
      (setq objinfo (entget (car obj)))
      (setq objpt (cdr (assoc 10 objinfo)))
      (setq pt (getpoint "\nSelect point to left or right"))
      (setq dist (distance objpt pt))
      (setq ang (angle objpt pt))
      (setq midpt (polar objpt ang (/ dist 2)))
      (setq midend (list (car midpt) (- (cadr midpt) 10)))
      (command "mirror" obj "" midpt midend "N" )
      (princ)
      )

  3. #3
    Full Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2016
    Join Date
    Nov 2017
    Posts
    61

    Default

    Quote Originally Posted by aawilds View Post
    I think this might be close to what you want. I just tweaked an old one I made as I was learning to write lisp.
    Code:
    (defun C:testmirror ( / obj objinfo objpt pt dist ang midpt midend)
      (setq obj (entsel "\nSelect Object to Mirror: "))
      (setq objinfo (entget (car obj)))
      (setq objpt (cdr (assoc 10 objinfo)))
      (setq pt (getpoint "\nSelect point to left or right"))
      (setq dist (distance objpt pt))
      (setq ang (angle objpt pt))
      (setq midpt (polar objpt ang (/ dist 2)))
      (setq midend (list (car midpt) (- (cadr midpt) 10)))
      (command "mirror" obj "" midpt midend "N" )
      (princ)
      )
    this is exactly what i am looking for. i wanted to see about making one minor change?

    i am not sure how i would add to be able to select multiple object? like text and the leader, a block with a leader?

  4. #4
    Full Member
    Discipline
    Civil
    Using
    Civil 3D 2015
    Join Date
    Mar 2017
    Posts
    28

    Default

    It should be doable but we are prepping for a big project right now. I just happened to have that mostly done. Maybe someone else can pick it up, sorry.

  5. #5
    Full Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2016
    Join Date
    Nov 2017
    Posts
    61

    Default

    Quote Originally Posted by aawilds View Post
    It should be doable but we are prepping for a big project right now. I just happened to have that mostly done. Maybe someone else can pick it up, sorry.
    hey no worries, that still is a big help to me so thank you

  6. #6
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,109

    Default

    Hi,
    Something like this?
    Code:
    (defun c:mymirror (/ sel pt1 pt2 int ent)
      (princ "\nSelect objects to mirror :")
      (and (setq sel (ssget "_:L"))
           (setq pt1 (getpoint "\nSpecify 1st point :"))
           (setq int -1 pt2 (getpoint "\nSpecify 2nd point :" pt1))
           (while (setq ent (ssname sel (setq int (1+ int))))
             (vlax-invoke (vlax-ename->vla-object ent) 'mirror pt1 pt2)
             (entdel ent)
           )
      )
      (princ)
    ) (vl-load-com)

  7. #7
    Full Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2016
    Join Date
    Nov 2017
    Posts
    61

    Default

    Quote Originally Posted by Tharwat View Post
    Hi,
    Something like this?
    Code:
    (defun c:mymirror (/ sel pt1 pt2 int ent)
      (princ "\nSelect objects to mirror :")
      (and (setq sel (ssget "_:L"))
           (setq pt1 (getpoint "\nSpecify 1st point :"))
           (setq int -1 pt2 (getpoint "\nSpecify 2nd point :" pt1))
           (while (setq ent (ssname sel (setq int (1+ int))))
             (vlax-invoke (vlax-ename->vla-object ent) 'mirror pt1 pt2)
             (entdel ent)
           )
      )
      (princ)
    ) (vl-load-com)

    this is very similar to another one that i have seen. but the first code

    Code:
    (defun C:testmirror ( / obj objinfo objpt pt dist ang midpt midend)
      (setq obj (entsel "\nSelect Object to Mirror: "))
      (setq objinfo (entget (car obj)))
      (setq objpt (cdr (assoc 10 objinfo)))
      (setq pt (getpoint "\nSelect point to left or right"))
      (setq dist (distance objpt pt))
      (setq ang (angle objpt pt))
      (setq midpt (polar objpt ang (/ dist 2)))
      (setq midend (list (car midpt) (- (cadr midpt) 10)))
      (command "mirror" obj "" midpt midend "N" )
      (princ)
      )
    this allows you to be able to make your selection (but only one entity) and then pick a point either to the left or to the right.

    i am wondering if the part of the code that you have that allows you to be able to select multipule objects can be added to the other?

  8. #8
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,109

    Default

    Quote Originally Posted by dnovember99 View Post
    i am wondering if the part of the code that you have that allows you to be able to select multipule objects can be added to the other?
    ssget function allows you to select one or multiple objects if the mode string is not including ":S".

  9. #9
    Full Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2016
    Join Date
    Nov 2017
    Posts
    61

    Default

    Quote Originally Posted by Tharwat View Post
    ssget function allows you to select one or multiple objects if the mode string is not including ":S".

    where would i place the (ssget) within this code?

    Code:
    (defun C:testmirror ( / obj objinfo objpt pt dist ang midpt midend)
      (setq obj (entsel "\nSelect Object to Mirror: "))
      (setq objinfo (entget (car obj)))
      (setq objpt (cdr (assoc 10 objinfo)))
      (setq pt (getpoint "\nSelect point to left or right"))
      (setq dist (distance objpt pt))
      (setq ang (angle objpt pt))
      (setq midpt (polar objpt ang (/ dist 2)))
      (setq midend (list (car midpt) (- (cadr midpt) 10)))
      (command "mirror" obj "" midpt midend "N" )
      (princ)
      )

  10. #10
    Senior Member
    Using
    not applicable
    Join Date
    Oct 2014
    Posts
    155

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by dnovember99 View Post
    where would i place the (ssget) within this code?

    Code:
    (defun C:testmirror ( / obj objinfo objpt pt dist ang midpt midend)
      (setq obj (entsel "\nSelect Object to Mirror: "))
      (setq objinfo (entget (car obj)))
      (setq objpt (cdr (assoc 10 objinfo)))
      (setq pt (getpoint "\nSelect point to left or right"))
      (setq dist (distance objpt pt))
      (setq ang (angle objpt pt))
      (setq midpt (polar objpt ang (/ dist 2)))
      (setq midend (list (car midpt) (- (cadr midpt) 10)))
      (command "mirror" obj "" midpt midend "N" )
      (princ)
      )
    The problem with trying to substitute SSGET in this code is that ENTSEL gives you a point (objpt) on the selected object. If you want to use the above code you'll need to provide a point somewhere with respect to all of the selected objects.
    BricsCAD V15

Similar Threads

  1. Mirror 3D with predefined mirror plane
    By Randolph in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 7th Jun 2012, 09:10 am
  2. New Thread Suggestion: Quick Question, Quick Answer
    By Pintoleite in forum Feedback
    Replies: 43
    Last Post: 11th Apr 2012, 01:23 pm
  3. separate commands for mirror (flip) and mirror (retain original)
    By designerstuart in forum The CUI, Hatches, Linetypes, Scripts & Macros
    Replies: 5
    Last Post: 28th Mar 2011, 04:18 pm
  4. Quick Select/Quick Filter
    By mike06 in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 4
    Last Post: 29th Mar 2008, 01:33 am
  5. A Quick Tip on Quick Leader
    By CAD-e-Corner in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 21st Nov 2006, 10:51 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts