Perpendicular snap at a point

Discussion in 'AutoCAD' started by T.Willey, May 28, 2004.

  1. T.Willey

    T.Willey Guest

    I'm trying to be able to get a snap like perpendicular, but to a point. This works kinda, but when running osnap is set it won't grab the point that is passed, it only grabs what the running osnap is set to. I'm not sure how to get it to pass just the point.

    (defun c:AlignX(/ pt1 pt2 pt3 pt4 pt5 pt6)

    (setq pt1 (getvar "lastpoint"))
    (setq pt2 (getpoint "\nSelect aligning point: "))
    (setq pt3 (car pt2))
    (setq pt4 (cadr pt1))
    (setq pt5 (caddr pt1))
    (setq pt6 (list pt3 pt4 pt5))
    )

    ;==========================================================

    (defun c:AlignY(/ pt1 pt2 pt3 pt4 pt5 pt6)

    (setq pt1 (getvar "lastpoint"))
    (setq pt2 (getpoint "\nSelect aligning point: "))
    (setq pt3 (cadr pt2))
    (setq pt4 (car pt1))
    (setq pt5 (caddr pt1))
    (setq pt6 (list pt4 pt3 pt5))
    )


    Thanks....All help appreciated

    Tim
     
    T.Willey, May 28, 2004
    #1
  2. T.Willey

    ECCAD Guest

    Try:
    (defun c:AlignX(/ pt1 pt2 pt3 pt4 pt5 pt6)
    (setq old_osnap (getvar "OSMODE"))
    (setq pt1 (getvar "lastpoint"))
    (setq pt2 (getpoint "\nSelect aligning point: "))
    (setq pt3 (car pt2))
    (setq pt4 (cadr pt1))
    (setq pt5 (caddr pt1))
    (setq pt6 (list pt3 pt4 pt5))
    (setvar "OSMODE" old_osnap)
    )
    .........
    Bob
     
    ECCAD, May 28, 2004
    #2
  3. T.Willey

    T.Willey Guest

    (defun c:AlignX(/ pt1 pt2 pt3 pt4 pt5 pt6)

    (setq pt1 (getvar "lastpoint"))
    (setq os1 (getvar "osmode"))
    (setq pt2 (getpoint "\nSelect aligning point: "))
    (setvar "osmode" 0)
    (setq pt3 (car pt2))
    (setq pt4 (cadr pt1))
    (setq pt5 (caddr pt1))
    (setq pt6 (list pt3 pt4 pt5))
    (setvar "osmode" os1)
    )

    When I tried this it passed the old osnap settings. I'm pretty stumped.

    Tim
     
    T.Willey, May 28, 2004
    #3
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.