Author Topic: Change TXT.shx to SIMPLEX.shx in all Text Styles  (Read 3220 times)

0 Members and 1 Guest are viewing this topic.

w64bit

  • Newt
  • Posts: 78
Change TXT.shx to SIMPLEX.shx in all Text Styles
« on: May 12, 2021, 08:23:28 AM »
How can I change using lisp the font txt.shx to simplex.shx (width 0.80) in Text Styles?
It could be more than one text style using txt.shx.
« Last Edit: May 26, 2021, 11:59:54 AM by w64bit »

kpblc

  • Bull Frog
  • Posts: 396
Re: Change txt font to simplex in Text Styles
« Reply #1 on: May 12, 2021, 10:57:05 AM »
I didn't check this code.
Code - Auto/Visual Lisp: [Select]
  1. (defun c:t1 (/ adoc)
  2.     (if (and (/= (vla-get-fontfile item) "") (/= (vla-get-fontfile item) "txt.shx"))
  3.       (vla-put-fontfile item "simplex.shx")
  4.     ) ;_ end of if
  5.   ) ;_ end of vlax-for
  6.   (vla-endundomark adoc)
  7.   (princ)
  8. ) ;_ end of defun
Sorry for my English.

w64bit

  • Newt
  • Posts: 78
Re: Change txt font to simplex in Text Styles
« Reply #2 on: May 12, 2021, 12:02:12 PM »
it's loading and it's running without errors.
Unfortunately it does not change the font.

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: Change txt font to simplex in Text Styles
« Reply #3 on: May 12, 2021, 12:42:21 PM »
change the not equal  to equal :
Code - Auto/Visual Lisp: [Select]
  1. (/= (vla-get-fontfile item) "txt.shx") ;| to be |; (= (vla-get-fontfile item) "txt.shx")

w64bit

  • Newt
  • Posts: 78
Re: Change txt font to simplex in Text Styles
« Reply #4 on: May 12, 2021, 01:37:15 PM »
Thank you very much kpblc and Tharwat.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Change txt font to simplex in Text Styles
« Reply #5 on: May 12, 2021, 01:41:52 PM »
Could i ask if you wanted to change all fonts within the text styles?

I am guessing i would change:

Code: [Select]
(if (and (/= (vla-get-fontfile item) "") (/= (vla-get-fontfile item) "")) ;;remove the font name?
Just curious!
Civil3D 2020

w64bit

  • Newt
  • Posts: 78
Re: Change txt font to simplex in Text Styles
« Reply #6 on: May 12, 2021, 02:02:01 PM »
@MSTG007: I want to change the font only for the text styles which are using txt.shx.
« Last Edit: May 13, 2021, 08:09:31 AM by w64bit »

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Change txt font to simplex in Text Styles
« Reply #7 on: May 13, 2021, 08:05:16 AM »
lol Sorry i was not clear.

I did not know what I would have needed to modify to get it to change all text styles within a dwg to the txt.shx.
Civil3D 2020

w64bit

  • Newt
  • Posts: 78
Re: Change txt font to simplex in Text Styles
« Reply #8 on: May 13, 2021, 08:17:30 AM »
Tried with simplex instead simplex.txt. No change.
« Last Edit: May 26, 2021, 11:56:14 AM by w64bit »

w64bit

  • Newt
  • Posts: 78
Re: Change txt font to simplex in Text Styles
« Reply #9 on: May 26, 2021, 11:58:54 AM »
I attached the drawing with 3 fonts to change the style's font to simplex.shx.
Can anyone test the attached lisp. On my machine it's not working.
Thanks
« Last Edit: May 26, 2021, 12:35:50 PM by w64bit »

Lonnie

  • Newt
  • Posts: 175
Re: Change TXT.shx to SIMPLEX.shx in all Text Styles
« Reply #10 on: May 26, 2021, 12:59:47 PM »
Fairly similar

http://www.theswamp.org/index.php?topic=55991.msg599756#msg599756

Code: [Select]

;set fonts all fonts to arial.
 
 (if (findfile (setq f (strcat (getenv "windir") "\\Fonts\\Arial.ttf")))
    (progn
      (vlax-for s (vla-get-textstyles (setq doc (vla-get-activedocument (vlax-get-acad-object))))




        (vla-put-fontfile s f)
        (vla-put-width s 1.0)
        ;; RJP » 2020-04-29
        (vla-setfont s "Arial" :vlax-false :vlax-false 0 34)
      )
      (vla-regen doc acallviewports)
    )
  )

Worked for me.

w64bit

  • Newt
  • Posts: 78
Re: Change TXT.shx to SIMPLEX.shx in all Text Styles
« Reply #11 on: May 26, 2021, 01:14:41 PM »
This code it's good to change all fonts but I want to change only the styles having txt.shx, monotxt.shx, monotxt8.shx fonts, and not touching the rest.

Lonnie

  • Newt
  • Posts: 175
Re: Change TXT.shx to SIMPLEX.shx in all Text Styles
« Reply #12 on: May 26, 2021, 01:16:14 PM »
Perhaps next time I'll read the post a little better.
 :uglystupid2:

tombu

  • Bull Frog
  • Posts: 289
  • ByLayer=>Not0
Re: Change TXT.shx to SIMPLEX.shx in all Text Styles
« Reply #13 on: May 29, 2021, 09:40:24 AM »
Usually whenever I get outside drawing with a huge list of odd text styles I've always used T.Willey's Merge text styles to clean them up and make them more readable. http://www.theswamp.org/index.php?topic=17659.0;all
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

w64bit

  • Newt
  • Posts: 78
Re: Change TXT.shx to SIMPLEX.shx in all Text Styles
« Reply #14 on: May 29, 2021, 10:38:21 AM »
MTS it's very good. Thank you.
The main problem remains: I have a couple of hundreds DWG with this font issue and I cannot find a way to fix it.