Search the Community
Showing results for tags 'bounding box'.
-
Modifications to bounding box and model to paperspace
robobobo posted a topic in AutoLISP, Visual LISP & DCL
Hi all, I am attempting to get a viewport from blocks in modelspace to paperspace with a layout template. I would like this automated by selecting all the blocks in numerical order and placing them on the correct numbered layout. I have found plenty of lisp out there, but nothing that seems to work 100%. I know there are programs out there, but I want to try to learn autolisp with this project. I think I was able to get close with these two: Draw bounding box on object-from Blackbox Create multiple viewport from multiple rectangle in model space-from hmsilva The main difference I want to change below is to select all of my objects, instead of being prompted to select a single object, (defun c:BNDBX (/ eName mn mx) (vl-load-com) (if (setq eName (car (entsel "\n >> Select Object >> "))) (progn (vla-getboundingbox (vlax-ename->vla-object eName) 'mn 'mx) (vl-cmdf "._rectang" (vlax-safearray->list mn) (vlax-safearray->list mx)))) (princ) ) ) I have tried inserting (if (setq eName (ssget "_x" '((0 . "INSERT") (2 . "PageView")))) on the 3rd line with no success. Eventually I would like to have the second code produce layouts in order. But I figured I would get this chunk sorted first.- 4 replies
-
- layout
- paperspace
-
(and 4 more)
Tagged with:
-
Need Help With Bounding Box Move LISP! HELP!
tmelancon posted a topic in AutoLISP, Visual LISP & DCL
I currently have a really really basic LISP routine. It was written to center a group of objects within a 12x9 drawing sheet (some people do not care whether their drawing is centered or not... pet peeve) ANYWAYS.. In a nutshell it prompts user to select objects using SSGET. Then asks the user for 2 points, which could be any two opposing points that encompass the outer most limits of the group of objects. After the SSGET and the 2 points have been established I have the routine moving the group based on center of 2 points to the center of the 12x9 drawing sheet. We draw in isometric hence the command snap "I" and "S". I had it snap to Standard so the beginner users can quickly move their cursor to the extents of any given group.. See Code below (DEFUN C:CEN (/ *ERROR* oldsnap oldos) (defun *error* (msg) (if oldos (setvar "osmode" oldos)) (if oldsnap (setvar "snapmode" oldsnap)) (if msg (prompt msg)) (princ) ) (setvar "cmdecho" 0) (setq oldsnap (getvar "snapmode") (setq oldos (getvar "osmode")) (princ "\nSelect Object(s) to CENTER within the titleblock. ") (SETQ CENT3R (SSGET )) (command "snap" "s" "s" "") (setvar "snapmode" 0) (SETQ P1 (GETpoint "\nFirst corner of rectangle: ")) (setvar "osmode" 0) (setq p2 (getCORNER P1 "\nSecond corner of rectangle: ")) (COMMAND "MOVE" CENT3R "" "m2p" p1 p2 "M2P" "0,0" "12,9") (command "snap" "s" "i" "") (setvar "snapmode" oldsnap) (setvar "OSMODE" OLDOS) (SETQ CENT3R NIL) (*ERROR* NIL) (PRINT) ) I would like to use BoundingBox function to Automatically get the coordinates of the SSGET, instead of asking user for First and Second points of rectangle. See Code below that gets bounding box coordinates. Can someone please help me bring these 2 together? Thanks and God bless. (defun c:test ( / OBJ Point1 Point2 ) (vl-load-com) (princ "\nSelect an object: ") (setq OBJ (vlax-ename->vla-object (ssname (ssget) 0))) (if OBJ (progn ;;OBJ is a vla-object ;;Point1 is the lower left point of the bounding box around the object ;;Point2 is the upper right point of the bounding box around the object (vla-getboundingbox OBJ 'Point1 'Point2) ;;Point1 and Point2 are returned as a safearray and need to be converted to a list (setq Point1 (vlax-safearray->list Point1)) (setq Point2 (vlax-safearray->list Point2)) (princ (strcat "\n The lower left corner is " (rtos (car Point1) 2 2) ", " (rtos (cadr Point1) 2 2))) (princ (strcat "\nThe upper right corner is " (rtos (car Point2) 2 2) ", " (rtos (cadr Point2) 2 2))) ) ) (princ) ) -
Hi, I'm looking for an autolisp that can create a rectangular bounding box around a closed object i.e a region, a block of a profile, an open-closed polyline. Thank you in advanced, Nicolas.
-
Frame and Center of Blocked Profile
nicolas posted a topic in AutoCAD 2D Drafting, Object Properties & Interface
Hi, I am looking for a way to automatically draw a rectangular/square frame around a block (in this case, a block of a profile) and also set the base point in the middle of the profile block. I have to use xline together with rectangle to do this, then draw a diagonal and use the midpoint of the diagonal each time. It would be great to know if there is a way to automate the process. I do understand that I can find the diagonal of the frame using LIST yet i can see no way to apply this into the routine. Thank you very much. Regards, Nicolas.- 5 replies
-
- centre of block
- bounding box
-
(and 1 more)
Tagged with: