ObjectARX ® is an open architecture where multiple applications can implement their own custom entities. It's possible that multiple applications will be loaded at the same time in an AutoCAD session. The user might select your custom entity in an operation that causes it to intersect with another custom entity that you are not aware of. The following guidelines should help you implement the subIntersectWith() function of your custom entity.
- Each custom entity is expected to be able to intersect with native entities. Native entities are the entities defined in AutoCAD, for example, AcDbLine,AcDbEllipse, and AcDbSpline.
- If the subIntersectWith() function of your custom entity is called with another entity that is not a native entity, you need to explode your custom entity (for example, by using the explode() function) to a set of recognizable native entities, then turn around and call intersectWith() on the entity that came in as an argument to your subIntersectWith() function. Because everyone is expected to be able to intersect with native entities, the entity in the argument would be able to intersect with your exploded version.
During this process, you need to be careful about how you call the intersectWith() function of the argument and how you interpret the points that are the results of intersection. For example, if the intersection type was kExtendArg, you want to change it to kExtendThis before calling intersectWith() on the argument. Similarly, if the intersection is an apparent intersection on a plane of projection, the points returned from the intersectWith() call on the argument entity is on the argument entity, not necessarily on your entity. You're supposed to return the intersection points on your entity; therefore, you need to project the points back onto the projection plane (where they will lie on your projected entity) and then project them back onto your entity before returning.