[CONNECT MS Update 14, OpenRoads 2020 R2 VBA] Return text element intersected by a line

Hi, Is it possible to return the text element that has been intersected by a line element as shown below -

  • Hi Les,

    Is it possible to return

    I guess you think "find overlapped elements", because when you use "return", my question would be "return from what?" ;-)

    the text element that has been intersected by a line element

    MicroStation VBA offers several methods detecting intersections between different types of elements, but naturally it does not offer anything so specific like "text crossed by line". So it's up to you to use available methods and to implement own detection mechanism.

    It would be not very complicated, I can imagine several different ways how to do it. What is the best depends on exact formulation of your question:

    • Are you interested in to check whether a text is crossed by one or more lines (the text is primary element) or
    • it's about to find all text, laying on specific line (the line is primary element).

    Workflow using intersection methods:

    • Limit elements you want to check as much as possible.
      Filtering using text range block should return only a few elements and you can filter them more to obtain the line only.
    • Create smallest shape around the text. It's possible to use text boundary, but it's not the smallest rotated box, only the smallest range (but maybe it can be used).
    • Using something like GetIntersectionPoint method to find whether the line and the shape intersect.

    An alternative can be to create a fence from text range and to use fence related methods to find elements it contains.

    With regards,

      Jan