Add Text to Drawings向图形中添加文字

Text conveys important information in yourdrawing. Use text objects for title blocks, to label parts of the drawing, togive specifications, or to make annotations.

图形中的文字可以表达重要信息。文字对象可以用于标题栏、标注图形部件、技术要求,或者注释等。

AutoCAD provides various ways to createtext. For short, simple entries, use single line text. For longer entries withinternal formatting, use multiline text (MText). Although all entered text usesthe current text style, which establishes the default font and format settings,you can use several methods to customize the text appearance.

AutoCAD提供了多种创建文字的方式。对短小简单的实体,可以使用单行文字。对于具有内部格式的较长的实体,可以使用多行文字(MText)。尽管所有键入的文字都使用规定了默认字体和格式的当前文字式样,我们仍可以用好几种方法来定制文字的外观。

For more information about working withtext, see “Create Text” in theAutoCAD User's Guide.

更多关于使用文字的内容,参见AutoCAD用户指南中的“创建文字”。

Topics in this section本节主题:

·        Work with Text Styles使用文字样式

·        Use Single-Line Text (Text)使用单行文字

·        Use Multiline Text (MText)使用多行文字

·        Use Unicode Characters, Control Codes, and SpecialCharacters使用Unicode字符、控制码、特殊字符

·        Substitute Fonts替换字体

·        Check Spelling拼写检查

1、Workwith Text Styles使用文字样式

All text in an AutoCAD drawing has a styleassociated with it. When you enter text, AutoCAD uses the current text style,which sets the font, size, angle, orientation, and other text characteristics.You can use or modify the default style or create and load a new style. Onceyou've created a style, you can modify its attributes or delete it when you nolonger need it.

AutoCAD图形中的所有文字都具有与之关联的样式。我们输入文字时,AutoCAD使用当前文字样式,该样式设置了文字的字体、大小、角度、方向,及其他文字特性。我们可以对默认样式进行修改,或创建并加载新样式。一旦创建了文字样式,我们就可以修改其属性,不再需要时可以将其删除。

Topics in this section本小节内容:

·        Createand Modify Text Styles创建和修改文字样式

·        AssignFonts指定字体

·        UseTrueType Fonts使用TrueType字体

·        UseUnicode and Big Fonts使用Unicode字体和大字体

·        SetText Height设置文字高度

·        SetObliquing Angle设置文字倾角

·        SetText Generation Flag设置文字生成标志

1.1、Createand Modify Text Styles 创建和修改文字样式

New text inherits height, width factor,obliquing angle, and text generation properties from the current text style. Tocreate a text style, create a new instance of a TextStyleTableRecord object.Assign the new text style a name using the Name property. Then open the TextStyleTableobject for write and use theAdd method to create the new text style.

新建文字从当前文字样式继承高度/宽度系数、倾斜角度、文字生成属性等。创建文字样式的步骤,首先新建一个TextStyleTableRecord对象的实例,用Name属性给新文字样式命名,然后以写方式打开TextStyleTable对象,用Add方法创建新文字样式。

Style names can contain letters, numbers,and the special characters dollar sign ($), underscore (_), and hyphen (-).AutoCAD converts the characters to uppercase. If you do not enter a style name,the new style will not have a name.

样式名可以包含字母、数字和美元符号($)、下划线(_)、连字符(-)等特殊字符。AutoCAD会将字符均转换成大写。要是不输入样式名,新样式将没有名字。

You can modify an existing style bychanging the properties of the TextStyleTableRecord object. If you want to workwith the current text style, use theTextStyle property of the Database object which holds the object id of the current text style.

我们可以通过修改TextStyleTableRecord对象的属性来修改现有样式。如果要使用当前文字样式,引用Database对象的TextStyle属性即可,该属性含有当前文字样式的ObjectId。

You can also update existing text of thatstyle type to reflect the changes. Use the following properties to modify aTextStyleTableRecord object:

我们还可以更新现有文字以反映出对样式的修改。使用下列属性来修改TextStyleTableRecord对象:

BigFontFileName

Specifies the special shape definition file used for anon-ASCII character set.指定用于非ASCII字符集的特殊形定义文件;

FileName

Specifies the file associated with a font (characterstyle).指定与字体关联的文件;

FlagBits

