+ Reply to Thread
Page 1 of 5 1 2 3 ... LastLast
Results 1 to 10 of 44
  1. #1
    Full Member
    Discipline
    Electro/Mech
    RRS1987's Discipline Details
    Occupation
    draftmen
    Discipline
    Electro/Mech
    Using
    AutoCAD 2007
    Join Date
    Oct 2011
    Location
    india
    Posts
    60

    Default Lisp for rectangle

    Registered forum members do not see this ad.

    Dear All,
    I need a lisp to draw a Rectangle with in the 3 following inputs.
    These are the inputs,
    1.First center point of Rectangle.
    2.Second center point of Rectangle.
    3.Width of Rectangle.

    Please find attached the PDF file & help me

    Your concern must be appreciated.
    Thanks.
    Attached Files

  2. #2
    Forum Deity David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    2,067

    Default

    Maybe:

    Code:
    (defun c:rect3v (/ p1 p2 d1 c1 c2 c3 c4)
      (initget 1)
      (setq p1 (getpoint "\nCenter Of 1st Side:   "))
    
      (initget 1)
      (setq p2 (getpoint p1 "\nCenter Of 2nd Side:   "))
      (grdraw p1 p2 2 1)
    
      (initget 7)
      (setq d1 (getdist "\nOpposing Width: "))
    
      (setq c1 (polar p1 (+ (angle p1 p2) (* pi  0.5)) (* d1 0.5))
            c2 (polar p1 (+ (angle p1 p2) (* pi -0.5)) (* d1 0.5))
            c3 (polar p2 (+ (angle p2 p1) (* pi  0.5)) (* d1 0.5))
            c4 (polar p2 (+ (angle p2 p1) (* pi -0.5)) (* d1 0.5)))
    
      (entmake (list (cons 0 "3DFACE")
                     (cons 10 c1)(cons 11 c2)
                     (cons 12 c3)(cons 13 c4)))
      (prin1))
    I do wish AutoCad had never come up with the rectangle command. It never gave an option as to what type of entity was to be drawn. I've used a 3DFACE, cause I like 'em. LINEs SOLIDs TRACEs, POLYLINEs, LWPOLYINEs could all also be used. -David
    R12 (Dos) - A2K

  3. #3
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro 4000, 2GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2015
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    40,097

    Default

    Just when I think I've seen every every conceivable way to draw a rectangle someone comes up with a new request. I never knew drawing a rectangle could be so complicated. LOL
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

    I'm now a full member of the Society for the Promotion of Mediocrity in CAD. Standards? We don't need no stinkin' standards! Take whatever advice I offer and do the opposite.

  4. #4
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,640

    Default

    I was about to say the same thing, there's probably half a dozen request for rectangles during the past 2-3 weeks (exag really)

  5. #5
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro 4000, 2GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2015
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    40,097

    Default

    How do I draw a rectangle by selecting no corner or side points what-so-ever?
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

    I'm now a full member of the Society for the Promotion of Mediocrity in CAD. Standards? We don't need no stinkin' standards! Take whatever advice I offer and do the opposite.

  6. #6
    Forum Deity David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    2,067

    Default

    Actually the TRACE command would have worked just as well here. That's 1 reason I dislike the rectangle command so much. My $0.02 -David
    R12 (Dos) - A2K

  7. #7
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro 4000, 2GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2015
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    40,097

    Default

    No lisp routine for my request? I'm disappointed.

    Addendum

    No takers I see. Well the answer would be to use the polygon command to construct a square which is just a special type of rectangle. The definition of a rectangle is "a four sided polygon where all interior angles are 90 degrees". The other properties of a rectangle are: Opposite sides are parallel and congruent, Diagonals bisect each other, and Diagonals are congruent. The only real difference between a square and a rectangle is the length of the sides (in a square the lengths are all the same). Now, back to our square drawn using the Polygon command. It really only requires one pick (for the center) as all other inputs are via the command line.

    Command: _polygon Enter number of sides <4>: default

    Specify center of polygon or [Edge]: pick

    Enter an option [Inscribed in circle/Circumscribed about circle] <C>: default

    Specify radius of circle: 1

    Forgive me...slow morning today. Waiting on a safety meeting to start. Have a good one.
    Last edited by ReMark; 13th Oct 2011 at 12:31 pm.
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

    I'm now a full member of the Society for the Promotion of Mediocrity in CAD. Standards? We don't need no stinkin' standards! Take whatever advice I offer and do the opposite.

  8. #8
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,640

    Default

    OH, for a while there i thought you meant no screen input whatsoever, i was trying to find a way to place my rectangle onto the drawing without pick point.
    I had it where it would start from 0,0 and move using arrow keys, but the issue there is the increment, depending on the drawing it might take a loooooonnnggg time to get to where its supposed to go.

    Anyhooo..

  9. #9
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro 4000, 2GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2015
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    40,097

    Default

    Yeah, I'm looking at a way to do that too! Telekinesis perhaps?
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

    I'm now a full member of the Society for the Promotion of Mediocrity in CAD. Standards? We don't need no stinkin' standards! Take whatever advice I offer and do the opposite.

  10. #10
    Forum Deity David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    2,067

    Default

    Registered forum members do not see this ad.

    Elmer Fudd's Wandom Wectangle Wenerator:

    Code:
    (defun c:randrect (/ cd c1 c2 y1 y2)
       (setq cd (rtos (getvar "CDATE") 2 8)
             x1 (atof (substr cd 17 1))
             y1 (atof (substr cd 16 1))
             x2 (atof (substr cd 15 1))
             y2 (atof (substr cd 14 1)))
       (grdraw (list x1 y1) (list x2 y2) 2 3)
       (command "_.TRACE" 1.0 (list x1 y1 0) (list x2 y2 0) "")
       (prin1))
    R12 (Dos) - A2K

Similar Threads

  1. LISP for a rectangle inside a rectangle
    By Grigs in forum AutoLISP, Visual LISP & DCL
    Replies: 13
    Last Post: 5th Mar 2012, 07:11 pm
  2. need lisp for rectangle cross inside
    By git_thailand in forum AutoLISP, Visual LISP & DCL
    Replies: 10
    Last Post: 21st Oct 2011, 05:33 am
  3. Greating a lisp to get a rectangle and impotting a block in it
    By CadFrank in forum AutoLISP, Visual LISP & DCL
    Replies: 27
    Last Post: 28th Jul 2011, 08:02 am
  4. Rectangle drawing LISP – help needed
    By the-trooper in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 29th May 2009, 02:03 pm
  5. Need lisp to Align text to middle center of a box/rectangle?
    By Ste1978 in forum AutoLISP, Visual LISP & DCL
    Replies: 9
    Last Post: 21st Nov 2007, 03:56 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts