getpoint problem with otrack

Discussion in 'AutoCAD' started by amjarch, Sep 17, 2004.

  1. amjarch

    amjarch Guest

    I am fairly new to AutoLISP but i am picking it pretty quickly. I have my share of problems but this one i can't figure. Here is the section of the lisp that keeps mucking up:

    ;------------------------
    ; INSERT DOORS
    ;------------------------
    (defun c:jdoor (/ clayer frstln ent pnt0 pnt1 pnt2)
    (setq c_layer (getvar "clayer")
    )
    (setvar "coords" 2)
    (if (not (tblsearch "layer" "A-DO-SWG"))
    (command "layer" "m" "A-DO-SWG" "c" "27" "" "")
    )
    (if (not (tblsearch "layer" "A-DO"))
    (command "layer" "m" "A-DO" "c" "5" "" "")
    )
    (setq frstln (entget(car(nentsel "\nSelect swing side of wall to insert door into:")))
    ent (cdr(assoc -1 frstln))
    )
    (setvar "clayer" (cdr(assoc 8 frstln)))
    (command "._ucs" "_ob" ent)
    (setq pnt0 (getpoint "\nInsertion point - hinge point)?")
    pnt1 (getpoint pnt0 "\nDirection of swing?")
    pnt2 (getpoint pnt0 "\nDirection of opening?")
    )
    (command "._ucs" "_3" pnt0 pnt1 pnt2)
    (princ)
    )
    ;------------------------------------------

    The problem is that when I am picking "pnt0" during the routine the ucs is rotated so that I can take advantage of the otrack to set the point, say 1'-0" away from the adjacent wall. When I do this though the point that gets stored in "pnt0" is the origin of the otracking (the intersection of two lines in this case) not the desired point. Then, when the routine is setting up the ucs, via the 3 point method, with those points everything is obviously wrong. Is this typical or am I just doing this wrong.

    Thanks,
    Drew
     
    amjarch, Sep 17, 2004
    #1
  2. amjarch

    amjarch Guest

    Forgot to mention...this works fine if i am not tracking to the insertion point. if i am inserting at, say, the mid point it works like a charm.

    Thanks,
    Drew
     
    amjarch, Sep 17, 2004
    #2
  3. amjarch

    amjarch Guest

    One more thing, sorry to all. When the second ucs change takes place with the wrong "pnt0" it only works (by works i mean finish the routine) if the first assigned ucs origin--the 0,0,0 point---is in the visible area of the screen. If it is not on the screen i get some message about the points are coplainer and i need to maually put in the y axis or direction by hand.

    what is going on here that i am missing?

    Thanks again and again,
    DRew
     
    amjarch, Sep 17, 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.