Results 1 to 7 of 7

Thread: AutoLISP for automatically drawing second dimension of rectangle based on first dimension

  1. #1
    Member
    Join Date
    2008-12
    Posts
    3
    Login to Give a bone
    0

    Default AutoLISP for automatically drawing second dimension of rectangle based on first dimension

    Good morning group,
    I am trying to write a LISP routine that will generate a rectangle based on the first input dimension always with the proportion of 1:1.618. If anyone can help I would certainly appreciate it.

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,713
    Login to Give a bone
    0

    Default Re: AutoLISP for automatically drawing second dimension of rectangle based on first dimension

    Try this:

    Code:
    (defun c:SREC ( / pt h)
      (princ "SPECIAL RECTANGLE ")
      (if (and (setq pt (getpoint "\nSpecify rectangle start point: "))
               (setq h (getreal "\nEnter the rectangle length: ")))
        (command "._rectang" pt "_dimensions" (* 1.618 h) h pt)
        (prompt "\n** Invalid input ** "))
      (princ))
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    Member
    Join Date
    2008-12
    Posts
    3
    Login to Give a bone
    0

    Default Re: AutoLISP for automatically drawing second dimension of rectangle based on first dimension

    Renderman...worked perfectly..Thank you very much for the code....will certainly help in design process.

    Cheers,


    Richard

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,713
    Login to Give a bone
    0

    Default Re: AutoLISP for automatically drawing second dimension of rectangle based on first dimension

    Quote Originally Posted by rjperkin View Post
    Renderman...worked perfectly..Thank you very much for the code....will certainly help in design process.
    You're welcome, Richard.

    Cheers!
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: AutoLISP for automatically drawing second dimension of rectangle based on first dimension

    You probably wanted golden number fi...
    To be more precise :

    Code:
    (defun c:GREC ( / pt h fi)
      (princ "GOLDEN RECTANGLE ")
      (if (and (setq pt (getpoint "\nSpecify rectangle start point: "))
               (setq h (getdist pt "\nEnter the rectangle length: "))
               (setq fi (/ (+ (sqrt 5) 1) 2)))
        (command "._rectang" pt "_dimensions" (* fi h) h pt)
        (prompt "\n** Invalid input ** "))
      (princ))
    M.R.

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,713
    Login to Give a bone
    0

    Default Re: AutoLISP for automatically drawing second dimension of rectangle based on first dimension

    Quote Originally Posted by marko_ribar View Post
    You probably wanted golden number fi...
    To be more precise :

    Code:
    (defun c:GREC ( / pt h fi)
      (princ "GOLDEN RECTANGLE ")
      (if (and (setq pt (getpoint "\nSpecify rectangle start point: "))
               (setq h (getdist pt "\nEnter the rectangle length: "))
               (setq fi (/ (+ (sqrt 5) 1) 2)))
        (command "._rectang" pt "_dimensions" (* fi h) h pt)
        (prompt "\n** Invalid input ** "))
      (princ))
    M.R.
    Yes, I believe you are correct MR - I should have caught that given the explicit number requested.

    Phi = fi LoL

    I :heart: Quadratic Equations.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  7. #7
    Member
    Join Date
    2008-12
    Posts
    3
    Login to Give a bone
    0

    Default Re: AutoLISP for automatically drawing second dimension of rectangle based on first dimension

    Gentlemen,

    Yes, Golden Rectangle is what I was looking for. Did not know how to code it as I am only standing by the ocean of Visual Basic and watching the AutoLISP routines go by!

    Thanks again to you both,

    Richard

Similar Threads

  1. Dimension multiple lines automatically
    By cormac.mcgavigan516711 in forum AutoLISP
    Replies: 3
    Last Post: 2011-12-06, 12:58 PM
  2. dimension scale is automatically overridden
    By lcarignan in forum AutoCAD General
    Replies: 10
    Last Post: 2008-09-19, 09:43 PM
  3. Automatically calculate each room dimension in schedule
    By bradylady in forum AutoCAD Customization
    Replies: 4
    Last Post: 2007-11-21, 02:05 PM
  4. Replies: 9
    Last Post: 2006-07-29, 07:48 AM
  5. Dimension Text Override with Autolisp
    By CADdancer in forum AutoLISP
    Replies: 3
    Last Post: 2005-07-12, 05:33 PM

Tags for this Thread

Posting Permissions

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