maahee Posted yesterday at 02:09 PM Posted yesterday at 02:09 PM (edited) (defun c:rm () (setq roomName (getstring t "\nEnter room type:" ) ) (null (initget 32)) (setq fc (getpoint "\nPick first corner")) (null (initget 32)) (setq nc (getcorner fc "\nPick Next corner")) (setq h (abs (- (car fc) (car nc))) v (abs (- (cadr fc) (cadr nc))) ) (setq ar (* h v)) (setq txt (strcat roomName "\\P" (rtos h 2 2) " M " " X " (rtos v 2 2) " M " "\\P" "[" (rtos ar 2 2) " SQ.M.]" ) ) (command "rectangle" fc nc) (setq p (mapcar (function (lambda (a b) (/ (+ a b) 2.00))) fc nc)) (entmakex (list (cons 0 "MTEXT") (cons 8 "ROOM") ; your layer name (cons 62 5) ; text color blue (cons 7 "Standard") ; text style name (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 p) (cons 1 txt) (cons 41 0) ; Text width (cons 71 5) (cons 72 5) (cons 73 1) (cons 40 0.23) ) ) (princ) ) Convert the rectangle (only) into a block, placing the point at the bottom left corner. Drawing2.dwg Edited yesterday at 02:21 PM by maahee Quote
GLAVCVS Posted yesterday at 03:50 PM Posted yesterday at 03:50 PM Add this code below '(command " rectangle"... ', load it, and try running the code again (if (not (tblsearch "block" roomName)) (command "_block" roomName (setq pt (list (min (car fc) (car fc)) (min (cadr fc) (cadr fc)))) (setq cj (ssadd (entlast))) "") (princ (strcat "\n" roomName " already exist...")) ) (command "_.insert" roomName pt "" "" "") 1 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.