标签:editor https on() 关于 The multi tar width tty
创建多重引线的代码在网络上能够搜索到很多,
但里面关于文本左右对齐设置的却很难找到,
Kean的博客里JIG相关的内容,
但也没有找到调整文本左右对齐的内容,
经过多次搜索,
尝试不同的关键字,
总算在AU社区中找到了一篇帖子,
里面有解决方法。
链接在此.
在此向原贴作者Gilles Chanteau表示感谢!
代码复制如下:
static void AddMleader(Point3d startPoint, Point3d endPoint, string textContents, double textWidth, double textHeight) { var doc = Application.DocumentManager.MdiActiveDocument; var db = doc.Database; var ed = doc.Editor; using (var tr = db.TransactionManager.StartTransaction()) { var mleader = new MLeader(); mleader.SetDatabaseDefaults(); mleader.ContentType = ContentType.MTextContent; int index = mleader.AddLeader(); mleader.AddLeaderLine(index); mleader.AddFirstVertex(index, startPoint); mleader.AddLastVertex(index, endPoint); MText mtext = new MText(); mtext.SetDatabaseDefaults(); mtext.Width = textWidth; mtext.Height = textHeight; mtext.Contents = textContents; mleader.MText = mtext; mtext.Location = mleader.TextLocation; if (endPoint.X < startPoint.X) { var offset = (mleader.DoglegLength + mleader.LandingGap) * 2 + mtext.ActualWidth; mleader.MoveMLeader(Vector3d.XAxis * -offset, MoveType.MoveContentAndDoglegPoints); } var cSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite); cSpace.AppendEntity(mleader); tr.AddNewlyCreatedDBObject(mleader, true); tr.Commit(); } }
标签:editor https on() 关于 The multi tar width tty
原文地址:https://www.cnblogs.com/myzw/p/14848058.html