ibach Posted January 12, 2013 Posted January 12, 2013 Need to pinpoint blocks in dwg model space somehow. Blocks I need to find are alone in model space, but some are included in other blocks as well. I need to go trough all blocks and their nested items to find all instances of a block with same name. It would be nice to zoom them one by one. Quote
ibach Posted January 12, 2013 Author Posted January 12, 2013 (edited) I'm an idiot.... BEDIT, draw big mark in the problem block save edit and look at the drawing... if there is no block in a drawing use superpurge or something to remove it... Addendum... Be careful with dynamic blocks that have visibility feature used, when adding mark make it visible in all states. Edited January 12, 2013 by ibach Quote
BIGAL Posted January 12, 2013 Posted January 12, 2013 You can use ssget a unique block name and then zoom to each one is pretty simple code, I would pick 1 block so get name. If you want an example code post again. Quote
ibach Posted January 13, 2013 Author Posted January 13, 2013 sure i'd like the example. I'm not good at programming. Quote
Tharwat Posted January 13, 2013 Posted January 13, 2013 Try this ... (defun c:Test (/ *error* name ss i obj lft rgt) (vl-load-com) ;;; Tharwat 13. jan. 2013 ;;; (defun *error* (x) (princ "\n *Cancel*")) (if (and (/= (setq name (getstring t "\n Specify Block name :")) "") (/= name nil) (setq ss (ssget "_x" (list '(0 . "INSERT") (cons 410 (getvar 'ctab)) (cons 2 name)))) ) (progn (repeat (setq i (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq i (1- i))))) (vla-getboundingbox obj 'l 'r) (setq mid (mapcar (function (lambda (q p) (/ (+ q p) 2.))) (setq lft (vlax-safearray->list l)) (setq rgt (vlax-safearray->list r)) ) ) (vla-ZoomCenter (vlax-get-acad-object) (vlax-3d-point mid) (distance lft (list (car rgt) (cadr lft))) ) (if (eq "" (getstring "\n Press enter to continue or space bar:")) (princ) ) ) (alert "*** DONE ***") ) (princ) ) (princ) ) 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.