Bmaddo77 Posted April 13, 2013 Posted April 13, 2013 Hi, I'm very new to lisp and I'm currently writing some to create steel sections with the main dimensions and the name of the section below. I'm having trouble adding dimensions (in a new dimension layer) to my lisp file and the text file below my section (also in a new text layer). Ive attached my lisp file and a picture of what I'm trying to achieve. Any help would be appreciated! PFC.pdf pfc.lsp Quote
Tharwat Posted April 13, 2013 Posted April 13, 2013 Welcome to CadTutor Adjust your dimension style before you invoke the lisp routine to have a very good presentation of the section . Please let me know how the code runs for you . (defun c:PFC (/ *error* _Mid p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12) ;;----- Tharwat 13. April. 2013 -----;; (defun *error* (x) (setvar 'cmdecho 1) (princ "\n *Cancel*") ) (defun _Mid (a b) (mapcar '(lambda (j k) (/ (+ j k) 2.)) a b) ) (if (not (tblsearch "LAYER" "STEEL")) (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") '(70 . 0) (cons 2 "STEEL") '(62 . 252) ) ) ) (if (setq p1 (getpoint "\n Specify base point:")) (progn (setvar 'cmdecho 0) (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(8 . "STEEL") '(90 . 10) '(70 . 1) (cons 10 p1) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 (setq p2 (polar p1 0. 90.))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 (setq p3 (polar p2 (* pi 0.5) 15.))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 (setq p4 (polar p3 pi 70.))) '(40 . 0.0) '(41 . 0.0) '(42 . -0.414214) (cons 10 (setq p5 (polar (polar p4 pi 12.) (* pi 0.5) 12.))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 (setq p6 (polar p5 (* pi 0.5) 196.))) '(40 . 0.0) '(41 . 0.0) '(42 . -0.414214) (cons 10 (setq p7 (polar (polar p6 (* pi 0.5) 12.) 0. 12.))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 (setq p8 (polar p7 0. 70.))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 (setq p9 (polar p8 (* pi 0.5) 15.))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) (cons 10 (setq p10 (polar p9 pi 90.))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) ) ) (command "_.dimlinear" "_none" (setq p11 (polar (_Mid p5 p6) (* pi 0.5) 25.)) "_none" (setq p12 (polar (_Mid p10 p1) (* pi 0.5) 25.)) "_none" p12 ) (command "_.dimlinear" "_none" p10 "_none" p1 "_none" (polar p10 pi 25.) ) (command "_.dimlinear" "_none" p10 "_none" p9 "_none" (polar p10 (* pi 0.5) 15.) ) (command "_.dimlinear" "_none" p9 "_none" p8 "_none" (polar p8 0. 15.) ) (entmakex (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") '(40 . 10.) '(71 . 5) (cons 7 (getvar 'textstyle)) '(8 . "STEEL") '(42 . 0.0) '(50 . 0.) (cons 10 (polar (polar p1 0. 45.) (* pi 1.5) 20.)) '(1 . "{\\L250 PFC}") ) ) (setvar 'cmdecho 1) ) ) (princ "\nWritten by Tharwat Al Shoufi") (princ) ) 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.