Specifies backward text, upside-down text, or both.指定反向文字、颠倒文字,或两者;

Font

Specifies the typeface, bold, italic,character set, and pitch and family settings of the text style.指定字样、粗细、倾斜、字符集、间距,及文字样式的公共设置;

IsVertical

Specifies vertical or horizontal text.指定文字方向;

ObliquingAngle

Specifies the slant of the characters. 指定字符的倾斜角度;

TextSize

Specifies the character height. 指定字符高度;

XScale

Specifies the expansion or compression of the characters.指定字符的缩放比例;

If you change an existing style's font ororientation, all text using that style is changed to use the new font ororientation. Changing text height, width factor, and oblique angle does notchange existing text but does change subsequently created text objects.

如果修改了现有样式的字体或方向,使用该样式的所有文字都会更改为新的字体或方向。修改文字高/宽系数、倾角等不会更新现有文字,但会在随后创建的文字上体现所作的样式修改。

NoteThe drawing must be regenerated to see any changes to theabove properties.

注意:重新生成图形才会看到对上述属性所做的修改。

1.2、AssignFonts 指定字体

Fonts define the shapes of the textcharacters that make up each character set. A single font can be used by morethan one style. Use theFileName property to set the font file for thetext style. You can assign TrueType or AutoCAD-compiled SHX fonts to a textstyle.

字体定义了构成每个字符集的字符形状。一个字体可以用于多个样式。给文字样式设置字体文件用FileName属性。我们可以给文字样式指定TrueType字体或AutoCAD编译字形字体。

Set text fonts设置文字字体

The following example gets the currentfont values using theFont property for the active text style andthen changes the typeface for the font to “PlayBill” . To see the effects ofchanging the typeface, add some multiline or single-line text to your currentdrawing before running the example. Note that, if you don't have the PlayBillfont on your system, you need to substitute a font you do have in order forthis example to work.

下面的例子使用当前文字样式的Font属性获取当前的字体值,然后将字体的字样修改为“PlayBill”。想看看修改字样的效果,可在运行示例代码前往当前图形中添加一些多行文字或单行文字。注意如果你的系统没有PlayBill字体,需要替换一个别的字体以确保代码能正确运行。

VB.NET

ImportsAutodesk.AutoCAD.Runtime

ImportsAutodesk.AutoCAD.ApplicationServices

ImportsAutodesk.AutoCAD.DatabaseServices

<CommandMethod("UpdateTextFont")>_

Public SubUpdateTextFont()

'' Get the current document and database

Dim acDoc As Document =Application.DocumentManager.MdiActiveDocument

Dim acCurDb As Database = acDoc.Database

'' Start a transaction

Using acTrans As Transaction =acCurDb.TransactionManager.StartTransaction()

'' Open the current text style for write

Dim acTextStyleTblRec AsTextStyleTableRecord

acTextStyleTblRec =acTrans.GetObject(acCurDb.Textstyle, _

OpenMode.ForWrite)

'' Get the current font settings

Dim acFont AsAutodesk.AutoCAD.GraphicsInterface.FontDescriptor

acFont = acTextStyleTblRec.Font

'' Update the text style's typeface with"PlayBill"

Dim acNewFont AsAutodesk.AutoCAD.GraphicsInterface.FontDescriptor

acNewFont = New  _

Autodesk.AutoCAD.GraphicsInterface.FontDescriptor("PlayBill",_

acFont.Bold, _

acFont.Italic,_

acFont.CharacterSet, _

acFont.PitchAndFamily)

acTextStyleTblRec.Font = acNewFont

acDoc.Editor.Regen()

'' Save the changes and dispose of thetransaction

acTrans.Commit()

End Using

End Sub

C#

usingAutodesk.AutoCAD.Runtime;

usingAutodesk.AutoCAD.ApplicationServices;

usingAutodesk.AutoCAD.DatabaseServices;

usingAutodesk.AutoCAD.GraphicsInterface;

[CommandMethod("UpdateTextFont")]

public static voidUpdateTextFont()

