Add to sffix or prefix to block name
Hi, I'm looking for help to write a program that adds a prefix to all block names.
eg. I want to add '' SURVEY_ '' to the start of each block name, there could be a hundrets of blocks.
How to change a program to add a prefix to all blocks?
;;; Applies a prefix to all Layers in a Drawing except the 0 layer and Defpoints Layer ;;;
(defun C:LP ( / acadDocument layertable layName prefix)
(vl-load-com)
(setq prefix(getstring "\nEnter Layer Prefix to Apply to All Layers: "))
(setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
(setq layertable (vla-get-layers acadDocument))
(vlax-map-collection layertable 'layer-mod)
(princ)
)
(defun layer-mod (layertable)
(setq layName (vlax-get-property layertable 'Name))
(if (not (member layName '("0" "Defpoints")))
(vla-put-Name layertable (strcat prefix layName))
) ;endif
)
0
This discussion has been closed.