Jump to content

Lisp to create a beadboard pattern


ADSK2007

Recommended Posts

Hello

 

I need to know if it's possible to draw a beadboard pattern with lisp routine (You can quickly Google the name to see what I mean). The large pieces (let's call it "A") are always the same size and the gaps between them (Let's call it "B") are also the same size. What the program should ask for is the total length, then the size for "A" and how many pcs are required, then calculate the "B" size in-between

 

Could anyone help with this?

 

Regards

Link to comment
Share on other sites

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • ADSK2007

    10

  • ReMark

    5

  • pBe

    5

  • Bill Tillman

    2

Top Posters In This Topic

Posted Images

Sorry, what I forgot to mention is;

The lisp should only create a line with nodes for the divisions - the quickest way I can explain this is below

 

._______. ._______. ._______. ._______. ._______. ._______.

 

Program ask for total length, length of the line and how many lines to draw inside the given total length, then calculate the space between the dots up to 64th of scale

Link to comment
Share on other sites

Hello again

 

I was wondering if this can be accomplished by lisp. It is a very useful function for Cad detailers, especially when to draw columns with equal spacing in-between

 

Thank you in advance

 

Adsk2007

Link to comment
Share on other sites

Something seems a bit off. You want a beadboard pattern to draw columns not beadboard? Then you go on to say you want to draw columns with equal spacing in-between. This last part begs the question, why not use the ARRAY command?

Link to comment
Share on other sites

Hello again

I was wondering if this can be accomplished by lisp. It is a very useful function for Cad detailers, especially when to draw columns with equal spacing in-between

 

Yes it can be accomplish by lisp. Tell you what. post a drawing file that shows the beadboard pattern with a given Total length and division on where the nodes are :

Length:

Number of lines:

And the 64th scale you refer to... [dont know what that means]

 

Like what remark said, as it stands now,your request is very confusing :)

Link to comment
Share on other sites

beadboard.jpg Hello again

 

Thank you for your replies and my apology for not making it clear. The column was just an example of how useful this routine could be for people doing architechtural detailing and millwork detailing. attached is a sample for you to see

Link to comment
Share on other sites

If the individual beadboard slats are the same size and the gaps the same size then I don't see why you aren't using the ARRAY command. If you have too many boards for the length the last one is going to be trimmed anyway.

Link to comment
Share on other sites

Hi Remark

 

Problem with array command is that it does the opposite of what we need. it won't ask you what is the total length, and won't give us the spacing in between - so you have to have an object drawn and array it with given length and quantity.

we have to do try and error so many times to get it right and that is not time consuming

Link to comment
Share on other sites

You can't figure out how many slats you're going to need in a given length? You should be able to get within one slat (plus or minus) of what you need using simple math.

 

The spacing between slats would be incorporated in the distance between objects which AutoCAD does prompt the user for.

Link to comment
Share on other sites

If the individual beadboard slats are the same size and the gaps the same size then I don't see why you aren't using the ARRAY command. If you have too many boards for the length the last one is going to be trimmed anyway.

 

Its easy with math.

(defun _board (total bw)
     (setq qnty (fix (/ total bw)))
     (setq gap (/ (- total (* qnty 6)) (1- qnty))))

 

There you get the gap size, then you can do array/copy or what not.

Link to comment
Share on other sites

Let's say I am applying beadboard on all rooms of an office building - I have the perimeter of all rooms 465'-11 3/8" and I know my board is 3.658 in width. now I know I can calculate this with a simple math to find out the desired spacing but don't you think a simple lisp will save some time and give me the answers right away? After all is lisp suppose to make your life easy? And what if I am dealing with feet and 64th on inch spacing? I still think lisp beats the timing - correct me if I am wrong.

 

Anyway, thank you both for your answers, you guys always been helpful and I appreciate your answers

Link to comment
Share on other sites

Remark

 

Yes, this was the whole point of having a lisp so there are no cutting of ends. we would like to have all boards the same size, only the spacing in between changes.

 

Thanks

Link to comment
Share on other sites

