Community
Hello all,
I'm seeking for a way to find the dimension text is overridden or not! is there any way to take the text override data from a dimension properties. Can anyone help me with some sample code??
Solved! Go to Solution.
Solved by _gile. Go to Solution.
Hi,
You can check the Dimension.DimensionText value. It is an empty string if not overriden.
Testing example:
[CommandMethod("DIMTEST")]
public static void DimTest()
{
var doc = Application.DocumentManager.MdiActiveDocument;
var db = doc.Database;
var ed = doc.Editor;
var options = new PromptEntityOptions("\nSelect Dimension: ");
options.SetRejectMessage("\nSelected object must be a Dimension.");
options.AddAllowedClass(typeof(Dimension), false);
var result = ed.GetEntity(options);
if (result.Status != PromptStatus.OK)
return;
using (var tr = db.TransactionManager.StartTransaction())
{
var dim = (Dimension)tr.GetObject(result.ObjectId, OpenMode.ForRead);
string dimText = dim.DimensionText;
if (dimText == string.Empty)
ed.WriteMessage("\nNot overriden dimension");
else
ed.WriteMessage($"\nOverriden dimension: {dimText}");
tr.Commit();
}
}
Can't find what you're looking for? Ask the community or share your knowledge.