At the moment I’m working on a script to hide annotations outside a crop on dependent views. I actualy found a post where they where handeling this in 2014, from this post I coppied a Python script that seperates tags that are visible in current view from tags that arent. Now I am testing this python scipt but it doesnt seem to work on dependend views. (it does work in normal views)
Could some1 make this python script working for dependend views? I Would do it myself but I have no idea how…
I think you need a different approach. The python script uses the view that owns the tags, which is always the master view controlling the dependent views.
A possible solution that springs to mind would be to create a surface in Dynamo from the cropview lines and the tag locations that intersect with that surface are the ones you don’t want to hide. Then simply hide the tags that don’t intersect with anything.
For the first step I will need to create a surface using the lines from the crop sketch. It’s just that I don’t know how to do that. I have been looking for nodes and looking on the forum. On the forum I found this post:
Smart move Yna I don’t know if that will work with irregular shaped cropboxes though.
I made some code from scratch to get the cropview curves. You can use those lines to create the surfaces.
Just copy paste into a python node. I’ll add it to my package (MEPover) some time later as well.
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import clr
clr.AddReference("RevitNodes")
import Revit
# Import ToProtoType, ToRevitType geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
#The inputs to this node will be stored as a list in the IN variables.
if isinstance(IN[0], list):
view = UnwrapElement(IN[0])
else:
view = [UnwrapElement(IN[0])]
listout = []
for x in view:
region = x.GetCropRegionShapeManager().GetCropShape()
if len(region) > 0:
lines = [y.ToProtoType() for y in region[0]]
listout.append(lines)
else:
listout.append([])
#Assign your output to the OUT variable.
OUT = listout
What it does is create a line at every tag location, if the line intersects with the cropbox lines an odd number of times then it must be inside the cropview.
You’ll need a few nodes from the MEPover package to make it work.hide tags.dyn (13.5 KB)