+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
  1. #1
    Junior Member
    Using
    AutoCAD 2009
    Join Date
    Jan 2009
    Posts
    18

    Default LISP for drawing Handrails

    Registered forum members do not see this ad.

    Hello everyone

    I have wanted to create some type of LISP for a long time now. Iv done 1000's of handrail drawing in the past few years, and expect to do many many more.

    These rails are 1.50 x 1.50 square tubing, 16ga wall, 304 stainless or Mild Steel. The standard height is 42" which should never change. There are only a few variables when drawing these. When you have a handrail that has more than just the end uprights, the center distance of uprights can be no larger than 42". When a handrail is short enough to not need intermediate uprights, the center distance can be no larger than 50".

    I have included a sample drawing of how I layout my rail drawing for the shop to fabricate. I have shown, a rail with multiple uprights and one short one that doesn't require intermediate uprights.

    I would love to have a LISP designed to have a dialog box pop up that ask for:

    Handrail Length: 4" - 240"
    Material: Stainless or Mild Steel

    Once criteria is entered, the LISP draws the handrail and then creates a cut list, like I have shown in my sample.

    Is it possible to dimension and place text with the same LISP program?

    Thanks for all the help everyone!

    AJ

    Here is the sample file I have put together as an example of how I draw my shop drawings.

    SAMPLE.dwg

  2. #2
    Super Member
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Posts
    863

    Default

    I'm sure this is doable in LISP, but I don't know how much effort it would be for the gurus. I can set up a fairly simple dynamic block to do most of what you want for the single handrail (see attachment). The multi-upright is probably just as doable for a dynamic block expert. I'm not an expert; more of a dabbler at this point.

    Handrail SAMPLE w Block.dwg

    For the material, my approach would be to shorten the text and add a right-justified attribute for Mild or Stainless. Since it would be the same for all pcs, two of the attributes could just have fields that adjust to the one input for the first.
    Last edited by neophoible; 3rd Jul 2013 at 08:25 pm. Reason: added comments about attributes for material
    When all you have is a hammer, everything looks like a nail.--

    “Doc, it hurts when I do this.” “Well, don’t do that!”

    “Well, if you don’t know, I’m certainly not going to tell you!”

  3. #3
    Super Member
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Posts
    863

    Default

    BTW, if you don't really need a full drawing, then the problem can be greatly simplified by having variables directly in the drawing for the multi-upright handrail. You just add breaks to show that there are more spaces than the couple shown and perhaps add a chart that is filled in (by a program, or by hand). We do a lot of this sort of thing for standard items that our shop builds regularly. This makes the programming easier, as there is nothing to draw, just dimensions (attributes, really) to fill in.
    When all you have is a hammer, everything looks like a nail.--

    “Doc, it hurts when I do this.” “Well, don’t do that!”

    “Well, if you don’t know, I’m certainly not going to tell you!”

  4. #4
    Junior Member
    Using
    AutoCAD 2009
    Join Date
    Jan 2009
    Posts
    18

    Default

    That method works pretty good. Just would need a bit of fine tuning. Just visual stuff really, such as: Keeping text centered under the cut tubes. Now if we could just get the multiple upright to work in the dynamic block. Iv never been real good at this dynamic block stuff, my school didn't teach us much in that area.

    Thanks for the help man

    Hopefully you sparked an idea in someones head to maybe figure it out!

    AJ

  5. #5
    Junior Member
    Using
    AutoCAD 2009
    Join Date
    Jan 2009
    Posts
    18

    Default

    Quote Originally Posted by neophoible View Post
    BTW, if you don't really need a full drawing, then the problem can be greatly simplified by having variables directly in the drawing for the multi-upright handrail. You just add breaks to show that there are more spaces than the couple shown and perhaps add a chart that is filled in (by a program, or by hand). We do a lot of this sort of thing for standard items that our shop builds regularly. This makes the programming easier, as there is nothing to draw, just dimensions (attributes, really) to fill in.
    This would be a much easier approach to making these drawings. We still would like to keep full size/fully drawn handrail drawings, its just easier for us to use for future references when a dimension needs to be pulled for a welder or whatever other reason may come up.

    Thanks again for helping me out!

    AJ

  6. #6
    Super Member
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Posts
    863

    Default

    Quote Originally Posted by TenSecond408 View Post
    This would be a much easier approach to making these drawings. We still would like to keep full size/fully drawn handrail drawings, its just easier for us to use for future references when a dimension needs to be pulled for a welder or whatever other reason may come up.

    Thanks again for helping me out!

    AJ
    Understood. We have such issues sometimes as well, and in those cases we usually have a program that will draw out the item so we can CAD measure it. But now it's clear you need what you're asking for. One thing that does come into play is the tolerance. What is the tolerance (or fuzz dimension) for going from one size to the next? In other words, you won't worry about adding an upright if the center distance were 42.001, would you? But you would have to go to the next one if it is over by a certain fraction of an inch., say 1/16", right? And is the cutoff at 51.500 exactly? Or perhaps also up to, say 1/16" over that?
    When all you have is a hammer, everything looks like a nail.--

    “Doc, it hurts when I do this.” “Well, don’t do that!”

    “Well, if you don’t know, I’m certainly not going to tell you!”

  7. #7
    Junior Member
    Using
    AutoCAD 2009
    Join Date
    Jan 2009
    Posts
    18

    Default

    Quote Originally Posted by neophoible View Post
    Understood. We have such issues sometimes as well, and in those cases we usually have a program that will draw out the item so we can CAD measure it. But now it's clear you need what you're asking for. One thing that does come into play is the tolerance. What is the tolerance (or fuzz dimension) for going from one size to the next? In other words, you won't worry about adding an upright if the center distance were 42.001, would you? But you would have to go to the next one if it is over by a certain fraction of an inch., say 1/16", right? And is the cutoff at 51.500 exactly? Or perhaps also up to, say 1/16" over that?
    There isnt really any science for us on this. It would work just fine if we said their is no tolerance that needs to be considered. On the multiple uprights anything >42" centers will need a new upright and on a short rail anything >50" will need a new upright.

    Im messing around with trying to setup a dynamic block like you just did for the short rail, pretty complicated

    Thanks

    AJ

  8. #8
    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,055

    Default

    As a 'just cause' and to show how complicated an undertaking like this can be, here is a command line approach that uses the TRACE command that constructs the tubes :

    Code:
    (defun c:hrail (/ x y z q dy h m xx xs xp dq hz i
                     fl cl tl ul ml)
    
    (while (or (not x)
               (not (< 4 x 240)))
           (initget 7)
           (setq x (getdist "\nOverall Width S-S ( 4-240 ):   ")))
    
    (initget 6)
    (setq y (getdist "\nHeight T-B <42>:   "))
    (or y (setq y 42.))
    
    (initget 6)
    (setq z (getdist "\nTube Size <1.5>:   "))
    (or z (setq z 1.5))
    
    (setq dq (cond ((<= x 50) 0)
                   (T
                    (fix (/ x 42)))))
    (initget 4)
    (setq q (getint (strcat "\nMiddle Upright Qty <" (itoa dq) ">:   ")))
    (or q (setq q dq))
    
    (setq dy (* (- y z) 0.5))
    (setq h (getdist (strcat "\nMid Rail Height <" (rtos dy 2 2) ">:   ")))
    (or h (setq h dy))
    
    (initget 1 "Mild Stainless")
    (setq m (getkword "\nMaterial - Mild/Stainless:   "))
    
    ;;;HALF TUBE
    (setq hz (* z 0.5))
    
    ;;;UPRIGHT SPACING
    (setq xx (- x z)
          xs (/ xx (1+ q))
          xp hz)
    
    ;;;CENTER LINE LIST
    (setq cl (list hz))
    (repeat q
     (setq cl (cons (+ xp xs) cl)
           xp (+ xp xs)))
    (setq cl (cons (- x hz) cl))
    (setq cl (reverse cl))
    
    ;;;MAIN FRAME LIST
    (setq fl (list (list (car cl)        0  0)
                   (list (car cl)  (- y hz) 0)
                   (list (last cl) (- y hz) 0)
                   (list (last cl)       0  0)))
    ;;;UPRIGHT LIST
    (setq i 1)
    (repeat q
      (setq ul (cons (list (list (nth i cl) 0 0)
                           (list (nth i cl) (- y z) 0)) ul))
      (setq i (1+ i)))
    
    ;;;MID SUPPORTS
    (setq tl cl)
    (while (> (length tl) 1)
      (setq ml (cons (list (list (+ (car tl) hz) h 0)
                           (list (- (cadr tl) hz) h 0)) ml))
      (setq tl (cdr tl)))
    
    (setvar "CMDECHO" 1)
    (setvar "TRACEWID" z)
    (setvar "THICKNESS" z)
    (setvar "SNAPMODE" 0)
    (command "_.UCS" "_W")
    
    (command "_.TRACE" "")
    (foreach v fl (command v))
    (command "")
    
    (foreach v ml
      (command "_.TRACE" "")
      (command (car v))
      (command (cadr v))
      (command ""))
    
    (foreach v ul
      (command "_.TRACE" "")
      (command (car v))
      (command (cadr v))
      (command ""))
    
    (prin1))

    The parts list is very doable but even a lot more complex.

    -David
    R12 (Dos) - A2K

  9. #9
    Senior Member LibertyOne's Avatar
    Using
    AutoCAD 2010
    Join Date
    Apr 2011
    Location
    Germany
    Posts
    172

    Default

    What if the handrail is longer than the material being supplied? Where do you splice? Or do you have limits on the length or weight of the handrails? (for transport) And do you need base plates for anchoring the hand rail to the ground or floor?

  10. #10
    Super Member
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Posts
    863

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by LibertyOne View Post
    What if the handrail is longer than the material being supplied? Where do you splice? Or do you have limits on the length or weight of the handrails? (for transport) And do you need base plates for anchoring the hand rail to the ground or floor?
    He mentioned a max of 20' long, typical for USA, with no splice needed. I was curious about there being no kickplate, but guessed it must be mounted to the floor.
    When all you have is a hammer, everything looks like a nail.--

    “Doc, it hurts when I do this.” “Well, don’t do that!”

    “Well, if you don’t know, I’m certainly not going to tell you!”

Similar Threads

  1. Lisp for drawing polylines
    By elfert in forum AutoLISP, Visual LISP & DCL
    Replies: 22
    Last Post: 27th Nov 2012, 12:05 am
  2. Parsing out drawing name using LISP - please help
    By Kevin S in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 15th May 2012, 01:53 pm
  3. I need a LISP that will ask me for a layer before drawing ANYTHING
    By neeboy in forum AutoLISP, Visual LISP & DCL
    Replies: 14
    Last Post: 19th Oct 2010, 05:29 pm
  4. How to open a drawing in lisp/vba
    By DAMO in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 16th Jul 2010, 04:13 pm
  5. Multiple Drawing Lisp
    By nauggie in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 23rd Jul 2009, 12:51 pm

Tags for this Thread

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