Annotating with Family Instance Parameter data with IndependentTag in Revit

By Saikat Bhattacharya

While creating IndependentTags for elements in a Revit model, you might have noticed that the IndependentTag.TagText() method is read-only. The label for this tag is picked up, by default, by the Type parameter. For instance, for any given wall, when Document.NewTag() method is used to create a new IndependentTag, it picks up the value of the Type Mark parameter which is contained in the Wall Type.

If you wish to use the Wall Instance parameter value instead (say Mark parameter) for the tag, you can do that from the Revit User Interface (UI). You can do this by editing the Tag family and select the Label in it. This brings up the parameters of the Label in the Family Editor mode and at this point, we can click the Edit button on the Label parameter of the Label. This brings up a dialog called Edit Label in which we can set the specific Instance parameter you want to use to set the Tag text (Mark parameter in this case), instead of the default Type parameter. The screenshot below shows the dialog I am referring to here:

image

After reloading the Tag family in the model, any new tags created will use this specific Instance parameter value for its text.

Using the API, it does not seem like we can edit the Label of a Tag family. So as an alternative, we can work with a model/template which already has the tag families configured (as per the specific Instance parameter you want to use) and also loaded in the model. Consequently any API calls to NewTag() should use the configured tags.


Comments

3 responses to “Annotating with Family Instance Parameter data with IndependentTag in Revit”

  1. I think that I have found a very bad bug with Independent Tags.
    When a Tag cannot display a parameter value (because the parameter has been renamed or removed) Revit displays a ‘?’
    If you try to read the text of any tag that has a ‘?’ Revit completely bombs out.
    eg. Using Revit2013, Visual Studio 2010, VB.net
    Try
    tagText = aTag.TagText.ToString()
    Catch
    tagText = “This One is stuffed”
    End Try
    The ‘Catch’ above cannot be caught if its a bad TagText – it completely bombs out….
    Even when using ‘Revit Lookup’ / ‘Snoop DB’, when it encounters an Independent Tag that has a ‘?’ it completely bombs out and quits.
    Regards,
    Kon.

  2. Mayur Avatar
    Mayur

    Hi,
    I am creating new family type and adding several parameters to it..Is there any way to add parameter without adding family type or can we remove it after adding parameter..application is getting hanged because having too many family type..
    please suggest

  3. Hi Saikat,
    I’m loading a floor tag using api (document.loadfamily)
    regenerating the model
    but Revit doesn’t want to use it: e.g.
    in user interface: Tag all recognize it, but tag by category says: no tag is loaded!!
    (using newtag method -in a new transaction after regenerating- also throws an exception that no tag is loaded!)
    thanks & regards

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading