Custom added parameter displaying as '?' in tag.

Custom added parameter displaying as '?' in tag.

nhNRTW6
Explorer Explorer
288 Views
4 Replies
Message 1 of 5

Custom added parameter displaying as '?' in tag.

nhNRTW6
Explorer
Explorer

I have added a parameter to revit '24 using the API with the following code:
List<JFGParameter> sharedParameters = new List<JFGParameter>();
sharedParameters.Add(new JFGParameter() { Name = "JFG_ElementId", Group = GroupTypeId.IdentityData, DataType = SpecTypeId.String.Text });

 

A value is assigned to the parameter via code and, as far a I can tell, that part is working properly

nhNRTW6_1-1739546189770.png

 

I am trying to have a tag read this parameter so we can add unique identifiers to our detail drawings.

 

Here are pictures of the edit label screen from the tag family

nhNRTW6_2-1739546285902.png

nhNRTW6_0-1739546148324.png

 

Displayed tag when used on element containing a value for the parameter

nhNRTW6_3-1739546454860.png

 

I'm not sure if my problem is in the way I am adding the parameter or assigning a value. Any help would be appreciated.

 

0 Likes
Accepted solutions (1)
289 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni

Afaik, there are quite a few situations and issues related with Revit displaying a question mark for a tag value:

  

  

Hard to tell off-hand whether the behaviour you observe is caused by your approach or some other factor... Maybe some of those discussions will help clarify?

  

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

nhNRTW6
Explorer
Explorer

Reading those forum posts I was able to pinpoint, I think, what is going wrong. It seems that the way I am adding parameters is not adding them to the shared parameters file as I cannot find the added parameters when I search for them in the dialog. The parameters are showing up in the element properties sidebar in the locations intended. I have included my code for adding the parameter in an attachment.

0 Likes
Message 4 of 5

nhNRTW6
Explorer
Explorer
Accepted solution

Upon a good bit of further investigation, the method I was using to add the parameters was adding them to a shared parameter group incorrectly. The original code was as folows:

hangerParameters.Add(new JFGParameter() { Name = "JFG_Rod1Diameter", Group = GroupTypeId.Construction, DataType = SpecTypeId.String.Text });

and to access the group in the file I was using this code:

JFGgroup = definitionFile.Groups.Create(parameter.Group.ToString());

 

This caused all parameters to be added under a group named "Autodesk.Revit.DB.ForgeTypeID" which is why the tags were displaying question marks.

 

As a workaround I added a string representing the group name:

hangerParameters.Add(new JFGParameter() { Name = "JFG_Rod1Diameter", Group = GroupTypeId.Construction, GroupString = "Construction", DataType = SpecTypeId.String.Text });

and changed the creation code to:

JFGgroup = definitionFile.Groups.Create(parameter.GroupString);

 

This code is working and is adding the parameters to the intended groups in the shared parameter file.

 

 

Message 5 of 5

jeremy_tammik
Alumni
Alumni

Congratulations to solving this and thank you for the explanation.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open