Huibert Posted June 30, 2009 Posted June 30, 2009 I have a situation where I need some help. I have a drawing with a lot of dynamic blocks and I am looking for a quick way to select all the dynamic blocks of a certain type. in my case the dynamic blocks with name=DEMU1988-M20, dynamic parameter L=150, and visibility=Baz. Apperently in Qselect I can only select all the blocks with name DEMU1988-M20 and not with the dynamic block specifications, in the command 'filter' I can't find any options to specify my selection wiht the dynamic block proporties aswell. If anyone could help me with this problem I would be very pleased. Huibert van Horssen Quote
Tiger Posted June 30, 2009 Posted June 30, 2009 what about quick select? read the question again :wink: I seem to remember that there are lisps here that would do this, i am positive that this has been asked before. See if you can search for something that might help you. Quote
ronjonp Posted June 30, 2009 Posted June 30, 2009 I put this together a while back...not sure if it will do all that you need but it's a start http://www.theswamp.org/index.php?topic=21164.msg256839#msg256839 Quote
ronjonp Posted June 30, 2009 Posted June 30, 2009 Here is something more tailored to what you need. Pick the block to set the filter then grab the rest of the blocks....enjoy. ;;; AUTHOR ;;; Copyright© 2009 Ron Perez (ronperez@gmail.com) ;;; (defun c:fdp (/ m obj ent sel ss ss2 x isdynamic rjp-getdynamicblockproperties) (defun isdynamic (obj /) (if (= 'ename (type obj)) (setq obj (vlax-ename->vla-object obj)) ) (and (= (vla-get-objectname obj) "AcDbBlockReference") (= (vla-get-isdynamicblock obj) :vlax-true) ) ) (defun rjp-getdynamicblockproperties (obj / prop) (if (= 'ename (type obj)) (setq obj (vlax-ename->vla-object obj)) ) (if (setq prop (vl-remove-if '(lambda (x) (= (vla-get-propertyname x) "Origin")) (vlax-invoke obj 'getdynamicblockproperties) ) ) (mapcar '(lambda (x) (vl-remove 'nil (list (vla-get-effectivename obj) (vlax-get x 'propertyname) (vlax-get x 'value) (vlax-get x 'allowedvalues) ) ) ) prop ) ) ) (if (and (setq ent (car (entsel "\nSelect block to set dynamic filter: "))) (isdynamic ent) (setq m (rjp-getdynamicblockproperties ent)) (setq ss (ssget '((0 . "INSERT")))) (setq ss (vl-remove-if-not '(lambda (x) (and (isdynamic x) (equal m (rjp-getdynamicblockproperties x) 0.0001))) (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) ) ) (setq ss2 (ssadd)) ) (progn (mapcar '(lambda (x) (ssadd x ss2)) ss) (sssetfirst nil ss2)) ) (princ) ) Quote
matinau Posted July 22, 2010 Posted July 22, 2010 Is there a way of creating a dynamic block selection set without using entsel or manually selecting a dynblk to filter? I'm trying to create a selection set of 2 dynamic blocks "block_A" "block_B" using something like this: (if (/= (setq ss (ssget "x" (list (cons 2 "block_A,block_B,`*U*")))) nil) (command "erase" ss "") ) But the above code just erases all dynamic blocks - I've tried this as well, but ended up way over my head...with the same result (while (setq ss (ssget "x" (list (cons 2 "*block_A*,*block_B*,`*U*")))) (setq ctr 0) (repeat (sslength ss) (setq blk (ssname ss ctr)) (setq blk (vlax-ename->vla-object blk)) (=(vla-get-IsDynamicBlock blk) :vlax-true) (=(vla-get-ObjectName blk) "AcDbBlockReference") (setq name (vla-get-EffectiveName blk)) (setq eblk (ssget "x" (list '(0 . "INSERT") (cons 2 (strcat name ",`*U*"))))) (command "erase" eblk "") (setq ctr (1+ ctr)) ) ) Ahhhh!?! 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.