Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SSGet Dynamic Blocks.

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
mdhutchinson
3647 Views, 2 Replies

SSGet Dynamic Blocks.

I am working to snag a selection set of a specific dynamic block... for some reason some of them are anonymous blocks... this is as I would have expected.

 

For others, they are not anonymous blocks... and simply this code works

(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "ROOM TAG"))))

 

So... for the anonymous blocks I have to check the effective name:

 

(defun GetRoomTags (/ inc blockname en finalss ss)

(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "`*U*"))))
 (setq inc 0)
 (setq finalss (ssadd))
 (while (setq en (ssname ss inc))
  (setq blockname (vla-get-effectivename (vlax-ename->vla-object en)))
  (if (wcmatch (strcase blockname) "ROOM TAG")
   (ssadd en finalss)
  ) 
  (setq inc (1+ inc))
 )
 finalss

 

Why would there be 'Room Tag' (s) inserted both as anonymous as well as named blocks. I know that they have a 'effective name' property... but not certain why the same dynamic block would be inserted in the drawing file in two ways.

 

If looks as though I may have to get the anonymous blocks as well as the named blocks and push them into the same selection set.

 

2 REPLIES 2
Message 2 of 3
pbejse
in reply to: mdhutchinson


@mdhutchinson wrote:

I am working to snag a selection set of a specific dynamic block... for some reason some of them are anonymous blocks... this is as I would have expected.

 

For others, they are not anonymous blocks... and simply this code works

(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "ROOM TAG"))))

 

So... for the anonymous blocks I have to check the effective name:

 

(defun GetRoomTags (/ inc blockname en finalss ss)

(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "`*U*"))))
 (setq inc 0)
 (setq finalss (ssadd))
 (while (setq en (ssname ss inc))
  (setq blockname (vla-get-effectivename (vlax-ename->vla-object en)))
  (if (wcmatch (strcase blockname) "ROOM TAG")
   (ssadd en finalss)
  ) 
  (setq inc (1+ inc))
 )
 finalss

 

Why would there be 'Room Tag' (s) inserted both as anonymous as well as named blocks. I know that they have a 'effective name' property... but not certain why the same dynamic block would be inserted in the drawing file in two ways.

 

If looks as though I may have to get the anonymous blocks as well as the named blocks and push them into the same selection set.

 


Dynamic block behaves that way when altered from the orignal state. 

Message 3 of 3
mdhutchinson
in reply to: pbejse

That's the reason...

... they turn to anonymous blocks... "when they are altered from the original state"

 

Thanks!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost