Hi,
I am setting text fine until I try to set the Justify property. Then it places the text at 0,0.
Can anyone point me where I am going wrong?
Thanks,
using (Transaction tr = doc.Database.TransactionManager.StartTransaction())
{
Point3d loc = new Point3d();
foreach (ObjectId Id in res.Value.GetObjectIds())
{
MText mtxt = (MText)tr.GetObject(Id, OpenMode.ForRead);
loc = mtxt.Location;
string strAllLines = mtxt.Text;
StringReader reader = new StringReader(strAllLines);
string strRooomId = reader.ReadLine();
DBText txt = new DBText();
txt.Justify = AttachmentPoint.MiddleCenter;
txt.Height = mtxt.TextHeight;
txt.TextString = strRooomId;
txt.Position = loc;
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(doc.Database.CurrentSpaceId, OpenMode.ForWrite);
btr.AppendEntity(txt);
tr.AddNewlyCreatedDBObject(txt, true);
}
tr.Commit();
Mike Caruso
Autodesk Certified Instructor 2014
AutoCAD/Civil 3D Autodesk Certified Professional 2014, 2015, 2018
www.whitemountaincad.com