Automating the removal/replacement of ltypeshp.shx from all text styles.

Automating the removal/replacement of ltypeshp.shx from all text styles.

strawberry12
Advocate Advocate
855 Views
2 Replies
Message 1 of 3

Automating the removal/replacement of ltypeshp.shx from all text styles.

strawberry12
Advocate
Advocate

Hi,

 

We've inherited some drawings with myriad Text Styles defined, some of which specify ltypeshp.shx as the Font.

 

Presumably, this was done in error, because I can't think why you would define a Text Style with a 'Font' that was really just a series of random shapes - but I'm happy to stand corrected on that!

 

Anyway, defining this 'Font' in these Text Styles interferes with the proper use of those shapes for linetypes - things like Batting, Fencelines, etc. So, I'd like to replace every instance of the 'Font', wherever it occurs in a Text Style, with something else, e.g. simplex.shx.

 

Any ideas how to automate that process?

0 Likes
856 Views
2 Replies
Replies (2)
Message 2 of 3

alex101000
Collaborator
Collaborator

Load this lisp script and run CF - change font all text style to ISOCPEUR.ttf

 

(vl-load-com)
(defun setfont (font-name / selset)
(if (findfile font-name)
(progn
(vlax-for style
(vla-get-textstyles
(vla-get-activedocument (vlax-get-acad-object))
) ;_ end of vla-get-textstyles
(vl-catch-all-apply
'(lambda () (vla-put-fontfile style (findfile font-name)))
) ;_ end of VL-CATCH-ALL-APPLY
) ;_ end of vlax-for
) ;_ end of progn
) ;_ end of if
) ;_ end of defun


(defun C:cf ()
 (setfont "c:\\windows\\fonts\\ISOCPEUR.ttf")
 (redraw)
 (vla-regen (vla-get-activedocument (vlax-get-acad-object)) acactiveviewport)
)

 

--
Please select the Accept as Solution button if my post solves your issue or answers your question.
0 Likes
Message 3 of 3

strawberry12
Advocate
Advocate

This is certainly a solution - but this changes ALL styles to ISCOPEUR (or whatever). I'd prefer to change only those styles that have ltypeshp.shx defined as their font