Beginner Question

Discussion in 'AutoCAD' started by rjt205, Sep 16, 2004.

  1. rjt205

    rjt205 Guest

    I am trying to teach myself some Autolisp, people who new it are now gone. what i need to do is pick 2 diagonal points and then draw a rectangle a set distance around it. No problem there, but the rectangle must be an integer. I've tried using FIX but with no luck. Any help would be greatly appreciated
     
    rjt205, Sep 16, 2004
    #1
  2. rjt205

    David Bethel Guest

    There are lots of ways to do that 1;


    (initget 1)
    (setq p1 (getpoint "\nFirst Corner: "))
    (initget 1)
    (setq p2 (getcorner p1 "\nOpposite Corner: "))
    (setq p1 (mapcar 'fix p1)
    p2 (mapcar 'fix p2))

    This always rounds down positives, rounds up negatives. If you need to
    round to the nearest point, then more code would be required. -David
     
    David Bethel, Sep 16, 2004
    #2
  3. rjt205

    pi Guest

    Just curious david,
    but why didnt his version of 'fix' work as opposed to yours; is he applying
    the fix on each line similar to the way mapcar is doing it?
    ta

    gone. what i need to do is pick 2 diagonal points and then draw a rectangle
    a set distance around it. No problem there, but the rectangle must be an
    integer. I've tried using FIX but with no luck. Any help would be greatly
    appreciated
     
    pi, Sep 17, 2004
    #3
  4. rjt205

    David Bethel Guest

    My guess would be that due to the fact he is obtaining L1 & W1 without
    changing the points to integers, his math is giving misleading results.

    As to the (fix), it is a matter of personal preference. I'm a little
    lazy as far as typing goes. Less is better. -David
     
    David Bethel, Sep 17, 2004
    #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.