Jump to content

select the correct dynamic blocks


Recommended Posts

Posted

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

Posted

what about quick select?

Posted
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.

Posted

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)
)

Posted
stupid me...:oops:

 

Whatchoo talkin bout Willis?:huh:

  • 1 year later...
Posted

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!?!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...