sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Finding deepest entity in pick path

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 5 Posters 1.1k Views 5 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.
    • eneroth3E Offline
      eneroth3
      last edited by

      Hi

      First of all sorry if this isn't the right place to ask for help when coding plugins. This is my first post here.

      I'm having some troubles finding the deepest picked element with a pick helper. leaf_at(0) works great as long as the element is a child of the current drawing context (inside a group inside a group etc) but not in parent drawing context.

      I'm writing a custom interference and need to be able to pick any shown edge or construction line, no matter if it's in a group, in parent drawing context, in a group in parent drawing context or anywhere else. For edges inputPoint.edge works great but there is no inputPoint.cline (at least not documented).

      This is what I've got so far in my onMouseMove

      if(@ip.edge)
      	#Line from edge
      	line = @ip.edge.line
      	line.each{|i| i.transform!(@ip.transformation)}
      else
      	#Line from c-line (I wish there was a cline property for input points)
      	@ph.do_pick(x, y)
      	#NOTE; Returns entities in groups/components but not parent drawing context (and not inside groups/components in parent drawing context)
      	picked = @ph.leaf_at(0)
      	puts picked.class#used to see what element is picked, NilClass when hovering c-lines in parent drawing context D';
      	if(picked.class == Sketchup;;ConstructionLine)
      		line = [picked.position, picked.direction]
      		line.each{|i| i.transform!(@ph.transformation_at(0))}
      	end#if
      end
      
      #Do stuff with line...
      

      My website: http://julia-christina-eneroth.se/

      1 Reply Last reply Reply Quote 0
      • Rich O BrienR Offline
        Rich O Brien Moderator
        last edited by

        Off Topic

        Hi Eneroth,

        If you would like to added here as a plugin author and share your plugins let us know.

        I know you have stuff on the EW that the members would be interested in.

        Download the free D'oh Book for SketchUp 📖

        1 Reply Last reply Reply Quote 0
        • eneroth3E Offline
          eneroth3
          last edited by

          Why not 😄 . It would be nice if more people could find and use the plugins.

          My website: http://julia-christina-eneroth.se/

          1 Reply Last reply Reply Quote 0
          • jolranJ Offline
            jolran
            last edited by

            Hej där Julia.

            I think you'll find some goodies in this guide:

            Link Preview Image
            PickHelper — A Visual Guide

            I’ve put together a visual guide to the PickHelper class in SketchUp’s Ruby API. When I first tried to use the PickHelper class I was confused over what the different methods did, and f…

            favicon

            Procrastinators Revolt! (www.thomthom.net)

            In particular have a look at pick_segment further down in that pdf.

            In case you fail with picking clines in code you could eventually simulate a CLine with a GL draw object(Gl line) and use pick_segment. But I guess you prefer to stick to your clines..

            Anyway, hope this helps.

            1 Reply Last reply Reply Quote 0
            • tt_suT Offline
              tt_su
              last edited by

              Unfortunately the PickHelper only picks from the current context and sub-context - not parent context.

              1 Reply Last reply Reply Quote 0
              • dukejazzD Offline
                dukejazz
                last edited by

                PickHelper

                I will have to read up on this? 💭

                Thanks tt & eneroth3

                I will be following on what you find out - dj

                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