Set MLeader to Existing MLeader Style via LISP
Hello,
I am trying to create a lisp routine that sets all existing MLEADERs to a certain pre-set MLEADERSTYLE, the equivalent of doing a Quick Select for Mleaders, and setting the style under the properties window.
I was able to write a similar routine that selects all dimensions and sets them to a certain DIMSTYLE, using entmod and DXF code 3 for dimstyle. So far, I have not been able to find a group code for MLEADERSTYLE
Any help would be greatly appreciated!
(defun C:dimstylechange (/ ENTITIES NO_OF_ENTITIES SSPOSITION ENTITY_NAME
OLD_ENTLIST NEW_STYLE NEW_ENTLIST)
(setvar "CMDECHO" 0)
(setq ENTITIES (ssget "X" '((0 . "DIMENSION"))))
(setq NO_OF_ENTITIES (sslength ENTITIES))
(setq SSPOSITION 0)
(repeat NO_OF_ENTITIES
;***CHANGE STYLE***
(setq ENTITY_NAME (ssname ENTITIES SSPOSITION))
(setq OLD_ENTLIST (entget ENTITY_NAME))
(setq OLD_STYLE (assoc 3 OLD_ENTLIST))
(setq NEW_STYLE (cons 3 "BCR 11x17"))
(setq NEW_ENTLIST (subst NEW_STYLE OLD_STYLE OLD_ENTLIST))
(entmod NEW_ENTLIST)
;***CHANGE LAYER***
(setq OLD_ENTLIST (entget ENTITY_NAME))
(setq OLD_STYLE (assoc 8 OLD_ENTLIST))
(setq NEW_STYLE (cons 8 "DIM"))
(setq NEW_ENTLIST (subst NEW_STYLE OLD_STYLE OLD_ENTLIST))
(entmod NEW_ENTLIST)
(setq SSPOSITION (1+ SSPOSITION))
)
(command ".CHPROP" ENTITIES "" "C" "BYLAYER" "LT" "BYLAYER" "")
(princ (strcat "\n..." (rtos NO_OF_ENTITIES 2 0) " Dimension(s) changed..."))
(setvar "CMDECHO" 1)
(princ)
)