How to obtain the actual height and width of text in a block

The text ‘doundbox’ in the block is null.

@hardp,
please, try to call cadImage.GetBounds() before.

@oleksii.gorokhovatskyi

//add new MTEXT
CadMText cadmtxt = new CadMText();
cadmtxt.Text = content;
cadmtxt.DrawingDirection = drawingDirection;
cadmtxt.TextStyleName = fontStyle;
cadmtxt.HorizontalWidth = fontHeight;
cadmtxt.InitialTextHeight = fontHeight;
cadmtxt.InsertionPoint = point.ToCad3DPoint();
cadmtxt.LayerName = "0";
cadImage.BlockEntities["*Model_Space"].AddEntity(cadmtxt);
cadImage.UpdateSize();
cadImage.GetBounds(cadmtxt);
var boundbox = cadmtxt.Bounds;
boundbox  is Null.

@hardp,
please, try this:

using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(fileName))
{
	string newObjectID = "FFFFFF";

	if (cadImage.Header.HeaderProperties.ContainsKey(CadHeaderAttribute.HANDSEED))
	{
		newObjectID = ((CadStringParameter)cadImage.Header.HeaderProperties[CadHeaderAttribute.HANDSEED][0]).Value;
		int nextAvailableID = int.Parse(newObjectID, System.Globalization.NumberStyles.HexNumber) + 1;
		((CadStringParameter)cadImage.Header.HeaderProperties[CadHeaderAttribute.HANDSEED][0]).Value = nextAvailableID.ToString("X");
	}

	//add new MTEXT
	CadMText cadmtxt = new CadMText();
	cadmtxt.Text = "asdfsdf";
	cadmtxt.InitialTextHeight = 4;
	cadmtxt.LayerName = "0";
	cadImage.BlockEntities["*Model_Space"].AddEntity(cadmtxt);
	cadmtxt.ObjectHandle = newObjectID;

	// add new insert to Entities
	List<CadEntityBase> entities = new List<CadEntityBase>(cadImage.Entities);
	entities.Add(cadmtxt);
	cadImage.Entities = entities.ToArray();

	cadImage.UpdateSize();

	cadImage.GetBounds(cadmtxt);

	var boundbox = cadmtxt.Bounds;
}