• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

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.
  • E Offline
    eneroth3
    last edited by 5 Aug 2013, 09:31

    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
    • R Offline
      Rich O Brien Moderator
      last edited by 5 Aug 2013, 09:50

      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
      • E Offline
        eneroth3
        last edited by 5 Aug 2013, 10:05

        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
        • J Offline
          jolran
          last edited by 5 Aug 2013, 19:27

          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
          • T Offline
            tt_su
            last edited by 6 Aug 2013, 01:56

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

            1 Reply Last reply Reply Quote 0
            • D Offline
              dukejazz
              last edited by 6 Aug 2013, 05:36

              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
              1 / 1
              • First post
                1/6
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement