+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Forum Newbie
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Mar 2012
    Posts
    7

    Default Create/ draw a rectangle from 4 lines with fixed length

    Registered forum members do not see this ad.

    Hello everyone!

    Can someone write a lisp that asks me for the length of four lines and then creates/draws a closed rectangle from that input?
    Other id

    Thanks in advance!

    Kind regards,
    Luis

  2. #2
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 7 Pro x64
    Computer:
    HP ZBook 17
    CPU:
    i7-4810MQ @ 2.80 GHZ
    RAM:
    16GB
    Graphics:
    Nvidia Quadro K4100M
    Primary Storage:
    256GB SSD
    Secondary Storage:
    1TB SATA
    Monitor:
    (2) HP 23"
    Discipline
    Civil
    rkmcswain's Discipline Details
    Discipline
    Civil
    Details
    CAD Manager
    Using
    Civil 3D 2017
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    4,455

    Default

    If it's a rectangle, then you only need the length of 2 of the sides, and this is already built into the RECTANGLE command.

    Run the RECTANGLE command, pick a start point, then enter "D" for dimensions, then enter the width and height.
    R.K. McSwain
    CAD Panacea | twitter

  3. #3
    Forum Newbie
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Mar 2012
    Posts
    7

    Default

    Thanks for your reply!
    I solved it myself with the use of contrains (Paramatric) + two lines wich stay parallel (see image). It was difficult for me to explain what I needed but this is sufficient!
    Sorry for the inconvenience!

    Kind regards,
    Luis

  4. #4
    Forum Newbie
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Mar 2012
    Posts
    7

    Default

    ...sorry but no image. It asks me to enter a url(?).

  5. #5
    Forum Deity steven-g's Avatar
    Computer Details
    steven-g's Computer Details
    Operating System:
    Win 7
    Discipline
    Construction
    steven-g's Discipline Details
    Occupation
    Draughtsman
    Discipline
    Construction
    Details
    I work in the estimating department of a large building contractor.
    Using
    AutoCAD 2017
    Join Date
    May 2013
    Location
    An Englishman in Belgium
    Posts
    2,059

    Default

    Quote Originally Posted by Luis Ternou View Post
    ...sorry but no image. It asks me to enter a url(?).
    I've never worked that one out myself ! I use attach file, (you first need to select "go advanced" and click on the paperclip icon which lets you pick a file from your computer and at the bottom of that dialogue is an option to "insert inline" which is how I always do it.
    Image 2.jpg

  6. #6
    Senior Member tmelancon's Avatar
    Computer Details
    tmelancon's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    Dell Optiplex 7010
    CPU:
    i3-3220 Processor (Quad Core, 3.30GHz)
    RAM:
    8GB
    Graphics:
    HD2500 Graphics
    Primary Storage:
    500GB
    Secondary Storage:
    2TB External Backup
    Monitor:
    Dual Dell 27" Monitors!!
    Discipline
    Multi-disciplinary
    tmelancon's Discipline Details
    Occupation
    CAD Operations/Design
    Discipline
    Multi-disciplinary
    Details
    CAD Design, CAD Management, Project Management, ISO Drawings, Pressure Vessels, Inspection Reports, Data Analysis, Work Scope Recommendations, Troubleshooting, and anything else the boss needs to maximize efficiency. Also proficient in Electrical Engineering/Lighting Design and LEED Green Energy
    Using
    AutoCAD 2015
    Join Date
    Jun 2013
    Posts
    327

    Default

    No response from the OP? I agree with rkmcswain. The REC command literally does exactly what he wants. Since a rectangle will always have 2 sides that are identical.

    rec·tan·gle
    ˈrekˌtaNGɡəl/
    noun
    noun: rectangle; plural noun: rectangles
    • a plane figure with four straight sides and four right angles, especially one with unequal adjacent sides, in contrast to a square.




    Run the REC command select first point. Type "D" for dimensions (this is your first length, and your second length). Once you specify your lengths hit <enter> then move your cursor and click when you have desired rotation.

    The only thing I can think of that OP would want is a LISP that runs the rec command normally but chooses the "dimension" option automatically and then clicks and sets the rectangle automatically then exits so user doesnt have to interact much with the keyboard during running. IDK just my 2 cents. We will never know unless they come back and clarify. Thanks
    It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt. -Abraham Lincoln

  7. #7
    Senior Member tmelancon's Avatar
    Computer Details
    tmelancon's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    Dell Optiplex 7010
    CPU:
    i3-3220 Processor (Quad Core, 3.30GHz)
    RAM:
    8GB
    Graphics:
    HD2500 Graphics
    Primary Storage:
    500GB
    Secondary Storage:
    2TB External Backup
    Monitor:
    Dual Dell 27" Monitors!!
    Discipline
    Multi-disciplinary
    tmelancon's Discipline Details
    Occupation
    CAD Operations/Design
    Discipline
    Multi-disciplinary
    Details
    CAD Design, CAD Management, Project Management, ISO Drawings, Pressure Vessels, Inspection Reports, Data Analysis, Work Scope Recommendations, Troubleshooting, and anything else the boss needs to maximize efficiency. Also proficient in Electrical Engineering/Lighting Design and LEED Green Energy
    Using
    AutoCAD 2015
    Join Date
    Jun 2013
    Posts
    327

    Default

    Possibly something like this.

    Code:
    (defun C:rectester(/ START LENGTH1 LENGTH2)
    (setq start (getpoint "\nSpecify starting point of rectangle..."))
    (setq length1 (getreal "\nSpecify first length..."))
    (setq length2 (getreal "\nSpecify second length..."))
    (command "_.rectang" start "D" length1 length2 start)
    (princ))
    It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt. -Abraham Lincoln

  8. #8
    Luminous Being RobDraw's Avatar
    Using
    MEP 2017
    Join Date
    Apr 2007
    Location
    Connecticut, USA
    Posts
    5,169

    Default

    Quote Originally Posted by tmelancon View Post
    No response from the OP?
    Please see post #3. A rectangle that behaves like a rectangle, not a polygon.
    Drafting is a breeze.

  9. #9
    Forum Newbie
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Mar 2012
    Posts
    7

    Default Here is the attachment!

    Sorry for my late response but many thanks so far! Here is the attachment.
    Attached Images

  10. #10
    Forum Newbie
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Mar 2012
    Posts
    7

    Default

    Registered forum members do not see this ad.

    ...and thanks steven-g for the how-to!

Similar Threads

  1. Replies: 26
    Last Post: 3rd Nov 2015, 01:17 pm
  2. Need Lisp : create rectangle between rectangle
    By git_thailand in forum AutoLISP, Visual LISP & DCL
    Replies: 25
    Last Post: 29th Apr 2012, 01:11 pm
  3. Need Lisp to create stock length with Lap length
    By rajeshmuthu in forum AutoLISP, Visual LISP & DCL
    Replies: 13
    Last Post: 2nd Oct 2011, 06:10 pm
  4. Trying to rotate a fixed length chord along an arc end to end
    By Hudson in forum AutoLISP, Visual LISP & DCL
    Replies: 22
    Last Post: 19th Jul 2011, 05:47 am
  5. how to modify a rectangle's width and length precisly??
    By KingTuT in forum AutoCAD Beginners' Area
    Replies: 5
    Last Post: 5th Mar 2006, 12:19 am

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