设置文字生成标记
 
 

The text generation flag specifies if text is displayed backwards or upside-down. Use the FlagBits property to define if a text style controls the display of text to be displayed backwards or upside-down, or use the IsMirroredInX and IsMirroredInY properties of a text object to control individually control a text object.

文字生成标志指定文字是否要反向或倒置显示。使用 FlagBits 属性定义文字样式是否控制文字的反向或倒置显示,或使用文字对象的 IsMirroredInXIsMirroredInY 属性单个的控制文字对象。

Set FlagBits to 2 if you want text to be displayed backwards and 4 if it should be displayed upside-down. Use a value of 6 to display text both backwards and upside-down. If you are modifying a text object, set IsMirroredInX to TRUE if you want the text to appear backwards and set IsMirroredInY to TRUE if you want it to be displayed upside-down.

如果想文字显示为反向,请设置 FlagBits 为2,如果设置为4将倒置显示文字。使用值6,文字将显示为反向和倒置。如果修改文字对象,如果想文字显示为反向的,请将 IsMirroredInX 设置为 True,而如果想文字倒置显示,请将 IsMirroredInY 设置为 True。

反向显示文字

The following example creates a single-line text object, then sets it to be displayed backwards using the IsMirroredInX property.

本例创建一个单选文本对象,然后利用 IsMirroredInX 属性设置它反向显示。

VB.NET

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
 
<CommandMethod("BackwardsText")> _
Public Sub BackwardsText()
  '' 获得当前文档和数据库   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 Model space 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.SetDatabaseDefaults()
      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 the transaction
      acTrans.Commit()
  End Using
End Sub

C#

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
 
[CommandMethod("BackwardsText")]
public static void BackwardsText()
{
  // 获得当前文档和数据库   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
      BlockTable acBlkTbl;
      acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,
                                   OpenMode.ForRead) as BlockTable;
 
      // 以写方式打开模型空间块表记录   Open the Block table record Model space 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.SetDatabaseDefaults();
      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 the transaction
      acTrans.Commit();
  }
}
VBA/ActiveX 代码参考