
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a central file that contains all our various styles including our multileader styles. We use a simple macro to insert this drawing into our working drawings to bring in all the styles and such, which is fine and good. The issue is that we have recently changed our mleaderstyles (I have made the changes to them in the template file) and now we want to be able to update our leaderstyles by reimporting them in all our working drawings, and when we use the macro to insert the template it doesn't update any information because it sees that mleaderstyles already exist in the ACAD_MLEADERSTYLE dictionary.
The ideal solution would be a way to make cad accept the new values instead of sticking to the existing definitions in the drawing.
Failing that I have been trying to come up with a lisp routine that will rename all the existing leaderstyles by appending "temp" to the end of there name, import the template (now that the names are no longer in use), then change the leaderstyle of all existing leader objects in the drawing to the correct leaderstyle, and lastly purge the now unused leaderstyles with "temp" in the name. Attempting this method I have encountered issues with entmod statements not seeming to have any effect on the style names. This is the current rough attempt at renaming the leader styles in the drawing:
(defun c:UPDATE_LEADERSTYLES ( / dic styles)
(setq dic (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE"));get the leaderstyle dictionary
(foreach data dic ;for each piece of data in the dictionary object
(if (= (car data) 350);if the data is a leaderstlye object
(setq styles (append styles (list (cdr data))));add it to a list
)
)
(foreach style styles ;for each style object found
(entmod (subst (cons 3 (strcat (cdr (assoc 3 (entget style))) "temp")) (assoc 3 (entget style)) (entget style)));replace the name of the style with the current name + "temp"
)
(princ);quiet exit
)
I'd also be interested in a method that uses visual lisp if it is less verbose or more efficient, but my knowledge of visual lisp is not great and I've been struggling to find good documentation for things I need, so along those lines I've only gotten so far as finding the dictionary object that contains the mleaderstyles:
(setq mleaderdic (vla-item (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object))) "ACAD_MLEADERSTYLE"))
Any help to come up with an effective solution would be greatly appreciated.
Solved! Go to Solution.