Autolisp bug

Discussion in 'AutoCAD' started by Y. Gauthier, Dec 29, 2003.

  1. Y. Gauthier

    Y. Gauthier Guest

    Hi,

    I have a small autolisp program to replace a line by an arc.
    I first get p1 and p2 as the start and end points of the line.
    So far so good.
    Then I calculate the 3rd arc point as an offset of the mid-point of the line.

    I draw a small the arc directly, I get a message "Invalid point"
    (autocad thinks the three points are on the same line!)
    but I first "use" the mid-point, as with ins3 below, then the arc drawned
    is correct.

    [...]
    (progn
    ; draw the arc
    (setq p_ins (cal "plt(p1,p2,0.5)")
    p_norm (cal "p_ins + nor(p1,p_ins)*c_interf/-2")
    )
    (setq ins3 (list '(0 . "LINE")(cons 8 "DIM")(cons 10 p_norm)
    (cons 11 p_ins) ) )
    (entmake ins3)

    (command "ARC" p1 p_norm p2)

    )
    ; delete the line
    (entdel ent)
    [...]

    Why do I have to draw ins3?
    Why it doesnt not work if I comment the lines "(setq ins3 ..."
    and "(entmake ins3 ..."?

    Thanks for your insight

    Yves
     
    Y. Gauthier, Dec 29, 2003
    #1
  2. Without seeing the whole thing it's hard to say what's wrong, since we can't
    when and if your variables are defined correctly. Also you could be more
    specific about when you get the "Invalid point" prompt.
    Are you sure it's the second point?

    (I don't see why you have to entmake the line to do what you want. See point
    above.)
     
    Michael Bulatovich, Dec 29, 2003
    #2
  3. Y. Gauthier

    Y. Gauthier Guest

    Hi Michael,

    Thanks for answering...

    My mysterious bug doesnt appear anymore, and I have no idea
    why!
    No code change, the lisp function has been saved and loaded the dozen
    of times I saw the bug, etc.

    The only thing is that I restart my computer since last time...
    Should be that...

    BTW: how do you change your associated mail address to avoid spam,
    since we need to confirm by following the link supplied in a mail sent to the
    anti-spam mail address?

    Yves
     
    Y. Gauthier, Dec 30, 2003
    #3
  4. It's a setting in your email "client". In Outlook Express, its

    Tools>>Accounts>>News>>(pick each from the list )>>Properties>>there it is
    on the general tab.

    As for your lisp problem.....it could have been that a variable was not nil
    when the routine was expecting it to be...
    Do you follow the variables' values through the routine when you debug?
     
    Michael Bulatovich, Dec 30, 2003
    #4
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.