{

// Get the current document and database获取当前文档及数据库

Document acDoc =Application.DocumentManager.MdiActiveDocument;

Database acCurDb = acDoc.Database;

// Start a transaction启动事务

using (Transaction acTrans =acCurDb.TransactionManager.StartTransaction())

{

// Open the current text style for write以写打开当前文字样式

TextStyleTableRecord acTextStyleTblRec;

acTextStyleTblRec =acTrans.GetObject(acCurDb.Textstyle,

OpenMode.ForWrite) as TextStyleTableRecord;

// Get the current font settings获取当前字体设置

FontDescriptor acFont;

acFont = acTextStyleTblRec.Font;

// Update the text style's typeface with"PlayBill"更改字样为PlayBill

FontDescriptor acNewFont;

acNewFont = new FontDescriptor("PlayBill",

acFont.Bold,

acFont.Italic,

acFont.CharacterSet,

acFont.PitchAndFamily);

acTextStyleTblRec.Font = acNewFont;

acDoc.Editor.Regen();

// Save the changes and dispose of thetransaction保存修改,关闭事务

acTrans.Commit();

}

}

VBA/ActiveX CodeReference

Sub UpdateTextFont()

MsgBox ("Look at the textnow...")

Dim typeFace As String

Dim SavetypeFace As String

Dim Bold As Boolean

Dim Italic As Boolean

Dim charSet As Long

Dim PitchandFamily As Long

' Get the current settings to fill in the

' default values for the SetFont method

ThisDrawing.ActiveTextStyle.GetFonttypeFace, _

Bold, Italic, charSet,PitchandFamily

' Change the typeface for the font

SavetypeFace = typeFace

typeFace = "PlayBill"

ThisDrawing.ActiveTextStyle.SetFonttypeFace, _

Bold, Italic, charSet,PitchandFamily

ThisDrawing.Regen acActiveViewport

End Sub

1.3、UseTrueType Fonts 使用TrueType字体

TrueType fonts always appear filled inyour drawing; however, when you plot, the TEXTFILL system variable controlswhether the fonts are filled. By default TEXTFILL is set to 1 to plot thefilled-in fonts. When you export a drawing to PostScript® format andprint it on a PostScript device, the font is plotted as designed.

TrueType字体在图形中总是填充的,不过打印时系统变量TEXTFILL控制字体是否填充。默认情况下TEXTFILL变量置为 1,表示打印填充字体。当我们将图形导出为PostScript®格式并在PostScript®设备上打印时,打印出的字体就会如设计所愿。

1.4、UseUnicode and Big Fonts 使用Unicode字体和大字体

AutoCAD supports the Unicodecharacter-encoding standard. A Unicode font can contain 65,535 characters, withshapes for many languages. All of the AutoCAD SHX shape fonts that are shippedwith the product support Unicode fonts.

AutoCAD支持Unicode字符编码标准。Unicode字体包含65535个字符,可以囊括许多语言的字形。随AutoCAD软件安装的所有AutoCAD SHX字形字体均支持Unicode字体。

The text files for some alphabets containthousands of non-ASCII characters. To accommodate such text, AutoCAD supports aspecial type of shape definition known as a Big Font file. You can set a styleto use both regular and Big Font files. Specify normal fonts using the FileName property. Specify Big Fonts using theBigFontFileName property.

有些语言的文本文件含有成千的非ASCII字符。为了顺应这些文字,AutoCAD支持一种称为大字体文件的特殊字形定义类型。我们在设置文字样式时,使用常规字体文件和大字体文件都行。指定常规字体使用FileName属性,指定大字体使用BigFontFileName属性。

NoteFont file names cannot contain commas.

注意:字体文件名不能含有逗点。

AutoCAD allows you to specify an alternatefont to use when a specified font file cannot be located. Use the FONTALTsystem variable and theSetSystemVariable member method of the Application tochange the alternate font used.

当指定的字体文件不能定位时,AutoCAD允许指定一个替换字体。使用系统变量FONTALT或用Application对象的SetSystemVariable成员方法来设置要使用的替换字体。

Change font files改变字体文件

The following example code changes the FileName and BigFontFileName properties. You need to replace the pathinformation listed in this example with path and file names appropriate foryour system.

下列示例代码修改FileName属性和BigFontFileName属性。你需要将代码中的路径信息替换成你的系统里相应的路径和文件名。

VB.NET

Imports Autodesk.AutoCAD.Runtime

ImportsAutodesk.AutoCAD.ApplicationServices

ImportsAutodesk.AutoCAD.DatabaseServices

<CommandMethod("ChangeFontFiles")>_

