Is it possible ?

Discussion in 'AutoCAD' started by Adesu, Jul 20, 2004.

  1. Adesu

    Adesu Guest

    Can anyone's help me,to solve my problem,I would create entity to become
    increase the value only ,"x" value ,this sample is
    (setq loc (getpoint "\nCLICK LOCATION FOR OBJECT)) >>> this set for 0,0
    and then value become entitys (0,0)(1,0)(2,0)(3,0)......etc.
    i want use with program loop (while).
     
    Adesu, Jul 20, 2004
    #1
  2. Adesu

    Paul Turvill Guest

    Sure. Each successive point becomes
    (setq loc (list (1+ (car loc))(cadr loc)))
    ___
     
    Paul Turvill, Jul 20, 2004
    #2
  3. Adesu

    Adesu Guest

    Hi Paul,I'm still getting problem to solve this loop,can you corrected
    it,thanks a lot

    (setq loc (getpoint "\nCLICK LOCATION FOR OBJECT: "))
    (setq loc1 0)
    (while (< loc1 10)
    (princ loc1)
    (setq loc1 (list (1+ (car loc))(cadr loc))))
    ) ; while
    (princ)
    (0.0 0.0 0.0)
    0
    0
    ; error: bad argument type for compare: (1.0 0.0) 10
     
    Adesu, Jul 20, 2004
    #3
  4. Adesu

    zeha Guest

    Adesu,

    you can not summon a real with a integer

    (setq loc (getpoint "\nCLICK LOCATION FOR OBJECT: "))
    (setq loc1 0.0); 0 --> 0.0 it's a counter must a real
    (while (< loc1 10)
    (princ loc1)
    (setq loc2 (list (+ loc1 (car loc))(cadr loc))
    loc1 (1+ loc1) ; counting up
    )
    )
     
    zeha, Jul 20, 2004
    #4
  5. Adesu

    MP Guest

    is this what you're after?

    (defun test()
    (setq loc (getpoint "\nCLICK LOCATION FOR OBJECT: "))
    (setq start-x(car loc))

    (terpri)
    (princ loc)
    (setq loc-x (car loc))

    (while (< (setq xdif (- loc-x start-x)) 10)
    (setq loc (list (1+ loc-x)(cadr loc)))
    (setq loc-x (car loc))
    (terpri)
    (princ loc)

    ) ; while
    (princ)
    )

    Command: (Test)

    CLICK LOCATION FOR OBJECT:
    (23.1772 19.8802 0.0)
    (24.1772 19.8802)
    (25.1772 19.8802)
    (26.1772 19.8802)
    (27.1772 19.8802)
    (28.1772 19.8802)
    (29.1772 19.8802)
    (30.1772 19.8802)
    (31.1772 19.8802)
    (32.1772 19.8802)
    (33.1772 19.8802)
     
    MP, Jul 20, 2004
    #5
  6. Adesu

    ECCAD Guest

    Change:
    (setq loc1 (list (1+ (car loc))(cadr loc))))
    To:
    (setq loc1 (list (+ (car loc) 1.0)(cadr loc))))

    Bob
     
    ECCAD, Jul 20, 2004
    #6
  7. Adesu

    zeha Guest

    Bob,

    In my opinion this won't work, because if (car loc) > then 10 it take one loop or if it's negative it takes many loops.
    it depent from the pick point.

    Cheers
     
    zeha, Jul 20, 2004
    #7
  8. Adesu

    ECCAD Guest

    Oh,
    You are correct. But you could add a (abs loc) in there.
    Bob
     
    ECCAD, Jul 20, 2004
    #8
  9. Adesu

    Adesu Guest

    Hi MP,thanks a lot,your program clear , simple and easy to understood.
     
    Adesu, Jul 21, 2004
    #9
  10. Adesu

    Paul Turvill Guest

    Not necessary:

    Command: (1+ 1)
    2
    Command: (1+ pi)
    4.14159
    Command: (1+ 12.345)
    13.345
    ___
     
    Paul Turvill, Jul 21, 2004
    #10
  11. Adesu

    MP Guest

    You're welcome
    :)
    Mark
     
    MP, Jul 21, 2004
    #11
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.