sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    How to get a intersection btween a line and a face

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 217 Views 2 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.
    • M Offline
      Mcdull
      last edited by

      there are many triangls in the bottom,but they are not in one plane, i generate a line with two points,and the line is vertical to the XYplane ,i want to get the intersection btween the line and a face.
      i read the api that

       # This is really the normal which follows the x axis. The plane is
       # perpendicular
       plane1 = [Geom;;Point3d.new(-10, 0 ,0), Geom;;Vector3d.new(1,0,0)]
      
       # This line follows the x axis
       line1 = [Geom;;Point3d.new(-10,0,0), Geom;;Vector3d.new(1,0,0)]
      
       # returns -10, 0, 0
       pt = Geom.intersect_line_plane(line1, plane1)
      

      but this method turn every face to be a plane,so,the intersection may be outside of the face,i want to get the intersection in the face...
      would u give me some help?thank u

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        You need to get the line of the edge and the plane of the face
        line=edge.line plane=face.plane
        Then use line/plane intersection tests etc...
        http://code.google.com/apis/sketchup/docs/ourdoc/geom.html#intersect_line_plane

        TIG

        1 Reply Last reply Reply Quote 0
        • M Offline
          Mcdull
          last edited by

          ok, i got it,but there are many intersection points .the line have intersect with every face's plane,if i wanto to get the intersection point in the face,not the other faces' planes,do i have to judge with the method Face.classify_point
          or other methods?
          thank u ,TIG

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            You could also look at model.raytest
            The point could be one that you used for your vertical edge and the vector is [0,0,-1]
            It will return any array raytest[0] is the intersection point and raytest[1][-1] is the face or edge it hits...
            http://code.google.com/apis/sketchup/docs/ourdoc/model.html#raytest

            TIG

            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