Dead simple but not reliable

Discussion in 'AutoCAD' started by Craig Colomb, Feb 18, 2005.

  1. Craig Colomb

    Craig Colomb Guest

    I have a short lisp routine to move along one coordinate axis only based
    on 2 points. Just like using move with point filters, just fewer
    clicks. Full routine is below.

    It works MOST of the time. It frequently fails, sometimes SS doesn't
    move at all, sometimes it moves but not along the correct axis. I
    cannot reliably reproduce the problem, it doesn't seem to be tied to
    current UCS, object types, or anything else. I'm stumped, I've tried
    every variation and possible cause I could dream up.

    Any Ideas??????

    (defun c:fx (/ ss ptso ptd ptre);Move along X axis only
    (setvar "cmdecho" 0)
    (setq ss (ssget))
    (setq ptso (getpoint "\n Select source point"))
    (setq ptre (getpoint "\n Select destination reference"))
    (setq ptd (list (car ptre) (cadr ptso) (caddr ptso)))
    (command ".move" ss "" ptso ptd)
    (setvar "cmdecho" 1)
    (princ)
    )

    (defun c:fz (/ ss ptso ptd ptre);MOve in Z direction
    (setvar "cmdecho" 0)
    (setq ss (ssget))
    (setq ptso (getpoint "\n Select source point"))
    (setq ptre (getpoint "\n Select destination reference"))
    (setq ptd (list (car ptso) (cadr ptso) (caddr ptre)))
    (command ".move" ss "" ptso ptd)
    (setvar "cmdecho" 1)
    (princ)
    )


    (defun c:fw (/ ss ptso ptd ptre);Move in Y only
    (setvar "cmdecho" 0)
    (setq ss (ssget))
    (setq ptso (getpoint "\n Select source point"))
    (setq ptre (getpoint "\n Select destination reference"))
    (setq ptd (list (car ptso) (cadr ptre) (caddr ptso)))
    (command ".move" ss "" ptso ptd)
    (setvar "cmdecho" 1)
    (princ)
    )


    PS, strange function name is to keep commands typable left hand only.
     
    Craig Colomb, Feb 18, 2005
    #1
  2. Craig Colomb

    Rad_Cadder Guest

    Just a thought, Check you osnaps when this happens, or set them to "0" in the routine and see if it happens anymore.
    Rob
     
    Rad_Cadder, Feb 18, 2005
    #2
  3. Craig Colomb

    OLD-CADaver Guest

    Check into the geomcal function for vector and magnitude shifts. The function below can be used like an osnap inside any command that needs a point. Maybe you can use the concept.

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun cvd ()
    (if (= cal nil)
    (arxload "geomcal")
    )
    (setq pt1 (getpoint "\n Select First Point Of Vector ")
    pt2 (getpoint "\n Select Second Point Of Vector ")
    dst (getdist "\nEnter Distance along Vector ")
    )
    (cal "pld(pt1,pt2,dst)")
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     
    OLD-CADaver, Feb 18, 2005
    #3
  4. Craig Colomb

    James Allen Guest

    Also watch out for orthomode and polar mode.
    --
    James Allen, EIT
    Malicoat-Winslow Engineers, P.C.
    Columbia, MO


    the routine and see if it happens anymore.
     
    James Allen, Feb 19, 2005
    #4
  5. Craig Colomb

    MP Guest

    try repacing
    with
    (command ".move" ss "" "_non" ptso "_non" ptd)
    (if you use command function in lisp that is generally recommended - to
    avoid current osnap settings)
    hth
    Mark
     
    MP, Feb 21, 2005
    #5
  6. Craig Colomb

    Craig Colomb Guest

    HAH!!!

    Right on Mark, that seems to be EXACTLY my problem. In retrospect Rob
    mentioned the same thing but it didn't make sense to me. Your taking
    the time to include the correct line of code was a great help.

    Thank you, Thank you, Thank you, Thank you, Thank you. I have been
    tearing my hair out for weeks trying for weeks to get this puppy to work
    correctly, haven't seen that osnaps concept mentioned anywhere in 2
    books or the online help (not that I have fully covered all of that
    material of course). Obviously a good principle to keep in mind in the
    future.

    Salut,

    cc
     
    Craig Colomb, Feb 26, 2005
    #6
  7. Craig Colomb

    Craig Colomb Guest

    HAH!!!

    Right on Mark, that seems to be EXACTLY my problem. In retrospect Rob
    mentioned the same thing but it didn't make sense to me. Your taking
    the time to include the correct line of code was a great help.

    Thank you, Thank you, Thank you, Thank you, Thank you. I have been
    tearing my hair out for weeks trying for weeks to get this puppy to work
    correctly, haven't seen that osnaps concept mentioned anywhere in 2
    books or the online help (not that I have fully covered all of that
    material of course). Obviously a good principle to keep in mind in the
    future.

    Salut,

    cc
     
    Craig Colomb, Feb 26, 2005
    #7
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.