Zooming In To One Locked Position Only

The symptoms you describe sound typical of a model that has contents scattered over an area that is very large compared to the individual elements. This sometimes happens when models are imported from CAD, but it can also happen when a stray element somehow gets moved far away. When a model has this defect, zoom-extents zooms out so far that the individual elements are so small they disappear from the view, all you see is the empty space between them!

@sdmitch provided a snippet that may work if the offender is a stray edge. If there is more than one stray edge you will need to invoke the code multiple times because it deletes only one at a time. Also, if a stray edge is not the issue, the code will delete a valid edge that just happens to be farthest from the origin, so make sure you keep a safe copy of your model before you do this.

Recently we have seen several instances of a different problem that suggests a bug in SketchUp’s handling of text annotations when a model is fundamentally a 2D drawing: a Text object may have its leader information replaced with huge values. The following will find such errant Texts if you copy and paste it into the Ruby Console. The result will be an empty Array if there are none, or will contain the bad ones if there are.

  def self.singular_texts
    bad_texts = []
    texts = Sketchup.active_model.entities.grep(Sketchup::Text) do |txt|
      bad_texts << txt if !txt.nil? && singular_text?(txt)
    end
    defs = Sketchup.active_model.definitions
    defs.each do |defn|
      texts = defn.entities.grep(Sketchup::Text) do |txt|
        bad_texts << txt if !txt.nil? && singular_text?(txt)
      end
    end
    bad_texts
  end
  
  # Test for nan values in a Text's point or vector
  def self.singular_text?(txt)
    pt=txt.point
    vec = pt.vector
    pt.x.nan? || pt.y.nan? || pt.z.nan? || vec.x.nan? || vec.y.nan? || vec.z.nan?
  end
bad_texts = singular_texts

If the Array is not empty, the following will delete them:

bad_texts.each {|txt| txt.erase!}

Edit: Another less technical way if you have ThomThom’s selection toys extension is:

  • create a new layer and turn off its visibility
  • right-click and choose Select Only → Text
  • in the Entity Info window, associate the selection with the new layer
  • Try zoom-extents now that all the texts are hidden. If things now behave properly, there is a singular text somewhere in your model.