Public SubChangeFontFiles()

'' Get the current document and database

Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument

Dim acCurDb As Database = acDoc.Database

'' Start a transaction

Using acTrans As Transaction =acCurDb.TransactionManager.StartTransaction()

'' Open the current text style for write

Dim acTextStyleTblRec AsTextStyleTableRecord

acTextStyleTblRec =acTrans.GetObject(acCurDb.Textstyle, _

OpenMode.ForWrite)

'' Change the font files used for bothBig and Regular fonts

acTextStyleTblRec.BigFontFileName ="C:\AutoCAD\Fonts\bigfont.shx"

acTextStyleTblRec.FileName ="C:\AutoCAD\Fonts\italic.shx"

'' Save the changes and dispose of thetransaction

acTrans.Commit()

End Using

End Sub

C#

usingAutodesk.AutoCAD.Runtime;

using Autodesk.AutoCAD.ApplicationServices;

usingAutodesk.AutoCAD.DatabaseServices;

[CommandMethod("ChangeFontFiles")]

public static voidChangeFontFiles()

{

// Get the current document and database

Document acDoc =Application.DocumentManager.MdiActiveDocument;

Database acCurDb = acDoc.Database;

// Start a transaction

using (Transaction acTrans =acCurDb.TransactionManager.StartTransaction())

{

// Open the current text style for write

TextStyleTableRecord acTextStyleTblRec;

acTextStyleTblRec =acTrans.GetObject(acCurDb.Textstyle,

OpenMode.ForWrite) as TextStyleTableRecord;

// Change the font files used for bothBig and Regular fonts

acTextStyleTblRec.BigFontFileName ="C:/AutoCAD/Fonts/bigfont.shx";

acTextStyleTblRec.FileName ="C:/AutoCAD/Fonts/italic.shx";

// Save the changes and dispose of thetransaction

acTrans.Commit();

}

}

VBA/ActiveX Code Reference

Sub ChangeFontFiles()

ThisDrawing.ActiveTextStyle.BigFontFile = _

"C:/AutoCAD/Fonts/bigfont.shx"

ThisDrawing.ActiveTextStyle.fontFile = _

"C:/AutoCAD/Fonts/italic.shx"

End Sub

1.5、SetText Height设置文字高度

Text height determines the size in drawingunits of the letters in the font you are using. The value usually representsthe size of the uppercase letters, with the exception of TrueType fonts.

文字高度确定了所使用字体的字母大小,以图形单位计。该值通常表示大写字母的大小,但 TrueType字体除外。

For TrueType fonts, the value specifiedfor text height might not represent the height of uppercase letters. The heightspecified represents the height of a capital letter plus an accent areareserved for accent marks and other marks used in non-English languages. Therelative portion of areas assigned to capital letters and accent characters isdetermined by the font designer at the time the font is designed, and,consequently, will vary from font to font.

对于TrueType字体,文字高度值可能不表示大写字母的高度,而是大写字母的高度加上留给重音符号及用于非英语语言的其他标记的标音区域。留给大写字母和重音符号的区域的相对大小是由字体设计者在设计字体时确定的,因而会因不同的字体而异。

In addition to the height of a capitalletter and the ascent area that make up the height specified by the user,TrueType fonts have a descent area for portions of characters that extend belowthe text insertion line. Examples of such characters are y, j, p, g, and q.

指定的文字高度除了由大写字母高度和重音区域构成外,一部分TrueType字体字符还相对插入线存在一个下沉区域,这样的字符像y、j、p、g及q等。

You specify the text height using the TextSize property of the text style or theHeight property of a text object. This propertyaccepts positive numbers only.

设置文字高度用文字样式的TextSize属性或文字对象的Height属性。该属性只接受正数。

1.6、SetObliquing Angle设置文字倾角

The obliquing angle determines the forwardor backward slant of the text. The angle represents the offset from itsvertical axis (90 degrees). To set the obliquing angle, use theObliquingAngle property to change a text style or theOblique property of a text object. The obliquingangle must be provided in radians. A positive angle denotes a lean to theright, a negative value will have2*PI added to it to convert it to its positiveequivalent.

文字倾角用来确定文字的前向或后向倾斜。该角度为相对垂直轴线(90度)的偏移。设置文字倾角使用文字样式的ObliquingAngle属性或文字对象的Oblique属性。倾角单位必须是弧度,角度为正数表示向右倾斜,负数角度会加上2*PI将其转换成相应的正数角度。

