文本生成标志指定文本是向后显示还是倒置显示。使用该属性可以定义文本样式是控制要向后显示的文本的显示还是倒置显示,或者使用文本对象的 and 属性来单独控制文本对象。FlagBitsIsMirroredInXIsMirroredInY 如果希望向后显示文本,请设置为 2,如果要倒置显示文本,请设置为 4。使用值 6 向后和上下显示文本。如果要修改文本对象,请设置为“如果希望文本向后显示”,如果希望将其倒置显示,请设置为“TRUE”。FlagBitsIsMirroredInXTRUEIsMirroredInY 向后显示文本下面的示例创建一个单行文本对象,然后使用该属性将其设置为向后显示。IsMirroredInX VB.NETImports 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 Using 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) End Using '' 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 using (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 the transaction acTrans.Commit(); } } VBA/ActiveX 代码参考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 the TextGenerationFlag textObj.TextGenerationFlag = acTextFlagBackward textObj.Update End Sub 相关概念父主题: |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:15
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.