wrong out put when running auolisp program several times

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

  1. annymech

    annymech Guest

    hi everyone
    i've a serious problem
    i have constructed a lisp program , but the problem is that it runs perfectly in the first time only
    when i try to re run it either by entering the same inputs or by entering new inputs , the final drawing the program has to draw is always incorrect..
    plz help ... asap .
    thanks
     
    annymech, May 1, 2004
    #1
  2. annymech

    urugx Guest

    Why don't you post your lisp routine?
    Maybe someone might be able to help you.
     
    urugx, May 1, 2004
    #2
  3. annymech

    annymech Guest

    here is the program in case anyone would like to check it

    (defun c:ani (/ wid leng w l w1 w2 l1 l2 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20)
    (initget 7)

    (setq wid (getreal "\n Enter Width of Panel : "))
    (initget 7)

    (setq leng (getreal "\n Enter length of panel:"))
    (setq w ( + wid 30))
    (setq w1 ( - w 32))
    (setq w2 (- w 13))
    (setq l ( + leng 30))
    (setq l1 ( - l 32))
    (setq l2 (- l 19))
    (setq p1 '( 19 0)

    p2 '( 19 13)

    p3 '(32 13)
    p4 '(32 32)
    p5 '(0 32))
    (setq p6 (list (car p5) w1))
    (setq p7 (list (car p4) w1))
    (setq p8 (list (car p7) w2))
    (setq p9 (list (car p2) w2))
    (setq p10 (list (car p9) w))
    (setq p11 (list l2 w ))
    (setq p12 (list l2 (cadr p9)))
    (command ".line" p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 "")
    (setq p13 ( list l1 w2))
    (setq p14 (list l1 w1))
    (setq p15 (list l w1))
    (setq p16 (list l (cadr p5)))
    (setq p17 ( list l1 (cadr p16)))
    (setq p18 (list l1 (cadr p3)))
    (setq p19 (list l2 (cadr p18)))
    (setq p20 (list l2 (cadr p1)))
    (command ".line" p12 p13 p14 p15 p16 p17 p18 p19 p20 p1"")
    (setq e (getreal "\n Enter value of dimension E"))
    (setq f (getreal "\n Enter value of dimension F"))
    ( setq g (getreal "\n Enter value of dimension G"))
    (setq h (getreal "\n Enter value of dimension H"))
    (setq m (getreal "\n Enter value of dimension L"))
    (setq x 6)
    (setq y1 215)
    (setq y2 (- w 215))
    (setq c1 ( list x y1))
    (setq c2 (list x y2))
    (setq yy1 ( + 215 19.5 ))
    (setq yy2 ( - w 19.5 215 ))
    (setq rad 3)
    (setq rad2 2)
    (setq cc1 (list x yy1))
    (setq cc2 (list x yy2))
    (setq x1 ( - L 6))
    (setq c11 (list x1 y1))
    (setq cc11(list x1 yy1))
    (setq c22(list x1 y2))
    (SETQ CC22 (LIST x1 yy2))
    (command ".circle" c1 rad"")
    (command ".circle" c2 rad"")
    (command ".circle" cc1 rad2"")
    (command ".circle" cc2 rad2"")
    (command ".circle" c11 rad "")
    (command ".circle" cc11 rad2"")
    (command ".circle" c22 rad"")
    (command ".circle"cc22 rad2"")
    (princ )
    )
     
    annymech, May 1, 2004
    #3
  4. annymech

    bob.at Guest

    i dont have any problem with runnig this program.
    Maybe you've set osnap on? That sometimes leads to curiouse results.

    bob.at
     
    bob.at, May 1, 2004
    #4
  5. annymech

    annymech Guest

    thx for replying...

    the problem is that when i rerun the program
    it never gives the right drawing again
    sometimes it just draws a triangle !!!!!!!!
    have u tried to rerun it several times using different values for the inputs ???
    thanks for ur help ...
    plz reply soooooooon
    thanks again
     
    annymech, May 1, 2004
    #5
  6. I tried the program and it seemed to draw it shapes the same each time.
    Although I couldn't figure out what it is trying to draw.
    Please post examples of correct inputs for me to check.

    I noticed that the following variables are not local, although I couldn't
    see a reason that it would make any difference.
    e f g h m x y1 y2 c1 c2 yy1 yy2 rad rad2 cc1 cc2 x1 c11 cc11 c22 cc22

    Also, the following line(s) -
    (command ".circle" c1 rad"")
    should be replaced by
    (command ".circle" c1 rad)
    the extra "" caused an error in program, although it continues to run.
     
    Alan Henderson @ A'cad Solutions, May 1, 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.