Create oblique text创建倾斜文字

This example creates a single-line textobject then slants it 45 degrees.

本例创建一个单行文字对象,然后将它倾斜45度角。

VB.NET

ImportsAutodesk.AutoCAD.Runtime

ImportsAutodesk.AutoCAD.ApplicationServices

ImportsAutodesk.AutoCAD.DatabaseServices

ImportsAutodesk.AutoCAD.Geometry

<CommandMethod("ObliqueText")>_

Public SubObliqueText()

'' Get the current document and database

Dim acDoc As Document =Application.DocumentManager.MdiActiveDocument

Dim acCurDb As Database = acDoc.Database

'' Start a transaction

Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()

'' Open the Block table for read

Dim acBlkTbl As BlockTable

acBlkTbl =acTrans.GetObject(acCurDb.BlockTableId, _

OpenMode.ForRead)

'' Open the Block table record Modelspace for write

Dim acBlkTblRec As BlockTableRecord

acBlkTblRec =acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _

OpenMode.ForWrite)

'' Create a single-line text object

Dim acText As DBText = New DBText()

acText.Position = New Point3d(3, 3, 0)

acText.Height = 0.5

acText.TextString = "Hello,World."

'' Change the oblique angle of the textobject to 45 degrees(0.707 in radians)

acText.Oblique = 0.707

acBlkTblRec.AppendEntity(acText)

acTrans.AddNewlyCreatedDBObject(acText,True)

'' Save the changes and dispose of thetransaction

acTrans.Commit()

End Using

End Sub

C#

usingAutodesk.AutoCAD.Runtime;

using Autodesk.AutoCAD.ApplicationServices;

usingAutodesk.AutoCAD.DatabaseServices;

usingAutodesk.AutoCAD.Geometry;

[CommandMethod("ObliqueText")]

public static voidObliqueText()

{

// Get the current document and database获取当前文档及数据库

Document acDoc = Application.DocumentManager.MdiActiveDocument;

Database acCurDb = acDoc.Database;

// Start a transaction启动事务

using (Transaction acTrans =acCurDb.TransactionManager.StartTransaction())

{

// Open the Block table for read以读打开Block表

BlockTable acBlkTbl;

acBlkTbl =acTrans.GetObject(acCurDb.BlockTableId,

OpenMode.ForRead) as BlockTable;

// Open the Block table record Modelspace for write以写打开块表记录模型空间

BlockTableRecord acBlkTblRec;

acBlkTblRec =acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],

OpenMode.ForWrite) as BlockTableRecord;

// Create a single-line text object创建一个单行文字对象

DBText acText = new DBText();

acText.Position = new Point3d(3, 3, 0);

acText.Height = 0.5;

acText.TextString = "Hello, World!";

// Change the oblique angle of the textobject to 45 degrees(0.707 in radians)修改文字对象的倾角为45度(弧度值为0.707)

acText.Oblique = 0.707;

acBlkTblRec.AppendEntity(acText);

acTrans.AddNewlyCreatedDBObject(acText,true);

// Save the changes and dispose of thetransaction保存修改,关闭事务

acTrans.Commit();

}

}

VBA/ActiveX Code Reference

Sub ObliqueText()

Dim textObj As AcadText

Dim textString As String

Dim insertionPoint(0 To 2) As Double

Dim height As Double

' Define the text object

textString = "Hello, World."

insertionPoint(0) = 3

insertionPoint(1) = 3

insertionPoint(2) = 0

height = 0.5

' Create the text object in model space

Set textObj = ThisDrawing.ModelSpace. _

AddText(textString,insertionPoint, height)

' Change the value of the ObliqueAngle

' to 45 degrees (.707 radians)

textObj.ObliqueAngle = 0.707

textObj.Update

End Sub

1.7、SetText Generation Flag设置文字生成标志

The text generation flag specifies if textis displayed backwards or upside-down. Use theFlagBits property to define if a text stylecontrols the display of text to be displayed backwards or upside-down, or usetheIsMirroredInX andIsMirroredInY properties of a text object to control individuallycontrol a text object.

