ElementIntersectElementFilter

ElementIntersectElementFilter

Anonymous
Not applicable
653 Views
4 Replies
Message 1 of 5

ElementIntersectElementFilter

Anonymous
Not applicable

 

 

 

Is it possible to use ElementIntersectElementFilter between Parts and Generic Models?

I'm using the code below but I keep getting 0 elements in my collector even if invert the ElementIntersectElementFilter.

 

UIApplication uiApp = commandData.Application;
Document doc = uiApp.ActiveUIDocument.Document;

Selection selsrc=uiApp.ActiveUIDocument.Selection;
Reference obj = selSrc.PickObject(ObjectType.Element);
Element element = doc.GetElement(obj);

 

FilteredElementCollector collector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Parts).WherePasses(new ElementIntersectsElementFilter(element));

 

Thank you.

0 Likes
654 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk

Thank you for your query.

 

Please always avoid typos of all kinds.

 

They can make your questions and answers impossible to find later on.

 

Note the important difference between ElementIntersectsElementFilter and ElementIntersectElementFilter.

 

They are not the same thing, and some searches do not use fuzzy comparison algorithms.

 

Anyway, I passed on your query to the development team and will let you know what they say as soon as I hear back from them.

 

I hope this helps.

 

Best regards,

 

Jeremy



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

0 Likes
Message 3 of 5

jeremytammik
Autodesk
Autodesk

Thank you for your patience.

 

The development team replied, simply quoting the public ElementIntersectsElementFilter documentation:

 

http://www.revitapidocs.com/2017/404df79f-2e48-ad4d-2654-a49aa5bf4443.htm

 

The intersection is determined with the same logic used by Revit to determine if an interference exists during generation of an Interference Report. (This means that some combinations of elements will never be detected as intersecting by this filter, such as concrete members which are automatically joined at their intersections).

 

Certainly parts and their host elements will never be considered to intersect.  It would be worth checking in the Interference report if an intersection is reported or not for the scenario the customer is checking.

 

I hope this clarifies.

 

Have you read this documentation?

 

Have you done what the man says, i.e., checked whether the Interference report detects and reports an intersection for your specific scenario?

 

Best regards,


Jeremy



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

0 Likes
Message 4 of 5

Anonymous
Not applicable

Thank you Jeremy.
I've just checked and Interference Report doesn't detect the intersection, so FilterElementIntersectsElement is no good for this.
Do you know any other way to detect intersections between two elements?
I've also tried get the solid geometry and use FilterElementIntersectsSolid, but same result.

0 Likes
Message 5 of 5

jeremytammik
Autodesk
Autodesk

Thank you for your update.

 

Well done! That brings us a large step forward.

 

What do you mean by 'same result'?

 

Can you retrieve the solid geometry?

 

If so, then that can be used to determine an intersection.

 

If not, some other means needs to be devised.

 

You say you are interested in Parts and Generic Models.

 

Which of these two is exhibiting which issue?

 

Does the Interference Report detect the intersection for one of the two?

 

Does one of the two return a valid solid?

 

Maybe you should describe exactly what you are trying to achieve.

 

Otherwise, nobody knows what this discussion is really about.

 

Maybe you should create a minimal reproducible case illustrating what you are trying to achieve in order to communicate exactly what you mean and enable us to research possible reasons for the discrepancy between the observed and desired behaviour, e.g.:

 

  • A short exact description of what you are trying to achieve.
  • The behaviour you observe versus what you expect, and why this is a problem.
  • A complete yet minimal Revit sample model to run a test in.
  • A complete yet minimal macro embedded in the sample model or Visual Studio solution with add-in manifest that can be compiled, loaded, run and debugged with a single click to analyse its behaviour live in the sample model.
  • Detailed step-by-step instructions for reproducing the issue, e.g. which element to pick, what command to launch etc.

 

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

 

Best regards,

 

Jeremy



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

0 Likes