I have a question about 'window_pick'

class PickTool
  def activate
    @move_pt = @p1 = nil
  end

  def onLButtonDown(flags, x, y, view)
    @p1 = Geom::Point3d.new(x, y, 0)
  end

  def onLButtonUp(flags, x, y, view)
    ph = view.pick_helper
    ph.window_pick(@p1, Geom::Point3d.new(x, y, 0), Sketchup::PickHelper::PICK_CROSSING)
    puts ph.all_picked.to_s
  end
end
Sketchup.active_model.select_tool(PickTool.new)

The entities of picked is under model.entities, not model.active_entities.

I should get faces and edges.

This is an issue that has been reported for quite some time.

Sketchup::PickHelper window and boundingbox picks not correct in nested contexts · Issue #459 · SketchUp/api-issue-tracker (github.com)

2 Likes