I would like to make a short Dynamo script to create automatically a new 3D view showing only the Analytical Model (and other annotations such as loads etc.) but I don’t really know how to proceed…
If someone knows how to do or has an idea to do it that would be awesome
That is interesting but I still don’t get how this can create a new 3D view with directly the right visibility settings. There is a postable command to create a new 3D view but as far as I know you cannot directly get this newly created view and apply visibility setting in the same run of the script
If you have any idea on this point, it would be great,
I actually had a co-worker help me make a Custom Node for this, only working on Annotation Categories (not Analytical Model Categories). I’ll ask if I can share the nodes here, perhaps it will help.
Obviously I misunderstood your question, I thought you want to hide all analytical categories.
I just found out View3D.CreateIsometric(doc, viewFamilyTypeId.Id) returns a new 3D view which always has the “Show Analytical Model” unchecked. A workaround would be duplicating a view that already had “Show Analytical Model” checked. Then all views created from it would be good to go.
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
sel = uidoc.Selection
col = FilteredElementCollector(doc)
#Preparing input from dynamo to revit
other_categories = [c for c in doc.Settings.Categories if not c.CategoryType == CategoryType.AnalyticalModel and not "Analytical" in c.Name]
source_view = UnwrapElement(IN[0])
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
# Duplicate a view
dup_view_id = source_view.Duplicate(ViewDuplicateOption.Duplicate)
dup_view = doc.GetElement(dup_view_id)
dup_view.Name = "DupView"
# Hidden analytical categories
test = []
for category in other_categories:
try:
dup_view.SetCategoryHidden(category.Id, True)
except:
test.append(category.Name)
TransactionManager.Instance.TransactionTaskDone()
OUT = test
(Filtering criteria might not be the way you want, it catches “Area Load Tags” so it gets hidden also)
But it seems to be fairly useless since a duplicated view also inherits visibility setting. Setting up a view manually and duplicates a bunch of views later would make more sense than changing settings right after generation.