:Batch unification of CAD text fonts (one-click font change, with source code)-empirical point of view免费ppt模版下载-道格办公

Batch unification of CAD text fonts (one-click font change, with source code)

Sorry, being a text model, I cannot provide source code or actual programming functionality. However, I can provide you with an idea to realize batch unified operation of CAD text fonts. One method of realization is to use AutoCAD's AutoLISP programming l

In project bidding, we often encounter the requirement that the drawing text adopt the specified unified font. Especially in dark marks. If there is no attention to the uniformity of fonts during the drawing process, or even part of the content in the drawings is copied from the original project drawings, it may cause many font styles in the drawings. The fonts invoked by each font style may be different, and the parameters such as character width and character height of each font style may be different. If it is considered to apply all the text in the drawing with a new text style of a specific font, it may cause all the original parameters of the CAD text, such as height and width, to be confused.

The best way is to modify the font of the corresponding text style without changing the text style. If there are many font styles, it will be troublesome to change them one by one.

The following is an introduction to how to implement bulk consent to modify text fonts through LISP.

Note: Do not modify the original character width, character height and other parameters.

In this way, it is impossible to use the modification to uniformly modify the text style as one, which will cause all text, character height, character width and other parameters to call the content of this font style, resulting in inconsistent typesetting.

If you can keep the original font style unchanged, just modify the corresponding font in the font style, you can agree to the font without changing the layout.

The idea of ​​using LISP to batchtext fonts is as follows:

1. Get all layer style names in the current document.

2. Use the style command in CAD to modify the font corresponding to the text style, and keep the original parameters unchanged.

3. Batch process all font styles in the document through the loop function.

The implementation source code is as follows:

;;***Batch modify text style font to XX font***

(defun C:T1 (/ TxtStyles TxtStyleList TxtStyleListLenth i) ;;T1 is the function start command, which can be customized

(vl-load-com) ;;Load LISP extension

(setq TxtStyles (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)))) ;;Get the collection of font styles in the file

(setq TxtStyleList '()) ;;Create an empty table to store the obtained text style names

;;Traverse the text style collection, save the text style name in the table

(vlax-for TxtStyle TxtStyles

(setq TxtStyleList (cons (vla-get-name TxtStyle) TxtStyleList))

)

(setq TxtStyleListLenth (length TxtStyleList));;Get the length of the text style name list, that is, how many text styles there are in total

(setq i 0) ;; used for loop count

;;Create a loop to modify the font corresponding to each font style in batches

(repeat TxtStyleListLenth

(command '_.style' (nth i TxtStyleList ) 'Arial' '' '' '' '' '') ;;Modify the text, the main modification here is the font, and the others remain unchanged Change

(setq i (+ i 1))

)

)

;;***Batch modify text style font to XX font***

If it is difficult to edit the LISP source code, you can also use the font batch modification function of Xiaoge CAD Toolbox for quick modification.

Xiaoge CAD Toolbox provides a one-click modification function for three commonly used fonts, which can replace the fonts called by all text styles in the drawings with one click, such as Song, Hei, and Chinese national standard large fonts. At the same time, the character height, character width and other parameters of the original font style are retained.

The specific function demonstration is as follows:

One Key Song Typeface: YJST

Change the fonts corresponding to all the text styles in the drawings to Arial,

There may be a large area of ​​question marks after the change, save and close the CAD after the change (restart the CAD software), and the Song Dynasty will take effectThis process is irreversible, please backup the drawing first

Demo:

One-click boldface: YJHT

Change the font corresponding to all text styles in the drawing to bold,

There may be a large area of ​​question marks after the change, save and close the CAD (restart the CAD software), and the black body will take effectThis process is irreversible, please backup the drawing first

Demo:

One key national standard: YJGB

Change the font corresponding to all the text styles in the drawing to national standard,

There may be a large area of ​​question marks after the change, save and close the CAD (restart the CAD software), the national standard will take effectThis process is irreversible, please backup the drawing first

Demo:


The above tools come from Xiaoge CAD Toolbox.

Xiaoge CAD Toolbox is an extended CAD tool set. More than 100 practical and convenient functions are provided. Xiaoge CAD Toolbox simplifies the work that can only be done in multiple steps to a few steps or even one step, simplifies the manual repetitive work to semi-automatic or even automatic, and improves the CAD drawing efficiency as much as possible from the details.

All functions support panel operation and custom shortcut key operation

How to get Xiaoge CAD toolbox:

Send 'Xiaoge CAD Toolbox' in the official account, and you will receive the download address


If you have any questions, please contact my personal WeChat :

My WeChat/QQ: 1026539820

Backup WeChat/QQ: 2261896995

If you have related questions, consult and discuss, you can join my QQ group:

CAD exchange learning group: 311710655

EXCEL Technical Exchange Group: 499560580

Follow my WeChat official account for more CAD skills

Follow the official account

Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/Batch%20unification%20of%20CAD%20text%20fonts%20oneclick%20font%20change%20with%20source%20code.html

Like (810)
Reward 支付宝扫一扫 支付宝扫一扫
single-end

Related Suggestion