selection set by effective name for both regular blocks and parametric blocks (*U Type)
as a resault of a need in a lisp,
I had to make a selection set of blocks by their effective name,
because the regular way whould have taken a parametric/dynamic/anonymous blocks by their *U name and not by their effective (insert) name.
I found this old post that solve that (very big for me) problem:
replace that line in code:
to that:
hope it will help,
aridzv.
I had to make a selection set of blocks by their effective name,
because the regular way whould have taken a parametric/dynamic/anonymous blocks by their *U name and not by their effective (insert) name.
I found this old post that solve that (very big for me) problem:
; Function to create a selection set of standard & dynamic blocks ; That have the same Effective name (defun BlockSSET (blname / sset ss-dyn num ent effname) (vl-load-com) ; ensure that ActiveX is loaded. (if (not (setq sset (ssget "X" (list (cons 2 blname))))) ; Select block with standard method. This will also capture dynamic blocks in their default state. (setq sset (ssadd)) ; if nothing is found then create and empty selection set ) (if (setq ss-dyn (ssget "X" (list (cons 2 "`*U*")))) ; select all anonymous blocks. this will also capture any dynamic blocks that have been worked with (progn ; If anonymous blocks found, check for the given effective name (setq num 0) ; zero counter (repeat (sslength ss-dyn) ; repeat for the number of objects in the selection set (setq ent (ssname ss-dyn num)) ; find the entity name (setq effname (vla-get-EffectiveName (vlax-ename->vla-object ent))) ; Find the EffectiveName of the block (if (= blname effname) ; if the blockname matches the effective name (ssadd ent sset) ; then add it to the original selection set ); end if (setq num (1+ num)) ; Increment the counter by one ) ) ) ; return the gathered selection set sset )with one small change:
replace that line in code:
(setq effname (vla-get-EffectiveName (vlax-ename->vla-object ent))) ; Find the EffectiveName of the block
to that:
(setq effname (getpropertyvalue ent "EffectiveName~Native")) ; Find the EffectiveName of the block
hope it will help,
aridzv.
0