Draw rectangle, pick center point

Discussion in 'AutoCAD' started by Casey, Jul 7, 2004.

  1. Casey

    Casey Guest

    Does anyone have a routine that will draw a rectangle by picking the center
    point and then entering x and y distances.

    I'm a beginning lisp'er and was about to write one myself but thought I
    would check and see if I was reinventing the wheel.

    Thanks,


    Casey
     
    Casey, Jul 7, 2004
    #1
  2. Casey

    Tim Guest

    Yes I have 1 that does exactly that, unfortunately I don't have access to
    the routine at this time...I can post it here this evening unless somebody
    else has 1 that they will post for you earlier than that..

    Tim W.
     
    Tim, Jul 7, 2004
    #2
  3. Casey

    OLD-CADaver Guest

    The following was written some 15 years ago, but still works in R2002.


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun C:RCC ()
    (setq wide (getdist "\nEnter Rectangle X Dimension ? :")
    high (getdist "\nEnter Rectangle Y Dimension ? :")
    ptc (GETPOINT "\nPick Center Of Rectangle : ")
    hwide (/ wide 2.0)
    hhigh (/ high 2.0)
    ptll (list (- (car ptc) hwide) (- (cadr ptc) hhigh))
    ptur (list (+ (car ptll) wide) (+ (cadr ptll) high))
    )
    (setvar "plinewid" 0.0)
    (command ".PLINE" ptll "W" "0" "0" ".X" ptur ".Y" ptll ptur ".X" ptll ".Y" ptur "C")
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     
    OLD-CADaver, Jul 7, 2004
    #3
  4. Casey

    Casey Guest

    Hey thanks,

    With the addition of turning off osnaps at the correct point, this routine
    works great.

    Casey
     
    Casey, Jul 7, 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.