.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rotated Dimension, owerwrite TextHeight

2 REPLIES 2
Reply
Message 1 of 3
RalfHoppe4895
169 Views, 2 Replies

Rotated Dimension, owerwrite TextHeight

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;
}
//---------------------------------------------------------------------------------

2 REPLIES 2
Message 2 of 3
arrpsf5k
in reply to: RalfHoppe4895

@azhah6f9 see this

Message 3 of 3
_gile
in reply to: RalfHoppe4895

Hi,

 


@RalfHoppe4895  a écrit :

How can I owerwrite Textheight?


 

RotDimNew.Dimtxt = TxtHeight;

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta