TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Amsterdammed on August 09, 2005, 03:14:50 PM

Title: Changing entities in Blocks
Post by: Amsterdammed on August 09, 2005, 03:14:50 PM
Hello everybody,

For the cleaning up of drawings from Builders I would need to be able to change Entities in Blocks with “subst”, no matter how deep they are in the blocks.

Does anybody have a lisp solution for this problem?

Thanks in advance,

Bernd
Title: Changing entities in Blocks
Post by: daron on August 09, 2005, 03:29:15 PM
Use nentsel. If you're using ADT use the display props dialog.
Title: Changing entities in Blocks
Post by: Amsterdammed on August 09, 2005, 03:32:49 PM
I have no ADT and i need to do a lot of entities in a lot of dwgs, so I must get to the subentities in a different way.
Title: Changing entities in Blocks
Post by: MP on August 09, 2005, 03:42:33 PM
Walk (iterate) and modify the block definitions to suit.

Simplified example:
Code: [Select]
(progn

    (vlax-for block

        (vlax-get-property
            (vlax-get-property
                (vlax-get-acad-object)
               'ActiveDocument
            )
           'Blocks
        )
       
        ;;  force all entities within blocks
        ;;  matching "*" name spec to bylayer

        (if (wcmatch (vlax-get-property block 'Name) "*")
            (vlax-for entity block
                (vlax-put-property
                    entity
                   'Color
                    256
                )
            )    
        )    

    )
   
    (princ)
   
)    
Title: Changing entities in Blocks
Post by: Amsterdammed on August 09, 2005, 04:24:48 PM
:D
That's just great MP.

Thank you a lot.

 :D
Title: Changing entities in Blocks
Post by: MP on August 09, 2005, 04:29:24 PM
My pleasure A'dammed.