Setting GEOM_VISIBILITY_PARAM of nested Annotation family makes it disappear

Hi everyone,

I would like to batch edit some door families but I am facing an issue with setting nested family geometry visibility through Dynamo and Python.

I managed to find a Jeremy blog post from 2014 about how to handle geometry visibility and after testing with both Revit Lookup and Dynamo for the integer conresponding to my desired settings I came up with this code :

import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

vues = FilteredElementCollector(doc).OfClass(ViewPlan)

RDC = [x for x in vues if x.Name == "Rez-de-chaussée"][0]

ETQ = [y for y in FilteredElementCollector(doc,RDC.Id).OfClass(FamilyInstance) if y.LookupParameter("Famille").AsValueString() == "A_SYM_ETQ_POR"][0]

ETQparam = ETQ.get_Parameter(BuiltInParameter.GEOM_VISIBILITY_PARAM)


TransactionManager.Instance.ForceCloseTransaction()
TransactionManager.Instance.EnsureInTransaction(doc)#
ETQparam.Set(49152)
TransactionManager.Instance.TransactionTaskDone()
TransactionManager.Instance.ForceCloseTransaction()

OUT = ETQparam.AsInteger(), ETQ.Id

To quickly break it down, it’s executed inside a family document for the moment :

  • Gets the all FloorPlan views of the family
  • Gets the FloorPlan view wich owns the Annotation family I’d like to modify
  • Gets the family instance to modify
  • Gets its GEOM_VISIBILITY_PARAM
  • Modifies the parameter value

Th default Value of GEOM_VISIBILITY_PARAM for annotations is 57344, the target value according to Revitlookup is 49152 (default minus fine uncheck).
After running the script, the annotation instance disappears from the family. The element stills exists but is not visible, and doesn’t show when loaded into a project file. When snooping with elementId, it’s still there and GEOM_VISIBILITY_PARAM returns 49154 as integer value, geometry parameter in revit UI is set as expected (fine unchecked)

I tried to set it to 49154 directly, but still it makes the annotation disappear.

I tried with another kind of nested family (door category) and the script worked as expected : geometry visibily set with fine unchecked and family representation still visible. (integers are different though as they include plan and section visibility)

Of course, I checked the visibily instance parameter. It’s not that :wink:

BeforeScript :


AfterScript :

The locks are proving the object is still there

Based on the bits noted in the blog post the integer 49154 is flipping on the ‘View Specific Display’ switch - which maybe interfering with visibility in the view you are trying to see the annotation

As far as I can ascertain the order is
<Fine> <Medium> <Coarse> 0000000 <L/R> <F/B> <Plan/Rcp> <When cut> <Model/Symbol> 0

Integers → 16 bit binary

49152 -> 1100000000000000
49154 -> 1100000000000010
57344 -> 1110000000000000

Everything ticked is 57406 -> 1110000000111110

Also have you checked the visibility IS_VISIBLE_PARAM is also ticked

I’ve also noticed that an AnnotationSymbol type uses BuiltInParameter.CURVE_VISIBILITY_PARAM to control the visibility settings

1 Like

Waw !

I really don’t understand why but it works ! If you want to set an annotation family instance geometry visibility you have to use its CURVE_VISIBILITY_PARAM BuiltInParameter :dizzy_face:

So setting BuiltInParameter.GEOM_VISIBILITY_PARAM to 49152 doesn’t work and forces both GEOM_VISIBILITY_PARAM and CURVE_VISIBILITY_PARAM to 49154 which for some reason makes the instance disappear from the view.

Setting BuiltInParameter.CURVE_VISIBILITY_PARAM to 49152 on the other hand forces both GEOM_VISIBILITY_PARAM and CURVE_VISIBILITY_PARAM to 49152. And everything is working as “expected”.

After some tests it appears that setting CURVE_VISIBILITY_PARAM works also for other kind of family instances that have no “curves” but only “geometry” ¯\_(ツ) _/¯ .

Thanks Mike for taking the time !

2 Likes