Really? You adjust the spacing between the slats to avoid cutting the boards? And that works as you go around a room and encounter door openings and other such obstacles? And the client doesn't pick up on the fact that the spacing might be different? I never knew that. All the beadboard in my Victorian house has the exact same spacing between slats. It even appears that the person that did it started in one corner with a full slat and worked his way clockwise around the room. When he came to a corner where a board had to be cut the remaining piece went on the next wall perpendicular to the first piece.

Link to comment
Share on other sites

oh, I see what you mean - no, I didn't mean for each wall you will have different spacing, all spacing will be equal through out all rooms - this is why I mentioned "total length" and by that I meant total length of all rooms -

I was hoping to draw a continuous closed pline going from room to room and back to where I started

 

Now the routine could ask me for total length or pick an object with starting point, then ask me for the board length and the quantity I may need - this way I select the closed pline as my total length, then I give the length of the board and finally quantity - If you take a look at the first post, I did mention, it would be good if the routine could actually place nodes on the object to indicate the spacing in between - I do remember Lee had a routine where you could select a pline and divide it into equal segments. He had this nice feature to insert points on the pline - once I saw that lisp I thought what if the routine could have 2 different spacing in such way that one dimension rule the other dimension once the total length and quantity is given.

 

Regards

Link to comment
Share on other sites

Demo code

 

