Jump to content

Recommended Posts

Posted

Little background first I work in the steel industry.

We have to measure beams and then calculate how many shear studs are on these beams. They are either usually 12" or 24" on center. I am looking if there would be a way to start a command then select 12" or 24" then pick on a line "beam" and it could tell me how many studs would be on that member. For an extra sweet idea it could insert this number onto that beam in text or block form.

 

I know this is complicated but my boss is really hounding me to try and speed up this process.

 

thanks a million you guys are the best....

Posted

Would you be able to post a dwg (in 2000 format) of what these things look like please?

 

Thanks :)

Posted

Well there is not much to show the beam will just be a regular line in Autocad "nothing fancy" and the count could just be text that sits right above the line with the stud count in it.

Posted

Just trying to clarify how you find how many studs there are. Take the distance of the line (beam) and divide it by either 24" or 12"? then insert the answer above the line (beam)?

Posted
Just trying to clarify how you find how many studs there are. Take the distance of the line (beam) and divide it by either 24" or 12"? then insert the answer above the line (beam)?

 

 

This was the point I was trying to make in my previous post - I thought the studs would be drawn on and then the LISP program would have to detect a certain shape type - but if its a simple calculation, then it shouldn't be too hard to make a LISP for it.

Posted

If you take a length and divide by a known amount you will get an answer take the integer of that answer and thats how many you require, We draw pipe infills solid blank solid etc its not hard.

 

As you want shear connectors I would expect you need a couple of rules minimum distance from ends etc Its not hard to do this you just need to simply work out how many fit, you make a loop insert the first add the next spacing and keep checking the total length if greater than line then exit.

 

; routine to set N as number of pline segments.

(setq d12 (distance pt1 pt2))

(setq N (fix (/ d12 2.4)))

(setq remd (- d12 (* N 2.4)))

Posted

As BigAl sais the end segment distance rules need to be defined.

This is a rough draft.

(defun c:bedivide (/ ent len 12d 24d)
 (vl-load-com)
 (if (and (setq ent (entsel "\nSelect object to divide."))
          (not (vl-catch-all-error-p
                 (setq start (vl-catch-all-apply
                               'vlax-curve-getpointatparam
                               (list (car ent) 0.0))))
          )
     )
   (progn
     (setq ent (car ent))
     (setq len (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)))
     (setq 12d (/ len 12)
           12d (fix (if (< (- len 12d) 12) (1- 12d) (- 12d 2)))
           24d (/ len 24)
           24d (fix (if (< (- len 24d) 24) (1- 24d) (- 24d 2)))
           )
     (prompt (strcat "\nStuds @ 24 = " (itoa 24d) " : Studs @ 12 = " (itoa 12d)))
   )
 )
 (princ)
)

Posted

Adding the text to the line is no big deal but also requires more information from you.

As Lee suggested uploading a sample DWG with the finished line and label would tell us much.

 

Location on the line where the text should go.

Distance from the line, above or below

type of text Mtext or plain text

Text style & size

Justification of the text

Layer text is on

Posted
If you take a length and divide by a known amount you will get an answer take the integer of that answer and thats how many you require, We draw pipe infills solid blank solid etc its not hard.

 

As you want shear connectors I would expect you need a couple of rules minimum distance from ends etc Its not hard to do this you just need to simply work out how many fit, you make a loop insert the first add the next spacing and keep checking the total length if greater than line then exit.

 

; routine to set N as number of pline segments.

(setq d12 (distance pt1 pt2))

(setq N (fix (/ d12 2.4)))

(setq remd (- d12 (* N 2.4)))

 

Thanks for the clarification BigAL :thumbsup:

 

But still, as CAB says, a sample drawing would be nice. :)

Posted

Ok I here is a small example drawing.

The text can be multiline but it would need to have parantheses around the number.

 

When starting the command I will need to select either 12" or 24" for the spacings. It would be great if the command would stay active and I could select beam after beam as I will have to do hundreds of these.

 

Thanks a million guy... Like I always say you guys are great.

STUD EXAMPLE.dwg

Posted

You can give this a try.

