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.
Solved! Go to Solution.
Solved by mdhutchinson. Go to Solution.
@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.
That's the reason...
... they turn to anonymous blocks... "when they are altered from the original state"
Thanks!