Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ReferenceIntersector

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
HD12310
1599 Views, 7 Replies

ReferenceIntersector

According to the API documentation and preliminary testing this method wont find any references in linked Revit files.

So for example using the vector of a cable tray wont hit any linked walls...or so it seems.

But then why does it have a boolean property named "FindReferencesInRevitLinks".

Setting it "true" doesnt seem to make any difference.

 

ReferenceIntersector refIntersector = new ReferenceIntersector(intersectFilter, FindReferenceTarget.Face, view3D);
refIntersector.FindReferencesInRevitLinks = true;
IList<ReferenceWithContext> referencesWithContext = refIntersector.Find(startPoint, rayDirection);

 

Has anyone succeeded in getting linked references using this method ?

7 REPLIES 7
Message 2 of 8
jeremytammik
in reply to: HD12310

Dear Håvard,

 

Please note that results may not be as expected if the filter applied is geometric (such as a BoundingBox filter or ElementIntersects filter).  This is because the filter will be evaluated for linked elements in the coordinates of the linked model, which may not match the coordinates of the elements as they appear in the host model.

 

Are you absolutely sure that you understand this?

 

The easiest way to handle it is probably to ensure that the coordinate system in the linked model is identical.

 

Cheers,

 

Jeremy



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

Message 3 of 8
HD12310
in reply to: jeremytammik

I was using a ElementMultiCategoryFilter to focus the hits on applicable categories.

Coordinates is identical and files linked origin to origin.

I'm checking other options now further.

Thanks for your help.

 

 

Message 4 of 8
Anonymous
in reply to: HD12310

I can confirm that using any of the following filters does not work when the elements are contained in linked files:

- ElementClassFilter

- ElementMulticlassFilter

- ElementCategoryFilter

- ElementMulticategoryFilter

 

When I say that these filters do not work, I mean that setting a class/category filter to look for walls in a linked file will not return any results from that link.

 

What does work, however, is creating a class/category filter that looks for a RevitLinkInstance.

 

So, what you need to do is use a RevitLinkInstance category or class filter (an inverted ElementIsElementType filter worked as well), and then filter the results yourself.

 

IMO, this is not how the filters should work when looking for elements in a linked file.  To me, passing an ElementClassFilter looking for Wall objects to a ReferenceIntersector with FindReferencesInRevitLinks set to true should return walls whether they are in the local or in linked files.  The documentation regarding all of this is quite sparse as well.

 

Might make a nice topic for your blog Jeremy...

Message 5 of 8
jeremytammik
in reply to: Anonymous

Dear Colin,

 

Thank you for your research and confirmation.

 

We are working on this, so stay tuned for an update anon.

 

Meanwhile, can you provide the sample models and add-in solution that you used to test this, so we can confirm that it is fixed if and when that happens?

 

Thank you!

 

Cheers,

 

Jeremy



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

Message 6 of 8
HD12310
in reply to: jeremytammik

What i did was to use a ElementSolidIntersectFilter.

So if i want to intersect a cable tray and a linked wall i first use the ElementSolidIntersectFilter on the link.

Done by passing the linked document into the filter.

This requires the link to have a 3D view which it may or may not have but thats ok.

 

ElementSolidIntersectFilter returns a collection of ElementId's for the linked intersected walls which i pass into ReferenceIntersector.

Then use the centerline of the cable tray as "intersector ray".

The advantage is that if a cable tray only partially intersects, that is if tray centerline falls outside the wall, i can still pick it up and handle it.

Otherwise i would need to project rays for every tray corner to catch this.

 

The only problem im having is that "FindReferenceTarget" is not working as expected.

FindReferenceTarget has 6 possible enumerations, All, Curve, Egde, Element, Face and Mesh.

When using "Face" i get 3 hits no matter which "FindReferenceTarget" option is used and have to rule out two of them.

 

What this function does in the end is to place what IFC refers to as IfcProvisionForVoid.

In Revit this is a Generic Model (solid) representing a hole for letting the tray through the wall.
I havent had time to work with the code lately but it works.

 

 

Message 7 of 8
Anonymous
in reply to: jeremytammik

Hi Jeremy,

 

Unfortunately it won't be possible to provide the models I am using - they are production models for a project we are working on.

 

As for the sample code, I started with your GetBoundarySegmentElement example and set FindReferencesInRevitLinks to be true.  I have since made a number of additional changes, but those are not relevant to the functioning of the ReferenceIntersector.

 

Thanks

Message 8 of 8
jeremytammik
in reply to: HD12310

Dear Håvard,

 

Many thanks for the sample code that you provided a while ago demonstrating the use of the ReferenceIntersector in Revit 2016.

 

I finally got around to publishing it:

 

http://thebuildingcoder.typepad.com/blog/2015/07/using-referenceintersector-in-linked-files.html

 

I hope you like it and others find it useful as well.

 

Cheers,

 

Jeremy



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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community