OwnerViewId doesn't report Dependent view Id of annotation element

OwnerViewId doesn't report Dependent view Id of annotation element

Anonymous
Not applicable
714 Views
4 Replies
Message 1 of 5

OwnerViewId doesn't report Dependent view Id of annotation element

Anonymous
Not applicable

Hello,

 

We have multiple tools in need of getting the Id of the dependent view that an annotation is on such as symbols and revision clouds.  Currently, the parent view is reported regardless of whether the annotation is created in the parent view or the dependent view.  You can use this code to test:

 

        public void getOwnerViewId()
        {
                Reference picked = this.ActiveUIDocument.Selection.PickObject(ObjectType.Element, "Pick Annotation");

                Element e = this.ActiveUIDocument.Document.GetElement(picked);
                
                TaskDialog.Show("id",e.OwnerViewId.IntegerValue.ToString());
        }

How can I easily retrieve the Id of the dependent view?  Is it possible we need a new element property for this or does the Element.OwnerViewId functionality need to be changed?

715 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

I don't think a dependent view can own an annotation, even when placing one on a dependent view it is actually just added to the parent view and is then shown on the dependant view indirectly. you could use GetDependentViewIds() to check each of the parent view's dependents to see whether the annotation is within the annotation crop box I guess.

0 Likes
Message 3 of 5

Anonymous
Not applicable

I have done your suggestion already to get which dependent view the annotation is visible in and yes this works.  But, a project could have around 3,000 of these annotations and checking every single one is very time consuming in Revit because it must regenerate each and every dependent view to find its visibility. 

0 Likes
Message 4 of 5

jeremytammik
Autodesk
Autodesk

Dear Michael,

 

Thank you for your query, and thanks to Scott for the important and helpful explanation.

 

I am glad to hear that you are aware of the possibility suggested by Scott and that it works.

 

Sorry that that does not quite satisfy your needs yet due to performance reasons.

 

If you would like to isolate your solution into a completely generic minimal reproducible case and share the code with us, I will happily take a look and see whether any obvious optimisations or other performance enhancements spring to eye – er, mind:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 5

Anonymous
Not applicable
I just had the thought that there might be some dependant view linkage to certain annotations. Detail callouts for example will have unique per-view positioning for reference bubble per view even if that view is dependant. It's probanly not exposed to the API but it does show that dependant views do have at least partial ownership of annotations
0 Likes