commands are:

beam12 for single pick

beam24

and

beam12m for selection set pick

beam24m

 

 

;;  CAB version 1.0 01/19/09
;;  Modes are single select or multi-selection
(defun beamdivide (slen spick / ent len ss i MinStDist)
 (vl-load-com)
 (defun addtext (ent slen / cnt )
   (setq len (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)))
   (if (> len (* 2 slen))
     (progn
   (setq MinStDist (* 2 12.) ; min 12" from end for a stud
         cnt (/ (+ (- len MinStDist) 0.0001) slen) ; add fuzz for rounding errors
         cnt (fix (1+ cnt))
         cpt (vlax-curve-getpointatdist ent (/ len 2.))
         ang (angle '(0 0) (vlax-curve-getFirstDeriv ent (vlax-curve-getParamAtPoint ent cpt)))
   )

   ;;===========================================
   ;;   Adjust angle if needed to position text 
   ;;===========================================
   (if (and (> ang (* 0.5 pi)) (<= ang (* 1.5 pi)))  ;flop text at >90 and <270 
     (setq ang (+ ang pi))
   )
   
   ;;  text is Bottom Center
   (entmake
          (list (cons 0 "TEXT")
                (cons 1 (strcat "(" (itoa cnt) ")"))  ;* (the string itself)
                (cons 6 "BYLAYER")  ; Linetype name 
                (cons 7 "STANDARD") ;* Text style name, defaults to STANDARD, not current
                (cons 8 "STUDS")    ; layer
                (cons 10 cpt) ;* First alignment point (in OCS) 
                (cons 11 cpt) ;* Second alignment point (in OCS) 
                (cons 39 0.0) ; Thickness (optional; default = 0)
                (cons 40 12.0) ;* Text height
                (cons 41 1.0) ; Relative X scale factor, Width Factor, defaults to 1.0
                (cons 50 ang) ; Text rotation ange
                (cons 51 0.0) ; Oblique angle 
                (cons 62 256) ; color 
                (cons 71 0) ; Text generation flags 
                (cons 72 1) ; Horizontal text justification type 
                (cons 73 1) ; Vertical text justification type
                ))
   ))
   
   )

 (command "_undo" "_begin")
 (cond
   (spick
    (while (and (setq ent (entsel "\nSelect object to divide."))
                (not (vl-catch-all-error-p
                       (setq start (vl-catch-all-apply
                                     'vlax-curve-getpointatparam
                                     (list (car ent) 0.0)
                                   )
                       )
                     )
                )
           )
      (addtext (car ent) slen)

    )
   )
   ((or
      (prompt (strcat "\nSelect beams to calc studs at " (itoa slen)))
      (setq ss (ssget '((0 . "LINE,LWPOLYLINE"))))
    )
    (setq i -1)
    (while (setq ent (ssname ss (setq i (1+ i))))
      (addtext ent slen)
    )
   )
 )
 (command "_undo" "_end")
 (princ)
)

(defun c:beam12 () (beamdivide 12 t)) ; single pick
(defun c:beam24 () (beamdivide 24 t))
(defun c:beam12m () (beamdivide 12 nil)) ; selection set pick
(defun c:beam24m () (beamdivide 24 nil))

Posted

That Works Great !! one minor tweek though if it would be possible.

For example if working with studs at 12" o.c. If my beam is 8'-0" long it gives me a qty of 7 which is correct. But if I have a beam length of say 7'-6" it gives me a qty of 6 studs when it actually should be 7.

 

Maybe if the beam is over an even foot mark like 7'-3" it could add 1 to the total it comes up with?

Posted

I thought you need a min distance of 12" on both ends of the beam?

Posted

i have attached another drawing illustrating the green lines are represebnting studs. I guess to clear things up this might help...Studs start 12" from the end of the lines but they must be a min of 12" or 24" apart so therefore when you have a 7'-6" beam there should be 7 studs noted.

STUD EXAMPLE-2.dwg

Posted

Try this, revised formula.

;;  CAB version 1.1 01/19/09
;;  Modes are single select or multi-selection
(defun beamdivide (slen spick / ent len ss i MinStDist)
 (vl-load-com)
 (defun addtext (ent slen / cnt )
   (setq len (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)))
   (if (> len (* 2 slen))
     (progn
   (setq MinStDist (* 2 12.) ; min 12" from end for a stud
         cnt (/ (+ (- len MinStDist) 0.0001) slen) ; add fuzz for rounding errors
         cnt (fix (+ cnt 1.99))
         cpt (vlax-curve-getpointatdist ent (/ len 2.))
         ang (angle '(0 0) (vlax-curve-getFirstDeriv ent (vlax-curve-getParamAtPoint ent cpt)))
   )

   ;;===========================================
   ;;   Adjust angle if needed to position text 
   ;;===========================================
   (if (and (> ang (* 0.5 pi)) (<= ang (* 1.5 pi)))  ;flop text at >90 and <270 
     (setq ang (+ ang pi))
   )
   
   ;;  text is Bottom Center
   (entmake
          (list (cons 0 "TEXT")
                (cons 1 (strcat "(" (itoa cnt) ")"))  ;* (the string itself)
                (cons 6 "BYLAYER")  ; Linetype name 
                (cons 7 "STANDARD") ;* Text style name, defaults to STANDARD, not current
                (cons 8 "STUDS")    ; layer
                (cons 10 cpt) ;* First alignment point (in OCS) 
                (cons 11 cpt) ;* Second alignment point (in OCS) 
                (cons 39 0.0) ; Thickness (optional; default = 0)
                (cons 40 12.0) ;* Text height
                (cons 41 1.0) ; Relative X scale factor, Width Factor, defaults to 1.0
                (cons 50 ang) ; Text rotation ange
                (cons 51 0.0) ; Oblique angle 
                (cons 62 256) ; color 
                (cons 71 0) ; Text generation flags 
                (cons 72 1) ; Horizontal text justification type 
                (cons 73 1) ; Vertical text justification type
                ))
   ))
   
   )

 (command "_undo" "_begin")
 (cond
   (spick
    (while (and (setq ent (entsel "\nSelect object to divide."))
                (not (vl-catch-all-error-p
                       (setq start (vl-catch-all-apply
                                     'vlax-curve-getpointatparam
                                     (list (car ent) 0.0)
                                   )
                       )
                     )
                )
           )
      (addtext (car ent) slen)

    )
   )
   ((or
      (prompt (strcat "\nSelect beams to calc studs at " (itoa slen)))
      (setq ss (ssget '((0 . "LINE,LWPOLYLINE"))))
    )
    (setq i -1)
    (while (setq ent (ssname ss (setq i (1+ i))))
      (addtext ent slen)
    )
   )
 )
 (command "_undo" "_end")
 (princ)
)

(defun c:beam12 () (beamdivide 12 t)) ; single pick
(defun c:beam24 () (beamdivide 24 t))
(defun c:beam12m () (beamdivide 12 nil)) ; selection set pick
(defun c:beam24m () (beamdivide 24 nil))

Posted

CAB,

 

I almost always have trouble placing text on a line.

 

Reason being, normally, no matter how hard I try, the text is upside down.

 

I normally retrieve the start point of the line and endpt and then retrieve the angle between the two points using (angle stpt enpt) - but obviously this angle will be different if, say, the line is drawn from left to right instead of right to left.

 

You seem to retrieve the angle by using the vector of the first derivative of the line - very clever indeed.

 

Is this always defined in one direction no matter which way the line is drawn (if that makes sense?).?

 

Cheers

 

Lee

Posted

No, the reason I used it is to accommodate plines ant it will give the angle at that segment.

The way to orient text is to use the angle correction code.

 

    ;;===========================================
   ;;   Adjust angle if needed to position text 
   ;;===========================================
   (if (and (> ang (* 0.5 pi)) (<= ang (* 1.5 pi)))  ;flop text at >90 and <270 
     (setq ang (+ ang pi))
   )

Posted

WOW... that is exactly right works great !!

 

Thanks you have no idea how many hours you have saved me.

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...