Is element hidden? - in linked file

Is element hidden? - in linked file

Anonymous
Not applicable
1,821 Views
4 Replies
Message 1 of 5

Is element hidden? - in linked file

Anonymous
Not applicable

I have document A and document B linked into A.

In active view I make some elements in linked document (B) hidden.

 

How to get Information if given element is hidden?

 

Function element.isHidden(View) seems to work perfect for non-linked elements, but if I use in on elements from another document it always return false.

 

I also tried use:

coll = new FilteredElementCollector(linked_doc, main_doc.ActiveView.Id);

But still return hidden elements.

 

Thanks for any tip.

0 Likes
1,822 Views
4 Replies
Replies (4)
Message 2 of 5

saikat
Autodesk
Autodesk

Hi Arthur

 

All the active documents loaded in the current Revit session can be accessed using Application.Documents() collection and this includes the linked Revit documents as well. Once you have access to the document object of the linked model (B), it might be possible to extract the same view as in doc A in doc B and then find out which element is hidden in that specific view in B.

 

cheers



Saikat Bhattacharya
Senior Manager - Technology Consulting
0 Likes
Message 3 of 5

Anonymous
Not applicable

Thank you for quick answer.

 

I tried this but still elements in linked file which are hidden in host view - are visible.

 

This is how I search view in linked file:

 

FilteredElementCollector viewCollector = new FilteredElementCollector(curr_doc);
viewCollector.OfClass(typeof(View));
foreach (Element viewElement in viewCollector)
{
    if (((View)viewElement).Id == main_doc.ActiveView.Id)
    {
          curr_view = (View)viewElement;
          break;
    }
}

 

Then filer elements:

coll = new FilteredElementCollector(curr_doc, curr_view.Id);

 

And later in elements loop:

if(element.IsHidden(curr_view))
{
/*...*/
}

 

 

Questions:

1. View in document B are reference to view from document A or it is copy?

2. If I hide element in linked file in host view, then view in linked file is automaticly updated?

 

Thanks

 

0 Likes
Message 4 of 5

jeremytammik
Autodesk
Autodesk

You could use the Revit 2014 custom exporter framework.

 

In fact, that is probably the only way to find out. Please have a look at

 

http://thebuildingcoder.typepad.com/blog/2013/07/graphics-pipeline-custom-exporter.html#6

 

Best regards,

 

Jeremy



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

0 Likes
Message 5 of 5

Dale.Bartlett
Collaborator
Collaborator

Has anyone been able to make this work? Of course the intent is to be able to turn off elements in a linked model. Dale




______________
Yes, I'm Satoshi.
0 Likes