(defun c:demo ()
(setvar 'osmode 512);-- nearest osnap
(setq wall1 (getpoint "\nPick start point"));<-- point at wall
(setvar 'osmode 128);-- perpendicular osnap
(setq wall2 (getpoint wall1 "\nPick next point"));<-- point at opposite wall
(setq dist (distance wall1 wall2))
(setq qnty (fix (/ dist 6)));<-- board width
(setq gap (/ (- dist (* qnty 6)) (1- qnty)));<-- gap width
(setvar 'osmode 0)
(command "_line" wall1 (polar wall1 0 6) "")
(command "_-array" (entlast) "" "_Rectangular" "1" qnty (+ gap 6))
     (princ)
)

 

Unless theres a minumum gap.

Link to comment
Share on other sites

pBe

 

Your routine is working beautifully - (only one small favour)

at the moment, the routine is not asking for anything except first point and end point. It seems it decides the length for me. Is it possible you modify the code in such way that after input the end point, it ask me for length of board, then quantity (how many board do I want to fit and if I enter more than the total length then it rejects and ask for entering another number?

 

At the moment all is done with a fix board width.

 

Thank you for your help

Link to comment
Share on other sites

This isn't the cleanest or my neatest effort at o.c. spacing tasks, but with a little tweaking this could take you where you want to go. I can see that you could actually ask the user to fence around the area they want to cover with this pattern. I would think one could invent a hatch or a dynamic block which could do the same thing.

 

(defun C:bb (/ beadspace count height numboards ocspace width)
 (setq pt1     '(0.0 0.0)
       a90     (dtr 90.0)
       a270    (dtr 270.0)
       height  60
       width   72
       ocspace 6.
 ) ;_ end of setq
 (setq numboards (fix (/ width ocspace)))
 (if (= (rem width ocspace) 0)
   (setq numboards (1- numboards))
   ); end if
 (setq beadspace (/ (- width (* numboards ocspace)) (1- numboards)))
 (command "._LINE" pt1 (polar pt1 a270 height) "")
 (repeat (1- numboards)
   (command "._OFFSET" ocspace (entlast) (polar pt1 0 (+ width 2)) "")
   (command "._OFFSET" beadspace (entlast) (polar pt1 0 (+ width 2)) "")
   ); end repeat
 (command "._OFFSET" ocspace (entlast) (polar pt1 0 (+ width 2)) "")
)

(defun dtr (x) (* pi (/ x 180.0))) ; end dtr function

 

Now if I could just learn Lee-Mac's trick for getting this code all formatted with colors, etc...oops, I see now that others have replied ahead of me. It just goes to show you there's always someone out there smarter than yourself.

Link to comment
Share on other sites

Really? You adjust the spacing between the slats to avoid cutting the boards? And that works as you go around a room and encounter door openings and other such obstacles? And the client doesn't pick up on the fact that the spacing might be different? I never knew that. All the beadboard in my Victorian house has the exact same spacing between slats. It even appears that the person that did it started in one corner with a full slat and worked his way clockwise around the room. When he came to a corner where a board had to be cut the remaining piece went on the next wall perpendicular to the first piece.

 

Dude, you're looking at from the guy in the field perspective. It is an unwritten rule that detailers always draw to the nat's arse when detailing and let the guys in the field deal with things like windows, out of square, out of plumb, overshot elevations, uneven floors, etc... That's the luxury of being a detailer. And you can complain about the guys out in the field without them hearing you... :)

 

I do lots of code like this for o.c. spacing of structural members. In my work the oc space is the variable and the bead board would be the fixed dimension...usually the width across the flange of a channel or I-beam. Different layout but same principal. What I am asked to do is to space everything evenly and let the two spaces on the end run wild, but congruent to each other. It's cool to see how this kind of stuff works with things like metal grating or anything that a matrix can be applied to.

Link to comment
Share on other sites

pBe

 

Your routine is working beautifully - (only one small favour)

at the moment, the routine is not asking for anything except first point and end point. It seems it decides the length for me. Is it possible you modify the code in such way that after input the end point, it ask me for length of board, then quantity (how many board do I want to fit and if I enter more than the total length then it rejects and ask for entering another number?

 

At the moment all is done with a fix board width.

 

Thank you for your help

 

Quick and dirty code..

 

(defun c:demo  (/ os p1 p2 gap dist ang quantity board boardsize)
     (setq os (getvar 'osmode))
     (setvar 'osmode 512)
     (setq gap nil
           p1  (getpoint "\nPick start point"))
     (setvar 'osmode 128)
     (setq p2 (getpoint p1 "\nPick next point"))
     (setq dist (distance p1 p2)
           ang  (Angle p1 p2))
     (while (and (null gap)
                 (setq boardsize (getdist "\nEnter Board size: "))
                 (setq quantity
                            (getint "\nEnter Number of boards: ")))
           (if (<= quantity (fix (/ dist boardsize)))
                 (setq gap (/ (- dist (* quantity boardsize))
                              (1- quantity)))
                 (princ
                       "\nTotal number of boards more than total length"))
           )
     (setvar 'osmode 0)
     (command
           "_line"
           p1
           (setq p2 (polar p1 ang boardsize))
           "")
     (setq p2 (polar p2 ang gap))
     (repeat (1- quantity)
           (command "_copy" (entlast) "" p1 p2)
           )
     (setvar 'osmode os)
     (princ)
     )

 

(defun c:demol  (/ os p1 p2 gap dist ang quantity board boardsize)
     (setq os (getvar 'osmode))
     (setvar 'osmode 512)
     (setq gap nil
           p1  (getpoint "\nPick start point"))
     (setvar 'osmode 128)
     (setq p2 (getpoint p1 "\nPick next point"))
     (setq dist (distance p1 p2)
           ang  (Angle p1 p2))
     (while (and (null gap)
                 (setq boardsize (getdist "\nEnter Board size:"))
                 (setq quantity
                            (getint "\nEnter Number of boards:")))
           (if (<= quantity (fix (/ dist boardsize)))
                 (setq gap (/ (- dist (* quantity boardsize))
                              (1- quantity)))
                 (princ
                       "\nTotal number of boards more than total length"))
           )
     (setvar 'osmode 0)
     (setq selset (ssadd))
     (command "_Xline" "_Ang" (/ (* (+ ang (/ pi 2.0)) 180.0) pi)
           (setq p2 (polar p1 ang boardsize)) "")
     (ssadd (entlast) selset)
     (command "_copy" (entlast) "" p2 (setq p2 (polar p2 ang gap)))
     (ssadd (entlast) selset)
     (setq dist (+ boardsize gap) d dist)
     (repeat (1- quantity)
           (command "_copy" selset "" p1 p2)
           (setq p1 p2 p2 (polar p2 ang dist))
           (setq dist (+ d dist))
           )
     (setvar 'osmode os)
     (princ)
     )

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...