CadFrank Posted January 10, 2012 Posted January 10, 2012 Hi I have this routine here and I can't make it to work properly and I don't understant why. When I do it step by step it runs fine but it i run it like a program it gives me a deformed beam. here it the code : (defun c:test (/ O L H EA ES R) (setq O (getpoint "\nSelecte the point of origine : ")) (setq H (getreal "\nGive the depth of the beam 'd' : ")) (setq L (getreal "\nGive the width of the flange 'b' : ")) (setq EA (getreal "\nGive the web thickness 'w' : ")) (setq ES (getreal "\nGive the flange thickness 't' : ")) (setq pt1 (polar O pi (/ L 2))) (setq pt2 (polar pt1 (/ pi 2)ES)) (setq pt3 (polar pt2 0 (/(- L EA) 2))) (setq pt4 (list (car pt3)(+ (cadr O) (- H ES)))) (setq pt5 (list (car pt1)(cadr pt4))) (setq pt6 (list (car pt1) (+ (cadr pt5) ES))) (setq pt7 (polar pt6 0 L)) (setq pt8 (list(car pt7) (cadr pt5))) (setq pt9 (list(+ (car pt4) EA) (cadr pt8))) (setq pt10 (list (car pt9) (cadr pt3))) (setq pt11 (list (car pt8) (cadr pt10))) (setq pt12 (list (car pt11) (cadr pt1))) (command "_.pline" O pt1 pt2 pt3 pt4 pt5 pt6 pt7 pt8 pt9 pt10 pt11 pt12 O "") (command "_.fillet" "_r" R) (command "_.fillet" pt3 pt4 pt4 pt5 pt9 pt10 pt10 pt11 "") (princ) );defun c: So here it is. thank for the help in advance Cheers & Beers Quote
Lee Mac Posted January 10, 2012 Posted January 10, 2012 Since you are using command calls, perhaps OSnap is affecting the placement of your points. Either prefix your point inputs with "_non" to ignore OSnap, i.e. (command "_.pline" "_non" O "_non" pt1 ... ) Or, leave the command expressions as they are and store the value of OSMODE before switching it off, then reset it at the end of the code, i.e.: (setq osmode (getvar 'OSMODE)) (setvar 'OSMODE 0) (command ... ) (setvar 'OSMODE osmode) Quote
CadFrank Posted January 10, 2012 Author Posted January 10, 2012 Right on!!! Now I only have to give a radius to some corners. Here's a picture : i have circled the corners that i would like to input a radius. the radius is the variable R in the code at the beginning but since i'm not sure how i could make them. i know i could make a "fillet" with lines but since a "pline" is only on entity and not several i'm not sure how to proceed. I would need a hit to help me out if you wouldn't mind. Thank Cheers beers ! Quote
LibertyOne Posted January 11, 2012 Posted January 11, 2012 Are the inside faces of the flanges perpendicular? Or are they sloped? I'm working on my own steelwork program too, but I'm getting all the data formatted first before I move on to the part of drawing the sections. Quote
rameshaxis Posted January 11, 2012 Posted January 11, 2012 Hai Cadfrank, Try this code for I Beam (defun c:IBM (/ O L H EA ES R) (setq O (getpoint "\nSelecte the point of origine : ")) (setq H (getreal "\nGive the depth of the beam 'd' : ")) (setq L (getreal "\nGive the width of the flange 'b' : ")) (setq EA (getreal "\nGive the web thickness 'w' : ")) (setq ES (getreal "\nGive the flange thickness 't' : ")) (setq pt1 (polar O pi (/ L 2))) (setq pt2 (polar pt1 (/ pi 2)ES)) (setq pt3 (polar pt2 0 (/(- L EA) 2))) (setq pt4 (list (car pt3)(+ (cadr O) (- H ES)))) (setq pt5 (list (car pt1)(cadr pt4))) (setq pt6 (list (car pt1) (+ (cadr pt5) ES))) (setq pt7 (polar pt6 0 L)) (setq pt8 (list(car pt7) (cadr pt5))) (setq pt9 (list(+ (car pt4) EA) (cadr pt8))) (setq pt10 (list (car pt9) (cadr pt3))) (setq pt11 (list (car pt8) (cadr pt10))) (setq pt12 (list (car pt11) (cadr pt1))) (command "_.pline" O pt1 pt2 pt3 pt4 pt5 pt6 pt7 pt8 pt9 pt10 pt11 pt12 O "") (command "_.fillet" "_r" R) (command "_.fillet" pt2 pt3 "") (command "_.fillet" pt3 pt4 "") (command "_.fillet" pt4 pt5 "") (command "_.fillet" pt5 pt6 "") (command "_.fillet" pt8 pt9 "") (command "_.fillet" pt9 pt10 "") (command "_.fillet" pt10 pt11 "") (command "_.fillet" pt11 pt12 "") (princ) );defun c: Quote
CadFrank Posted January 12, 2012 Author Posted January 12, 2012 Hai Cadfrank, Try this code for I Beam Hey thank for the tip works how I want. Sorry for the late reponse we are having trouble with the internet at work. Cheers & Beers Quote
BIGAL Posted January 12, 2012 Posted January 12, 2012 Theres lots of steel beam stuff all ready out there, already written, if you want to do yourself though once you get the code to work you do a look up list and do not enter any dimensions rather pick the correct beam to be drawn eg 200UB it has a data line attached 200 100 8 6 6 which are the size variables. Only question is then pick point. You can use a DCl or not mentioned much here side bar menu's to pick beam type. have a TXT file containing all the parameters so easy to add more rather than hard coded in a lsp etc. This same method would be applied to all types of predefined shapes UB UC PFB TFB SQhol C Z etc An example cut out of a lisp to read a txt file (setq beamtype (getstring "\enter beam type")) (setq fo (open "beamlist" "r")) (while (setq new_line (read-line fo)) (setq x 1) (setq y 7) (beam_name) (setq beam ans ) (setq x (setq y 10) (setq d ans) ) (defun beam_name () (setq ans "") (setq char_found "") (while (/= x y) (setq char_found (substr new_line x 1)) (setq x (+ x 1)) ; (if (= char_found (chr 92)) (if (= char_found " ") (setq x y) (setq ans (strcat ans char_found)) ) ) ) open file get 1st line see if beamtype if yes then read variables else read next till end of file Then your code Quote
Bill Tillman Posted January 12, 2012 Posted January 12, 2012 I will second what BigAl stated. There are some extremely easy to use, shovel ready steel detailing LISP routines out there that are free for the taking. STL.lsp, DDSTL.lsp, STEEL.lsp for starters and all of these are available at no cost on Cadalyst.com. If you're interested in learning how it works then we of course encourage you to continue your project, but if you want to detail steel sections, even in 3D, check these out and you'll be surprised at what's already been done. Quote
CadFrank Posted January 12, 2012 Author Posted January 12, 2012 hi, Thanks for the tips, I did look up for some .lsp for steel and only found STL.lsp but can't seem to make it work properly. But since i'm trying to learn LISP i'd rather start by doing my own. Maybe in the future ill try other LISP. Cheers Beers ! Quote
ReMark Posted January 12, 2012 Posted January 12, 2012 Why not use Dynamic Blocks? The basis for structural steel beams (W shapes) is already included in AutoCAD 2010 on a tool palette in both imperial and metric units. Quote
Recommended Posts
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.