Search the Community
Showing results for tags 'boundingbox'.
robobobo posted a topic in AutoLISP, Visual LISP & DCLHi 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.
I'm trying to modify some code to achieve the following: Ask the user to pick multiple blocks, step through each block, get the extents of the block, and save a view with the view name equal to the name of the block. Doing some research I've managed to get the extents of the block but can't figure out how to store the block name as a variable and use it as the view name. The code I found will draw a rectangle around the block using vla-getboundingbox but I can't figure out how to assign the name of the block to a variable for use in the -view command. I have a few hundred blocks in the same drawing. Existing code is: (defun c:BlockExtentsToRectangle (/ BlockObject mn mx) (vl-load-com) (if (setq BlockObject (car (entsel "\n >> Select Object >> "))) (progn (vla-getboundingbox (vlax-ename->vla-object BlockObject) 'mn 'mx) (vl-cmdf "._rectang" (vlax-safearray->list mn) (vlax-safearray->list mx)))) (princ) )