文字生成标志用来表示文字是否反向显示或倒置显示。可以用文字样式的FlagBits属性定义文字样式是否控制文字按反向或倒置显示,或者用文字对象的IsMirroredInX属性和IsMirroredInY属性单独对某个文字对象进行控制。

Set FlagBits to 2 if you want text to be displayedbackwards and 4 if it should be displayed upside-down. Use a value of 6 todisplay text both backwards and upside-down. If you are modifying a textobject, set IsMirroredInX toTRUE if you want the text to appear backwardsand setIsMirroredInY to TRUE if you want it to be displayed upside-down.

如果要反向显示文字,设置FlagBits为2;如果要倒置显示文字,设置FlagBits为4。FlagBits为6表示同时反向和倒置显示文字。要修改一个文字对象时,将IsMirroredInX属性置为TRUE表示反向显示文字,将IsMirroredInY属性置为TRUE表示倒置显示文字。

Display text backwards反向显示文字

The following example creates asingle-line text object, then sets it to be displayed backwards using theIsMirroredInX property.

下面的代码先创建一个单行文字对象,然后使用IsMirroredInX属性将其设置为反向显示。

VB.NET

ImportsAutodesk.AutoCAD.Runtime

ImportsAutodesk.AutoCAD.ApplicationServices

ImportsAutodesk.AutoCAD.DatabaseServices

ImportsAutodesk.AutoCAD.Geometry

<CommandMethod("BackwardsText")>_

Public SubBackwardsText()

'' Get the current document and database

Dim acDoc As Document =Application.DocumentManager.MdiActiveDocument

Dim acCurDb As Database = acDoc.Database

'' Start a transaction

Using acTrans As Transaction =acCurDb.TransactionManager.StartTransaction()

'' Open the Block table for read

Dim acBlkTbl As BlockTable

acBlkTbl =acTrans.GetObject(acCurDb.BlockTableId, _

OpenMode.ForRead)

'' Open the Block table record Modelspace for write

Dim acBlkTblRec As BlockTableRecord

acBlkTblRec =acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _

OpenMode.ForWrite)

'' Create a single-line text object

Dim acText As DBText = New DBText()

acText.Position = New Point3d(3, 3, 0)

acText.Height = 0.5

acText.TextString = "Hello,World."

'' Display the text backwards

acText.IsMirroredInX = True

acBlkTblRec.AppendEntity(acText)

acTrans.AddNewlyCreatedDBObject(acText,True)

'' Save the changes and dispose of thetransaction

acTrans.Commit()

End Using

End Sub

C#

using Autodesk.AutoCAD.Runtime;

usingAutodesk.AutoCAD.ApplicationServices;

usingAutodesk.AutoCAD.DatabaseServices;

usingAutodesk.AutoCAD.Geometry;

[CommandMethod("BackwardsText")]

public static voidBackwardsText()

{

// Get the current document and database获取文档及数据库

Document acDoc =Application.DocumentManager.MdiActiveDocument;

Database acCurDb = acDoc.Database;

// Start a transaction启动事务

using (Transaction acTrans =acCurDb.TransactionManager.StartTransaction())

{

// Open the Block table for read以读的方式打开Block表

BlockTable acBlkTbl;

acBlkTbl =acTrans.GetObject(acCurDb.BlockTableId,

OpenMode.ForRead) as BlockTable;

// Open the Block table record Modelspace for write以写的方式打开Block表的记录模型空间

BlockTableRecord acBlkTblRec;

acBlkTblRec =acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],

OpenMode.ForWrite) as BlockTableRecord;

// Create a single-line text object创建一个单行文字对象

DBText acText = new DBText();

acText.Position = new Point3d(3, 3, 0);

acText.Height = 0.5;

acText.TextString = "Hello,World.";

// Display the text backwards反向显示文字

acText.IsMirroredInX = true;

acBlkTblRec.AppendEntity(acText);

acTrans.AddNewlyCreatedDBObject(acText,true);

// Save the changes and dispose of thetransaction保存修改,关闭事务

acTrans.Commit();

}

}

VBA/ActiveX Code Reference

Sub BackwardsText()

Dim textObj As AcadText

Dim textString As String

Dim insertionPoint(0 To 2) As Double

Dim height As Double

'Create the text object

textString = "Hello, World."

insertionPoint(0) = 3

insertionPoint(1) = 3

