See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Draw Rectangle, prompt for length and width, then extrude to chosen height

  1. #1
    Member
    Join Date
    2004-10
    Location
    austin, texas
    Posts
    34
    Login to Give a bone
    0

    Default Draw Rectangle, prompt for length and width, then extrude to chosen height

    can any one please make me a lisp to draw a rectangle.....i also want it to prompt me for length and width....and then extrude it and prompt me for a depth depth....

    please respond to my e-mail
    rico72dominguez@aol.com

  2. #2
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Draw Rectangle, prompt for length and width, then extrude to chosen height

    Code:
    (defun c:DrawExtRec ()
    
    (command "_.rectangle"
     pause
     (strcat
      "@"
      (rtos (getdist "\n Length of rectange (x direction): ") 2 6)
      ","
      (rtos (getdist "\n Width of rectange (y direction): ") 2 6)
     )
     "_.extrude"
     (entlast)
     ""
     (getdist "\n Thickness of rectangle: ")
     0
    )
    (princ)
    )

  3. #3
    Active Member
    Join Date
    2003-11
    Location
    YUL
    Posts
    75
    Login to Give a bone
    0

    Default Re: Draw Rectangle, prompt for length and width, then extrude to chosen height

    or...> 3dr <

    Code:
    (defun c:3dr (/ l w d ip)
      (setq l (getdist "\n Length?: ")
    	w (getdist "\n Width?: ")
    	d (getdist "\n Depth?: ")
    	ip (getpoint "\n Insert: "))
      (command "_.box" ip "l" l w d)
      (princ))
    Last edited by paulmcz; 2006-06-12 at 02:16 PM.

  4. #4
    Certifiable AUGI Addict robert.1.hall72202's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    Login to Give a bone
    0

    Default Re: Draw Rectangle, prompt for length and width, then extrude to chosen height

    Do you need AutoCad 2007 to get the box command?

    I have it

  5. #5
    Active Member
    Join Date
    2003-11
    Location
    YUL
    Posts
    75
    Login to Give a bone
    0

    Default Re: Draw Rectangle, prompt for length and width, then extrude to chosen height

    Quote Originally Posted by Robert.Hall
    Do you need AutoCad 2007 to get the box command?

    I have it
    Just AutoCAD, any version. It is built-in command.

  6. #6
    Member
    Join Date
    2004-10
    Location
    austin, texas
    Posts
    34
    Login to Give a bone
    0

    Default Re: Draw Rectangle, prompt for length and width, then extrude to chosen height

    you guys are awesome they work great

  7. #7
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    1

    Default Re: Draw Rectangle, prompt for length and width, then extrude to chosen height

    I prefer to keep all help here. In an email sent to me
    Code:
    how do i get your lisf file to default to 2.5 in the y and extrude to 3.5 
    automatically and then prompt the align after it draws the box??
    
    thanks for your help
    
    
    
    (defun c:DrawExtRec ()
    
    (command "_.rectangle"
     pause
     (strcat
      "@"
      (rtos (getdist "
     Length of rectange (x direction): ") 2 6)
      ","
      (rtos (getdist "
     Width of rectange (y direction): ") 2 6)
     )
     "_.extrude"
     (entlast)
     ""
     (getdist "
     Thickness of rectangle: ")
     0
    )
    (princ)
    )
    You would do it like this
    Code:
    (defun c:DrawExtRec ()
    
    (command "_.rectangle"
     pause
     (strcat
      "@"
      (rtos (getdist "\n Length of rectange (x direction): ") 2 6)
      ","
      (if (not (setq tmpDist (getdist \n Length of rectange (y direction) <2.5>: )))
       "2.5"
       (rtos tmpDist 2 6)
      )
     )
     "_.extrude"
     (entlast)
     ""
     3.5
     0
    )
    (princ)
    )
    Now for the align part, I'm not sure. I don't use the command, so maybe someone can help with that.

  8. #8
    Member
    Join Date
    2004-10
    Location
    austin, texas
    Posts
    34
    Login to Give a bone
    0

    Default Re: Draw Rectangle, prompt for length and width, then extrude to chosen height

    tim

    i keep getting an the following

    error: no function definition: Y

  9. #9
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Draw Rectangle, prompt for length and width, then extrude to chosen height

    Sorry about that. I forgot to add quotes around the question to getdist. This works for me now.
    Code:
    (defun c:DrawExtRec (/ tmpDist)
    
    (command "_.rectangle"
     pause
     (strcat
      "@"
      (rtos (getdist "\n Length of rectange (x direction): ") 2 6)
      ","
      (if (not (setq tmpDist (getdist "\n Length of rectange (y direction) <2.5>: ")))
       "2.5"
       (rtos tmpDist 2 6)
      )
     )
     "_.extrude"
     (entlast)
     ""
     3.5
     0
    )
    (princ)
    )

  10. #10
    Member
    Join Date
    2004-10
    Location
    austin, texas
    Posts
    34
    Login to Give a bone
    0

    Default Re: Draw Rectangle, prompt for length and width, then extrude to chosen height

    tim
    thanks that works great

Page 1 of 2 12 LastLast

Similar Threads

  1. Draw a Rectangle using the @ symbol
    By chad.beussink in forum AutoLISP
    Replies: 7
    Last Post: 2007-05-24, 01:03 PM
  2. Replies: 10
    Last Post: 2006-06-13, 09:44 PM
  3. Guide to help draw brick and block walls to the proper height & length
    By andrewp in forum CAD Management - General
    Replies: 7
    Last Post: 2005-12-12, 02:11 PM
  4. Pline Width to rectangle
    By cgerhardt in forum AutoLISP
    Replies: 2
    Last Post: 2005-12-01, 08:06 PM
  5. See the outline of a line or rectangle as you draw it
    By nanoaguilar2000 in forum AutoCAD General
    Replies: 2
    Last Post: 2005-03-31, 08:23 AM

Posting Permissions

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