How to pan the view to focus on some component

i want to pan the current view to automatically focus on some component by the certain coord.

Move the camera’s target to point at the new coord and move its eye to do the panning.

Thank you. I’ll have a try

Example:

# focus_on( component )
#
# @param component [Sketchup::ComponentInstance,Sketchup::Group]
# @return [Boolean]
def focus_on( component )
  return false unless component.respond_to?(:bounds)
  boundingbox = component.bounds
  target = boundingbox.center
  view   = Sketchup.active_model.active_view
  camera = view.camera
  camera.set( camera.eye, target, [0,0,1] )
  view.zoom( component )
  true
end

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.