Message 1 of 5
Cleanup file stripmtext not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to create a cleanup lisp for general housekeeping. Forgive me if there are blatant problems. I know some of my variable are just flat wrong at this point. I've edited it so many times I'm not sure what works. Still I have to give you all someplace to start so here it is. Worts and all.
What it should do is strip mtext, runs overkill changes fonts and erases solids and puts everything to bylayer.
Biggest problem seems to be the StripMtext. Sometimes it works most of the time it does not. It seems to be the selection set will just not work something.
Can anyone help me pretty this up?
(defun c:exl ()
;; Select all entities in the drawing
(setq all_ss (ssget "x"))
(if all_ss
(StripMtext all_ss "CFHQOSTUQN")
)
;; Change properties of selected entities to ByLayer
(command "chprop" all_ss "" "c" "bylayer" "")
;; Run Overkill on selected entities
(command "overkill" all_ss "")
;; Select all solids
(setq solids (ssget "_X" '((0 . "SOLID"))))
;; Erase selected solids
(if solids
(command "erase" solids "")
)
;; change everything to bylayer
(command "chprop" prev_ss "" "c" "bylayer" "")
;; Change text styles to Arial Narrow
(setq font_path (strcat (getenv "windir") "\\Fonts\\Arial.ttf"))
(if (findfile font_path)
(progn
(vlax-for s (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)))
(vla-put-fontfile s font_path)
(vla-put-width s 1.0)
;; Change font to Arial
(vla-setfont s "Arial Narrow" :vlax-false :vlax-false 0 34)
)
;; Regenerate the drawing
(vla-regen (vla-get-activedocument (vlax-get-acad-object)) acallviewports)
)
)
;; Indicate completion
(prompt "\nProcessing completed.")
(princ)
)
Once again sorry for the blatant errors.