Cleanup file stripmtext not working.

Cleanup file stripmtext not working.

LDShaw
Collaborator Collaborator
186 Views
4 Replies
Message 1 of 5

Cleanup file stripmtext not working.

LDShaw
Collaborator
Collaborator

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.

0 Likes
187 Views
4 Replies
Replies (4)
Message 2 of 5

paullimapa
Mentor
Mentor
0 Likes
Message 3 of 5

LDShaw
Collaborator
Collaborator

I need most of my help on passing through 

(if all_ss
    (StripMtext all_ss "CFHQOSTUQN")
  )

 Most of the time it will not work but if I try it enough while in the same dwg all of a sudden I can't break it. I don't know if it's because some other lisp did something or what. 

The other part that is causing me heartburn is all the extra returns

(command "overkill" all_ss "")

should work I think but I've got to return past the dialog box. I'd like to remove that bit too but I've not found a way to set all those vars.

0 Likes
Message 4 of 5

paullimapa
Mentor
Mentor

I assume you've downloaded the latest version of StripMText 

If you're having trouble with using it, the best thing is to contact the author directly:

;;;; Please send comments, wish lists, or bug reports to:
;;;; cadabyss@gmail.com or lowercase@hawaii.rr.com


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 5

Sea-Haven
Mentor
Mentor

What about trying Lee-mac Stripmtext.lsp. It may work

0 Likes