Cad newbie 24 Posted February 8, 2024 Posted February 8, 2024 Hi all, i am very new to lisps and would really like to add an offset with distance and erase original to my bounding box lisp. Any help much appreciated! Here is what i have so far, it works really well. (defun C:DBBM (/ ss minpt maxpt eLL eUR LL UR); = Draw Bounding Box, Multiple (prompt "\nTo Draw the Bounding Box around Multiple objects,") (if (setq ss (ssget)) (progn ; then (repeat (setq n (sslength ss)) (vla-getboundingbox (vlax-ename->vla-object (ssname ss (setq n (1- n)))) 'minpt 'maxpt) (setq eLL (vlax-safearray->list minpt) eUR (vlax-safearray->list maxpt) LL (if LL (mapcar 'min eLL LL) eLL) UR (if UR (mapcar 'max eUR UR) eUR) ); setq ); repeat (command "_.rectangle" "_none" LL "_none" UR) ); progn (prompt "\nNothing selected."); else ); if (princ) ); defun (vl-load-com) (prompt "\nType DBBM to Draw the Bounding Box around Multiple objects.") Quote
Scoutr4 Posted February 8, 2024 Posted February 8, 2024 (edited) ;https://www.cadtutor.net/forum/topic/35584-create-layers-with-lisp/ (defun C:DBBM (/ ss minpt maxpt eLL eUR LL UR); = Draw Bounding Box, Multiple (prompt "\nTo Draw the Bounding Box around Multiple objects,") (setvar "cmdecho" 0) (setq oldclayer (getvar "clayer") layername "test") (and (or (tblsearch "LAYER" layername) (Layer layername 1 nil nil nil)) (setvar "clayer" layername) (if (setq ss (ssget)) (progn ; then (repeat (setq n (sslength ss)) (vla-getboundingbox (vlax-ename->vla-object (ssname ss (setq n (1- n)))) 'minpt 'maxpt) (setq eLL (vlax-safearray->list minpt) eUR (vlax-safearray->list maxpt) LL (if LL (mapcar 'min eLL LL) eLL) UR (if UR (mapcar 'max eUR UR) eUR) ); setq ); repeat (command "_.rectangle" "_none" LL "_none" UR) (setq obj (vlax-ename->vla-object (entlast))) (vla-offset obj 100); You can add a question and change the value (vla-erase obj) ); progn (prompt "\nNothing selected."); else ); if ) (setvar "clayer" oldclayer) (princ) ); defun (vl-load-com) (prompt "\nType DBBM to Draw the Bounding Box around Multiple objects.") (defun Layer (Nme Col Ltyp LWgt Plt) (entmake (list (cons 0 "LAYER") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbLayerTableRecord") (cons 2 Nme) (cons 70 0) (cons 62 Col) ;(cons 6 Ltyp) ;(cons 290 Plt) ;(cons 370 LWgt) ))) Is this the lisp you are talking about? Edited February 10, 2024 by Scoutr4 Layer added Quote
Cad newbie 24 Posted February 9, 2024 Author Posted February 9, 2024 15 hours ago, Scoutr4 said: (defun C:DBBM (/ ss minpt maxpt eLL eUR LL UR); = Draw Bounding Box, Multiple (prompt "\nTo Draw the Bounding Box around Multiple objects,") (if (setq ss (ssget)) (progn ; then (repeat (setq n (sslength ss)) (vla-getboundingbox (vlax-ename->vla-object (ssname ss (setq n (1- n)))) 'minpt 'maxpt) (setq eLL (vlax-safearray->list minpt) eUR (vlax-safearray->list maxpt) LL (if LL (mapcar 'min eLL LL) eLL) UR (if UR (mapcar 'max eUR UR) eUR) ); setq ); repeat (command "_.rectangle" "_none" LL "_none" UR) (setq obj (vlax-ename->vla-object (entlast))) (vla-offset obj 100); You can add a question and change the value (vla-erase obj) ); progn (prompt "\nNothing selected."); else ); if (princ) ); defun (vl-load-com) (prompt "\nType DBBM to Draw the Bounding Box around Multiple objects.") Is this the lisp you are talking about? Yes that is absolutely what i'm talking about! Thanks Scoutr4. Is it easy to add in, assign a specific layer to this? 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.