Hi all,
I have to repair lot of old dimensions (want recreate it).
How can I owerwrite Textheight?
Here part of my code:
//---------------------------------------------------------------------------------
internal static bool RepairDIMs()
{
Document AcDoc = Application.DocumentManager.MdiActiveDocument;
Database AcDb = AcDoc.Database;
using (DocumentLock acLckDoc = AcDoc.LockDocument())
{
using (Transaction acTrans = AcDb.TransactionManager.StartTransaction())
{
BlockTableRecord BlkTblRecMs = acTrans.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(AcDb), OpenMode.ForWrite) as BlockTableRecord;
List<RotatedDimension> AllMsRotDimensionLs = GetAllMsRotDimensionLs(acTrans);
foreach (RotatedDimension RotDim in AllMsRotDimensionLs)
{
RotatedDimension RotDimNew = new RotatedDimension();
DBObjectCollection DbObjColl = new DBObjectCollection();
string DimTxt = string.Empty;
double TxtHeight = 2;
double TxtRot = 0;
double TxtSizeX = 0, TxtSizeY = 0;
Vector2d TxtVec2d = Vector2d.XAxis;
//---------------------------------------------
RotDim.Explode(DbObjColl);
foreach (DBObject DbObj in DbObjColl)
{
Entity Ety = DbObj as Entity;
if (Ety is DBText)
{
DBText DbTxt = Ety as DBText;
DimTxt = DbTxt.TextString;
TxtHeight = DbTxt.Height;
TxtRot = DbTxt.Rotation;
TxtSizeX = DbTxt.Bounds.Value.MaxPoint.X - DbTxt.Bounds.Value.MinPoint.X;
TxtSizeY = DbTxt.Bounds.Value.MaxPoint.Y - DbTxt.Bounds.Value.MinPoint.Y;
TxtVec2d = new Vector2d(TxtSizeX, TxtSizeY);
MsgSys.MsgOut(DbTxt.TextString, 1);
}
}
//---------------------------------------------
RotDimNew.SetDatabaseDefaults();
RotDimNew.Rotation = TxtRot;
RotDimNew.XLine1Point = RotDim.XLine1Point;
RotDimNew.XLine2Point = RotDim.XLine2Point;
RotDimNew.DimLinePoint = RotDim.DimLinePoint;
RotDimNew.DimensionText = DimTxt;
RotDimNew.TextDefinedSize = TxtVec2d; // this don't work
RotDimNew.TransformBy(Matrix3d.Displacement(new Vector3d(0, 300, 0))); // this shut be show new DIMs
//---------------------------------------------
ObjectId NewObjId = BlkTblRecMs.AppendEntity(RotDimNew);
acTrans.AddNewlyCreatedDBObject(RotDimNew, true);
}
acTrans.Commit();
}
}
return true;
}
//---------------------------------------------------------------------------------
Can't find what you're looking for? Ask the community or share your knowledge.