insertionPoint(2) = 0

height = 0.5

Set textObj = ThisDrawing.ModelSpace. _

AddText(textString,insertionPoint, height)

' Change the value of theTextGenerationFlag

textObj.TextGenerationFlag =acTextFlagBackward

textObj.Update

End Sub

03-07 创建和编辑AutoCAD实体(七) 向图形中添加文字(1)使用文字样式相关推荐

  1. 03-07 创建和编辑AutoCAD实体(七) 向图形中添加文字(3)使用多行文字

    3.Use MultilineText (MText)使用多行文字(MText命令) For long, complex entries, createmultiline text (MText). ...

  2. 03-03 创建和编辑AutoCAD实体(三) 使用选择集(2)

    4.DefineRules for Selection Filters定义选择集过滤器规则 You can limit which objects are selectedand added to a ...

  3. 03-05 创建和编辑AutoCAD实体(五) 使用图层、颜色和线型(3)使用线型

    3.Workwith Linetypes使用线型 A linetype is a repeating pattern ofdashes, dots, and blank spaces. A compl ...

  4. 创建和编辑AutoCAD对象(VBApython)

    创建python与CAD的连接 import win32com.client import pythoncomacad = win32com.client.Dispatch("AutoCAD ...

  5. autoCAD 创建和编辑AutoCAD图元

    用户可以创建的对象的范围,从简单的直线.圆到复杂的样条曲线.椭圆和关联填充区域.通常,用户使用 AppendEntity 函数添加对象到中一个 BlockTableRecord 对象中.对象创建后,就 ...

  6. 第五章 创建和编辑AutoCAD对象

    创建二维对象 图形对象创建于ModelSpace集合.PaperSpace集合或Block对象中. import win32com.client AcadApp = win32com.client.D ...

  7. java创建的窗口无法关闭_在Java中添加canvas后无法关闭窗口(Can't close window after adding canvas in Java)...

    在Java中添加canvas后无法关闭窗口(Can't close window after adding canvas in Java) public class Screen extends Ca ...

  8. Matlab中添加网格线和编辑布局

    目录 显示网格线 在特定方向显示网格线 编辑网格线布局 修改网格线的可视外观 此示例说明如何在图形中添加网格线.它还说明了如何编辑网格线布局和修改网格线外观. 显示网格线 创建条形图并显示网格线.网格 ...

  9. wordpress简捷按钮_通过在WordPress帖子中添加快速编辑按钮来节省时间

    wordpress简捷按钮 Have you ever made a mistake in your old WordPress posts and realized it when your use ...

最新文章

  1. CF533A Berland Miners
  2. container_of(ptr, type, member)宏定义解析
  3. 软件的安装(包括yum仓库与源码包的安装)
  4. oracle文字与格式字符串不匹配的解决
  5. 最佳网页宽度及其实现
  6. Oracle学习 第20天 PL/SQL导入
  7. Exchange 2007 邮箱设置
  8. linux内核之dmaengine
  9. objective-c 编程总结(第一篇)字符串操作
  10. 交换机基础原理,冲突域和广播域
  11. Reflection probes
  12. 教你检查Mac电池的健康度
  13. TabLayout+ViewPager2联动
  14. 7-3 奥运排行榜 (25 分)
  15. 换脸上阵的路由界新面孔,联想云路由动手玩
  16. Linux:目录,文件
  17. svn拉取文件合并_svn常用命令——-自用——-持续更新中 | 学步园
  18. 计算机专业有什么劣势,各个专业有什么“优劣势”呢?
  19. 中国制造首次进入国际顶尖赛场:“中信红”点亮F1赛道
  20. T65正点原子智能烙铁】

热门文章

  1. linux 命名管道 c语言 不同进程,进程间通信 - 命名管道实现
  2. 乌鸫科技一面凉(电话面试)
  3. 将MongoDB部署到分布式集群(实操)
  4. java自签名程序_如何使机器信任自签名Java应用程序
  5. 美团2021届秋季校园招聘笔试真题解析:小团的复制粘贴
  6. 【神秘海域】[动图] 结合题目-手把手带你剖析 “带环链表”
  7. Onvif的wsdl文档地址
  8. 管网压力在线监测系统 智慧供水水务
  9. phpcms模板分解
  10. siamese(孪生) 网络