IndependentTag.TagText property shows exception when there is a calculated value

IndependentTag.TagText property shows exception when there is a calculated value

michael-coffey
Advocate Advocate
312 Views
2 Replies
Message 1 of 3

IndependentTag.TagText property shows exception when there is a calculated value

michael-coffey
Advocate
Advocate

This appears to be a bug that we can't get the TagText when there is a calculated value in the label of an IndependentTag.  When the calculated value is removed, then the TagText displays the first two lines.  A fix would be appreciated.  Thanks.

IndependentTag-TagText.png

Stair Run tag label.png

313 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

Please provide a minimal reproducible case including sample model plus code plus steps to reproduce:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

michael-coffey
Advocate
Advocate

Load and place attached family on a stair run, such as in the Snowdon Arch file.  Then use this macro to get the tag text.  The catch condition will be hit.  Edit the tag family and remove the 'Occupant' parameter from the label, then run again.  The tag text will show instead.

 

public void GetStairTagText()
{
	UIDocument uidoc = this.ActiveUIDocument;
	Document doc = this.ActiveUIDocument.Document;
	
	var elemRef = uidoc.Selection.PickObject(ObjectType.Element, "Select Tag");
	var tag = doc.GetElement(elemRef) as IndependentTag;
	if (tag != null)
	{
		try
		{
			string text = tag.TagText;
			TaskDialog.Show("Info", text);
		}
		catch
		{
			TaskDialog.Show("Error", "Tag text could not be retrieved");
		}
	}
}

 

We have narrowed this down a bit more.  It appears the problem is that the 'Occupant Load' parameter is referencing the 'Egress Width' parameter.  When the 'Occupant Load' parameter is changed to use the formula from 'Egress Width' then it works.  It appears that TagText can't display when there is a nested Calculated Value.

0 Likes