how can i use the mirror function in autolisp

Discussion in 'AutoCAD' started by annymech, May 2, 2004.

  1. annymech

    annymech Guest

    hello....
    i'm sorry to ask for so much help...

    i do not know how to mirror the objects i am drawing using autolisp .
    i mean is there a command called mirror,, for 2D
    how can i use it , or how can i formulate it .
    thanks for ur help
     
    annymech, May 2, 2004
    #1
  2. You probably need a good introductory course for
    AutoLISP/Visual LISP.

    The (command) function can be used to call most
    AutoCAD commands that use the command line:

    (command "._MIRROR" <selection set> <enter> ....)

    The sequence of arguments is the same as what
    the command prompts for when you use it interactively.

    To pass the objects to mirror, you must add them to
    a selection set (again, this requires some basic knowledge
    of AutoLISP).

    You can also use the ActiveX methods to do this, but
    that is a bit more advanced.
     
    Tony Tanzillo, May 2, 2004
    #2
  3. annymech

    bob.at Guest

    In Lisp you can use it via the "command" or "vl-cmdf" (in Visual lips):

    (setq ss (car (entsel)))
    (setq pt1 (getpoint "\n1. point of mirror line: "))
    (setq pt2 (getpoint pt1 "\n2. point of mirror line: "))
    (vl-cmdf "._mirror" ss "" pt1 pt2 "_n")

    bob.at
     
    bob.at, May 2, 2004
    #3
  4. annymech

    Jürg Menzi Guest

    annymech... or whatever your name is

    The following sample shows you how to use 'MIRROR' in a LISP sequence:

    (defun C:MyMirror ( / CurSet FstPnt NxtPnt OldOsm) ;;;Localized variables
    ;;;Get 'OSMODE'
    (setq OldOsm (getvar "OSMODE"))
    ;;;Conditions:
    (cond
    ;;;Not ((Implied selection) OR (Select objects))... exit
    ((not (setq CurSet (cond ((ssget "I")) ((ssget))))))
    ;;;Not first point selected... exit
    ((not (setq FstPnt (getpoint "\nFirst point of mirror axis: "))))
    ;;;Not second point (rubberband to first point) selected... exit
    ((not (setq NxtPnt (getpoint FstPnt "\nSecond point of mirror axis: "))))
    ;;;Else all informations given...
    (T
    ;;;Reset 'OSMODE' because 'command' use the actual 'OSMODE' settings
    (setvar "OSMODE" 0)
    ;;;(command IntlOverrideCmd PickSet Return FstPnt NxtPnt DeleteSource)
    (command "_.MIRROR" CurSet "" FstPnt NxtPnt "_NO")
    )
    )
    ;;;Set old 'OSMODE'
    (setvar "OSMODE" OldOsm)
    ;;;Supress return value
    (princ)
    )

    Cheers
     
    Jürg Menzi, May 2, 2004
    #4
  5. annymech

    Jürg Menzi Guest

    annymech... or whatever your name is

    The following sample shows you how to use 'MIRROR' in a LISP sequence:

    (defun C:MyMirror ( / CurSet FstPnt NxtPnt OldOsm) ;;;Localized variables
    ;;;Get 'OSMODE'
    (setq OldOsm (getvar "OSMODE"))
    ;;;Conditions:
    (cond
    ;;;Not ((Implied selection) OR (Select objects))... exit
    ((not (setq CurSet (cond ((ssget "I")) ((ssget))))))
    ;;;Not first point selected... exit
    ((not (setq FstPnt (getpoint "\nFirst point of mirror axis: "))))
    ;;;Not second point (rubberband to first point) selected... exit
    ((not (setq NxtPnt (getpoint FstPnt "\nSecond point of mirror axis: "))))
    ;;;Else all informations given...
    (T
    ;;;Reset 'OSMODE' because 'command' use the actual 'OSMODE' settings
    (setvar "OSMODE" 0)
    ;;;(command IntlOverrideCmd PickSet Return FstPnt NxtPnt DeleteSource)
    (command "_.MIRROR" CurSet "" FstPnt NxtPnt "_NO")
    )
    )
    ;;;Set old 'OSMODE'
    (setvar "OSMODE" OldOsm)
    ;;;Supress return value
    (princ)
    )

    Cheers
     
    Jürg Menzi, May 3, 2004
    #5
  6. annymech

    Juerg Menzi Guest

    annymech... or whatever your name is

    The following sample shows you how to use 'MIRROR' in a LISP sequence:

    (defun C:MyMirror ( / CurSet FstPnt NxtPnt OldOsm) ;;;Localized variables
    ;;;Get 'OSMODE'
    (setq OldOsm (getvar "OSMODE"))
    ;;;Conditions:
    (cond
    ;;;Not ((Implied selection) OR (Select objects))... exit
    ((not (setq CurSet (cond ((ssget "I")) ((ssget))))))
    ;;;Not first point selected... exit
    ((not (setq FstPnt (getpoint "\nFirst point of mirror axis: "))))
    ;;;Not second point (rubberband to first point) selected... exit
    ((not (setq NxtPnt (getpoint FstPnt "\nSecond point of mirror axis: "))))
    ;;;Else all informations given...
    (T
    ;;;Reset 'OSMODE' because 'command' use the actual 'OSMODE' settings
    (setvar "OSMODE" 0)
    ;;;(command IntlOverrideCmd PickSet Return FstPnt NxtPnt DeleteSource)
    (command "_.MIRROR" CurSet "" FstPnt NxtPnt "_NO")
    )
    )
    ;;;Set old 'OSMODE'
    (setvar "OSMODE" OldOsm)
    ;;;Supress return value
    (princ)
    )

    Cheers
     
    Juerg Menzi, May 3, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.