Finding deepest entity in pick path
-
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...
-
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.
-
Why not . It would be nice if more people could find and use the plugins.
-
Hej där Julia.
I think you'll find some goodies in this guide:
http://www.thomthom.net/thoughts/2013/01/pickhelper-a-visual-guide/
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.
-
Unfortunately the PickHelper only picks from the current context and sub-context - not parent context.
-
PickHelper
I will have to read up on this?
Thanks tt & eneroth3
I will be following on what you find out - dj
Advertisement