I have a dynamic block that has a nested temporary block inside it. What I am wanting to do is replace the temporary block with the permanent block. I have tried several different variation of coding but I cannot seem to get this bad boy to work.
have used:
(vla-put-name (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))) "tempBlockName") "newBlockName")
this gives me a duplicate names error.
Any ideas?
Hi,
try to replace tempBlockName with newBlockName
where tempBlockName is the name of a block nested
in the block definition of parentBlockName.
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for ent
(vla-item (vla-get-blocks doc) "parentBlockName")
(if (and
(= (vla-get-objectname ent) "AcDbBlockReference")
(= (vla-get-name ent) "tempBlockName")
)
(vla-put-name ent "newBlockName")
)
)
(vla-regen doc acAllViewports)
Ian