Sunday, September 23, 2012

Simple AutoLISP Codes: Modified FILLET

In the drafting of beam elevations, I normally use FILLET to form the bend of rebar. While I prefer to simply leave the bend at a 90-degree angle -- which make the job easier for me, of course -- most prefer to have rounded edge where the rebar bends, ie. giving a radius value to the FILLET function.

I use FILLET extensively in any drafting session and when it comes to rebar bend with a radius, it's troublesome to set the radius of FILLET to different values time and again, so I wrote a few lines to create new FILLET commands that are mapped to the radius I desired.

The code below is a modified FILLET command -- completed with error-trapping function -- called F15, which is a FILLET command that has a 15-unit radius. The routine stores the existing FILLET radius value, substitutes it with 15 in the process and restores the existing value at the end.

(defun errF15 (message)
(command)
(setvar "filletrad" frad)
(setq *error* localErrorF15)
(prompt "\nRoutine cancelled. ")
(princ)

)
(C:F15 (/ localErrorF15 frad)
(setq localErrorF15 *error*)
(setq *error* errF15)
(setq frad (getvar "filletrad"))
(command "._FILLET" "R" "15" "._FILLET" pause pause)
(setvar "filletrad" frad)
(setq *error* localErrorF15)
(princ)

)

And yes, by replacing all the 15s in the code with 20s, you'll have a F20 command. ;-)

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...