Hide annotations ouside crop view


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…

This is the script with the python script:

hide tags.dyn (5.6 KB)

This is the post where i found the Python script:


This workflow is for non dependent views only.
Dependent views are what they say, dependent.


So is there an other way to aproach my problem?
I have tags wich are inside the annotation Crop but outside my Crop view. (see screenshot)

I wish to hide those in view…
is this possible?

Hi Lennard,

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.

Good luck!

1 Like

It would be better to hide tag which host is invisible in view, cause we often need tags a lil bit outside of the crop.

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:


Looks like it’s not possible to retrieve the lines with regular nodes, only by programming i guess??

Hello, couldn’t help to try, so here’s how I did it (please tell me if I’m wrong somewhere, because I did that very quickly in the lunchtime):

Smart move Yna :slight_smile: 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
from Autodesk.DesignScript.Geometry import *

import clr

import Revit

# Import ToProtoType, ToRevitType geometry conversion extension methods

#The inputs to this node will be stored as a list in the IN variables.
if isinstance(IN[0], list):
	view = UnwrapElement(IN[0])
	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]]

#Assign your output to the OUT variable.
OUT = listout

Ok, this should work:

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)


Thank you for the script, i got it working!

Package also lookes good :+1: