sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Edge intersection

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 255 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sandbox_4
      last edited by

      Hello, I need to know if an edge is intersected by any entity (group, face,component)
      for example in this case:

      ----------------[face]--------------------- there is a face in the middle of the edge
      i need a function like
      edge.is_intersected? true

      -------------------------------------------- in this case theres nothing in the edge so
      edge.is_intersected? false

      But i dont need a function like (edge.is_intersected_with? face), I just want to know if an edge is intersected by anything. I tried with all_connected, faces, but it doesnt work

      Thank You

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        No the API does not have any instance method like that, for the Edge class.
        Generally instance methods return information that the object knows about itself. In SketchUp edge objects are rather dumb about other objects that have not interacted with themselves.

        You would have to go UP one editing context, and ask THAT context ( Entities collection,) if the two objects intersected.

        Also it is against the API law to create new instance methods. (Only Trimble should modify the API.)

        The closest thing you might find, is*:
        ` result = edge.bounds.intersect(face.bounds)
        if result.empty?

        they did not intersect

        else

        they do intersect

        end`

        See Geom::BoundingBox#intersect()

        • not a warranty that this will be the solution

        There are also Geom module intersect functions.

        πŸ’­

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • AdamBA Offline
          AdamB
          last edited by

          @sandbox_4 said:

          Hello, I need to know if an edge is intersected by any entity (group, face,component)
          for example in this case:

          ----------------[face]--------------------- there is a face in the middle of the edge
          i need a function like
          edge.is_intersected? true

          -------------------------------------------- in this case theres nothing in the edge so
          edge.is_intersected? false

          But i dont need a function like (edge.is_intersected_with? face), I just want to know if an edge is intersected by anything. I tried with all_connected, faces, but it doesnt work

          Thank You

          Do really mean an Edge? As in you don't just want to test whether a ray (an imaginary line in space) intersects an entity, you really want an Geometric Edge (and all the semantics that go with it)?

          Adam

          Developer of LightUp Click for website

          1 Reply Last reply Reply Quote 0
          • S Offline
            sandbox_4
            last edited by

            @adamb said:

            Do really mean an Edge? As in you don't just want to test whether a ray (an imaginary line in space) intersects an entity, you really want an Geometric Edge (and all the semantics that go with it)?

            Adam

            Yes I need to know if the direct path (a imaginary line ) between 2 entities is obstructed or not

            For example

            [entity1]--------------------[entity2]

            in this case theres nothing in the direct path between the entities so i need a function like entity1.line_of_sight? entity2 true

            but in this case

            [entity1]------[cube]---------[entity2]

            theres a cube in the direct path so the direct path is obstructed then
            entity1.line_of_sight? entity2 false

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              Sketchup::Model#raytest()

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement