Curve.Intersect Return Values

The first day of the Saudi Arabian Revit API training completed yesterday.
This training will go on for three days instead of the usual two, so that we have more time to deal with the installation and basics as well as various advanced topics.
Yesterday we dealt with installation and setup issues, of Revit, Visual Studio, and the Revit SDK with its tools and utilities.
We started looking at Hello World style samples, i.e. the basic skeletal structure and installation of Revit add-ins, and more basic material remains to be covered.

In lack of a

beach
,
I spent an hour after the training on the sea-side.
The hotel is on the

corniche
right
in front of

King Fahd’s fountain
,
so I got to see the sun set through that.
I went out again later on to enjoy the moon, which was full yesterday and is starting to wane now.

Way back in 2009, Scott Conover discussed the Curve.Intersect method when looking at

curves
in
his AU 2009 class on

analysing building geometry
.

Here is a slightly more detailed question by Katsuaki Takamizawa and clarification by Scott on the results returned in the case of overlapping curves:

Question: Does anyone know the exact meanings of SetComparisonResult.Subset and SetComparisonResult.Superset returned by the Curve.Intersect method?

The API reference explains SetComparisonResult.Subset like this:

1. The inputs are parallel lines with only one common intersection point…

Subset one endpoint

Does this mean that the curves are parallel and connected at one of their end points as shown above?

2. … the curve used to invoke the intersection check is a line entirely within the unbound line passed as argument curve.

Subset fully contained

Would this be returned by curve.Intersect(curve1, resultArray), if ‘curve’ is the highlighted curve above?
Also, could the two lines be completely overlapped?

SetComparisonResult.Superset is explained like this:

3. The input curve is entirely within the unbound line used to invoke the intersection check.

Superset fully contained

Would this be returned by curve.Intersect(curve1, resultArray), if ‘curve1’ is the highlighted curve above?
And again, could the two lines also be completely overlapped?

I would appreciate if anyone knows about the exact meanings and could confirm them.

Answer: I think you’ve got it right:

  • Subset – the two curves meet at one endpoint, or the input curve is a bound line which lies within the extents of the invoking curve, the ‘this’ curve, which is the unbound line.
  • Superset – the reverse of the second condition above, the ‘this’ curve is a bound line, the input curve is unbound and overlapping.

In either case, according to the documentation, one of the curves must be unbound.
So two curves which are bound and which overlap would return Overlap instead, unless they were identical, in which case they return Equal.


Comments

10 responses to “Curve.Intersect Return Values”

  1. Hi, Sir
    It is a nice Website, thanks. I get a question to you. I try to create model lines using the method in your blog, but the model lines will display after shuting down my application. I want to know how I can keep the model lines permanently?

  2. Dear Junyu,
    Thank you for your appreciation!
    If you see those model lines displayed after you have shut down the application, it is probably due to some dirt on your screen :-)
    If you add model lines to the Revit document, then they are stored in the database and will remain there when the document is saved. Have you tried saving the document? :-)
    Cheers, Jeremy.

  3. Thanks for your response. I tried to save, but the new saved file just shows after the model line displaying.

  4. Hi Jeremy, You picked a good time to be visiting Arabia… I’m based in Oman, so if you want a stopover on your way home, my wife and I would be delighted to give you our royal tour. It’s a beautiful, interesting country, with beaches. Unfortunately I overlooked the Saudi training otherwise I would have joined. Regards, Dale

  5. Hi Dale,
    Wow, thank you very much for your kind invitation! Originally Saikat was scheduled to give this training, so my visit in Saudi Arabia was planned at short notice and I had to rush home immediately, unfortunately. I am already back in Switzerlnd again. No rest for the wicked. I heard from friends that Oman is indeed very beautiful. I had no idea that you are based there.
    Sorry to hear that you missed the training, when you would have been interested. We would have loved having you!
    Cheers, Jeremy.

  6. Hi Jeremy,
    The intersection results I’m getting from the Revit API appear to contradict the documentation (Revit 2011 SDK) on computing intersections of lines in Revit.
    Lines that are disjoint are reported as such, correctly. However, lines that intersect at the endpoints alone report “Subset” as opposed to the documented “Overlap”, and lines whose intersection is a line report as “Equal” even if the line of interection is a strict subset of both, again as opposed to the documented “Overlap” result. I don’t know whether curves such as arcs and splines will return the same kinds of results I’ve been getting for straight lines.
    Furthermore, when “Equal” is returned for strict subset intersections as above, I don’t get any IntersectionResultArray back (Revit sets it to null).
    Because of this behaviour I’m unable to get the endpoints of any strict subset intersection between lines. Any ideas?

  7. Dear Dan,
    That sounds very worrying!
    If you are an ADN member, please submit a DevHelp Online case with some sample code demonstrating the behaviour. Otherwise, please send me an email with a minimal project attached, so we can take a look.
    Thank you!
    Cheers, Jeremy.

  8. Will do, thanks Jeremy!
    p.s. when I wrote “strict subset of both lines” I actually meant a subset of both lines, non-equal to either line. (An intersection being a strict subset of both (straight) lines would not be possible, heh.)
    We’re recently joined the ADN so I’ll try to put something together for a DevHelp submission.

  9. p.p.s. Ignore that p.s. above, “strict subset of both lines” is indeed what I meant. I’ve momentarily confused myself on the definition of strict subset.

  10. Dear Dan,
    Congratulations on becoming an ADN member!
    I am eagerly awaiting your DevHelp Online query and sample code.
    Meanwhile, I appended your notes above to the case I raised with the development team.
    Thank you!
    Cheers, Jeremy.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading