Thursday, January 3, 2013

Sheetmetal-Pretty Basic

Vanilla Autocad does not have a trick for doing simple folded sheet metal developments.
(Hey, we're only up to Release 18 or so, maybe in release 44....)

When I say simple, I mean a piece of sheet metal with one fold or two folds, both at 90 degrees.

Maybe I am the only draftee on the planet that sometimes does this, but it is always a painfully slow process when I do.

To do this manually, I  draw an end on view as above, using polylines. I then would offset
the inner polyline to create a  neutral axis,  by half the metal thickness. In other words, the "K" factor I was using was 0.5.  Which for steel should have been 0.4.  I only realised this by looking up "sheetmetal developments" on the web, here is a good link, even if it is 1998! (In the link he does something similar, but to my mind, not as useful as my one.)

http://www.oocities.org/wpsmoke/acadsheetmetal/paper.html

The length of the neutral axis polyline is the length of the development.  To get the position of the fold lines, I used to use midpoint snap to put a line on the corner and used it to trim the pline: 
Then it was just a matter of clicking on that pine and checking out it's length on the properties palette, to give me the position of the fold line.

All this horsing around: surely I have better things to do? The upshot is an afternoon spent doing the following Lisp routines, which have not been fully tested by hordes of draftees, (apart from me!). So if you like to try them, make sure you cross check the first few by doing the manual stuff above.

To make sure you can check what you keyed in, a piece of text is generated at the end, and put on Defpoints layer (ie it does not print, but you can see it on the screen).

It uses the layer names "MED" for medium thickness lines, "hid" for hidden lines -ie the fold line , and "dim"
for the dimension lines.  If these layers are not there, it should still work.

(Feed back??? Anyone out there????Hullooooo??) 

A typical output in Autocad looks like this:


Here are the two routines: (cut and paste from here into Notepad.)
(These routines are free)
;Program written by Bill Le Couteur
;Auckland NZ
;Rev 0 date 3 JAN 2013
;THIS PROGRAM DOES ONLY SIMPLE SHEETMETAL BEND OF A 90 DEG BEND - U SHAPED TROUGH-BOTH UPSTANDS EQUAL

(defun  c:DEVU()
(setvar "osmode" 0)
(setq KFactor 0.4)
(setq MetalThickness (getreal "\n Enter Metal Thickness"))
(setq InnerBendRadius MetalThickness)

(setq Length1 (getreal "\n Enter Upstand - Outside Dim"))
(setq Length2 (getreal "\n Enter Middle Section - Outside Dim"))
(setq MiddleSection Length2);;;keep this for later use in text
(setq MiddleSections (rtos MiddleSection))
(setq Length2 (/ Length2 2))
(setq TheWidth (getreal "\n Enter the width"))


(setq NeutralInnerOffset (* KFactor MetalThickness))
(setq NeutralOuterOffset (- MetalThickness NeutralInnerOffset))

(setq NeutralBendArcRad (+ NeutralInnerOffset InnerBendRadius))


(setq Length1Neutral (- (- Length1 NeutralBendArcRad) NeutralOuterOffset))
(setq Length2Neutral (- (- Length2 NeutralBendArcRad) NeutralOuterOffset))

(setq ArcLength (/ (* pi 2 NeutralBendArcRad) 4))

(setq DevLength (+ Length1Neutral Length2Neutral Length2Neutral ArcLength ArcLength Length1Neutral))

(setq HalfArcLength (/ ArcLength 2))

(setq DistanceToFold (+ Length1Neutral HalfArcLength))
(setq FarDistanceToFold (- DevLength DistanceToFold))

(setq TheOrigin (getpoint "\n Pick a point for the development"))

(command "UCS" "n" TheOrigin )

(if (tblsearch "layer" "MED") (command "layer" "s" "MED" ""))
(command "_rectangle" "0,0" (list DevLength TheWidth))

(if (tblsearch "layer" "dim") (command "layer" "s" "dim" ""))
(command "_dimlinear" "0,0"  (list DevLength 0) "0,-50" )
(command "_dimlinear" "0,0"  (list 0 TheWidth) "-50,0" )
(command "_dimlinear" "0,0"  (list DistanceToFold 0) "0,-25" )
(command "_dimlinear"  (list FarDistanceToFold 0)  (list DevLength 0) "0,-25" )
(command "-text" (list DistanceToFold 20) "" "90" "BEND UP 90%%D") 
(command "-text" (list FarDistanceToFold 20) "" "90" "BEND UP 90%%D")
(if (tblsearch "layer" "hid") (command "layer" "s" "hid" ""))
(command "_line" (list DistanceToFold 0) (list DistanceToFold TheWidth) "")
(command "_line" (list FarDistanceToFold 0) (list FarDistanceToFold TheWidth) "")



;;;;;;;;;;;;;;;NOW DOING THE TEXT TO ENABLE CHECKING THE INPUT DATA;;;;;;;;;;;;;;;;;;;;;
(command "layer" "s" "Defpoints" "")
(command "UCS" "W"  )
(setq apt (getpoint "\nInsertion Point for Text: "))
(setq TheText "Data for this development input as follows: ")
(setq MetalThicknesss (rtos MetalThickness))
(setq Length1s (rtos Length1))
(setq Length2s (rtos Length2))
(setq TheWidths (rtos Thewidth))
(setq booText (strcat TheText "\nThickness: " MetalThicknesss "\nUpstand : " Length1s "\nMiddle Section : " MiddleSections "\nWidth : " TheWidths "\nK Factor Used is 0.4"))
(command "UCS" "n" apt )
(command "-mtext" "0,0" "200,-100" booText "") 
(command "UCS" "W"  )
(command "layer" "s" "0" "")
   (princ)
)

 Here is the other Routine:
;Program written by Bill Le Couteur
;Auckland NZ
;Rev 0 date 3 JAN 2013
;THIS PROGRAM DOES ONLY SIMPLE SHEETMETAL BEND OF A 90 DEG BEND ANGLE

(defun  c:DEVL()
(setvar "osmode" 0)
(setq KFactor 0.4)
(setq MetalThickness (getreal "\n Enter Metal Thickness"))
(setq InnerBendRadius MetalThickness)

(setq Length1 (getreal "\n Enter Outer Length 1"))
(setq Length2 (getreal "\n Enter Outer Length 2"))
(setq TheWidth (getreal "\n Enter the width"))


(setq NeutralInnerOffset (* KFactor MetalThickness))
(setq NeutralOuterOffset (- MetalThickness NeutralInnerOffset))

(setq NeutralBendArcRad (+ NeutralInnerOffset InnerBendRadius))


(setq Length1Neutral (- (- Length1 NeutralBendArcRad) NeutralOuterOffset))
(setq Length2Neutral (- (- Length2 NeutralBendArcRad) NeutralOuterOffset))

(setq ArcLength (/ (* pi 2 NeutralBendArcRad) 4))

(setq DevLength (+ Length1Neutral Length2Neutral ArcLength))

(setq HalfArcLength (/ ArcLength 2))

(setq DistanceToFold (+ Length1Neutral HalfArcLength))

(setq TheOrigin (getpoint "\n Pick a point for the development"))

(command "UCS" "n" TheOrigin )

(if (tblsearch "layer" "MED") (command "layer" "s" "MED" ""))
(command "_rectangle" "0,0" (list DevLength TheWidth))

(if (tblsearch "layer" "dim") (command "layer" "s" "dim" ""))
(command "_dimlinear" "0,0"  (list DevLength 0) "0,-50" )
(command "_dimlinear" "0,0"  (list 0 TheWidth) "-50,0" )
(command "_dimlinear" "0,0"  (list DistanceToFold 0) "0,-25" )
(command "-text" (list DistanceToFold 20) "" "90" "BEND UP 90%%D") 

(if (tblsearch "layer" "hid") (command "layer" "s" "hid" ""))
(command "_line" (list DistanceToFold 0) (list DistanceToFold TheWidth) "")



;;;;;;;;;;;;;;;NOW DOING THE TEXT TO ENABLE CHECKING THE INPUT DATA;;;;;;;;;;;;;;;;;;;;;
(command "layer" "s" "Defpoints" "")
(command "UCS" "W"  )
(setq apt (getpoint "\nInsertion Point for Text: "))
(setq TheText "Data for this development input as follows: ")
(setq MetalThicknesss (rtos MetalThickness))
(setq Length1s (rtos Length1))
(setq Length2s (rtos Length2))
(setq TheWidths (rtos Thewidth))
(setq booText (strcat TheText "\nThickness: " MetalThicknesss "\nLength 1: " Length1s "\nLength 2: " Length2s "\nWidth : " TheWidths "\nK Factor Used is 0.4"))
(command "UCS" "n" apt )
(command "-mtext" "0,0" "200,-100" booText "") 
(command "UCS" "W"  )
(command "layer" "s" "0" "")
   (princ)
)
Happy developing!