144 MB model went blank - can't find model, axes, or horizon

Hi all! Based on some cursory googling I seem to have run into a fairly common problem but haven’t had any luck with the solutions so far, so I figured I’d check here to see if there’s anything I’m missing. I was working on a pretty heavy model with a fair bit of detail (making a store with fully populated shelves might not have been the kindest choice for my 7-year-old laptop) and it suddenly went blank after a fair bit of huffing and puffing from my computer fans. It was the same upon reopening - based on the style I was using it seems to be perpetually looking at the ground, with no change when I try orbiting, panning, and zooming in or out. It’s tough to figure out exactly where in space I am though, as the axes and horizon are nowhere to be found, let alone the model itself.

I’ve run through a lot of the suggested fixes, I’ve reduced the file size by purging unused elements (that got it down to 138 MB), I’ve turned off fast feedback, and I’ve tried to search for my AWOL model by using zoom extents, changing the style to wireframe, etc. I think the only thing left to address at this point is my graphics card. It’s an Intel HD Graphics 4000 1536 MB according to About This Mac, but I’m not sure how if at all to make changes to it.

I can also upload my model to the 3D Warehouse if y’all need to take a closer look at it.

57%20AM

It would definitely help to be able to see the SKP file. Either upload to 3D Warehouse if it’ll go or to Drop Box and share the link.

Sounds good! It was too big for the warehouse, so let’s try Dropbox instead.

This one’s the copy that I was messing with, so the filesize here is 138 MB while the original is still at 144 MB.

Does this look like what you are expecting?
Screenshot%20-%202_26_2019%20%2C%2011_51_38%20AM

Screenshot%20-%202_26_2019%20%2C%2011_56_28%20AM

I copied all of the components and groups from your model into a fresh one. You can do the same by selecting the compnents and groups in Outliner, copying them (Command+C) and then switching to the new file and hit Edit>Paste in place. I did it in chunks to reduce the chance of creating problems due to too much stuff on the clipboard.

Of course anything that isn’t a group or component won’t get picked up.

Did you have any labels in the file?

Out of curiosity, what is this for?

Copy and Paste this Ruby code into the Ruby Console and your model will be magically restored.
RescueMyModel v12.rb (4.2 KB)

# Rescue My Model version 12 - 2/2/2019
# A short bit of code to recover, in situ, models that
# have become unviewable after a Zoom Extents Operation
# due to bugs in the Sketchup core logic.
# 
# Usage: copy and paste the text into Sketchup's Ruby Console and press the Enter key.
# Undo: use the standard Sketchup Edit>Undo menu command
#
# The known causes of this problem are:
#   Text with an X, Y, or Z location of nan
#   Edge vertices, Groups, or Components located a very long distance from the origin.
#   Camera lost in space
#  
# The code repairs these problems by deleting faulty Edges, and relocating faulty Groups
# and Components to the origin [0,0,0] of their parent container.
#
# The code also executes several View.zoom() operations which cause Sketchup to reorient the 
# clipping plane and other unknowable variables. After completion the model will be functional.

module SW
module RescueMyModel
  MaximumXYZ = 63360000 # Limit points to One Thousand Miles from the container origin
    
  def self.start_recovery()
    puts 'Starting to rescue your invisible model'
    number_of_problems = scan_model()

    if number_of_problems == 0 
      puts "\nNo Problems Found"
    else
      puts "\nFound #{number_of_problems} problems"
    end
    
    puts 'Starting the Camera Reset Procedure'
    Sketchup.active_model.active_view.camera.set([0,0,0],[1,1,1],[0,0,1])

    #set up a deferred operation for the final zoom operations
    id = UI.start_timer(0.0, false) {deferred_camera_zooms()}
    puts 'Passing Control to the Deferred Operations'
    #end
  end  

  def self.deferred_camera_zooms()
    model = Sketchup.active_model
    view = model.active_view
    
    #these simple zoom operations could take quite sometime in a large model
    puts 'Executing Deferred Operation 1'
    view.zoom(model.active_entities[0])

    puts 'Executing Deferred Operation 2'
    begin
      view.zoom(model.active_entities[1])
    rescue # if there is no second entity 
    end
    
    puts 'Executing Deferred Operation Zoom All'
    view.zoom_extents
    id = UI.start_timer(0.0, false) {print_completed_message()}
  end
  
  #This block will be called AFTER the final zoom_extents has completed
  def self.print_completed_message()
      puts "\nRescue My Model.\nYour model should be visible.\nPlease save this file with a new filename"
  end
  
  #Scan the Model's entities and return the count of problem entities that have been modified
  def self.scan_model()
    @number_of_problems = 0 
    @entities_to_delete = []
    search_entities(Sketchup.active_model.entities)
    @entities_to_delete.each(&:erase!) #this can leave a container with zero entities
    return @number_of_problems
  end
  
  def self.search_entities(ents)
    ents.each do |e|
      if e.is_a?(Sketchup::Edge)
        if e.vertices.find{|p| p.position.to_a.any?{|n| n.abs>MaximumXYZ}}
          print "\nDeleting #{e}"
          @entities_to_delete << e
          @number_of_problems += 1
        end 

      elsif e.is_a?(Sketchup::Text)
        if e.point.to_a.any?(&:nan?)
          print "\nMoving #{e} to the Container Origin" 
          e.point = ORIGIN
          @number_of_problems += 1
        end  
    
      elsif e.is_a?(Sketchup::ComponentInstance)
        print '.'
        check_transformation(e)
        search_entities(e.definition.entities)

      elsif e.is_a?(Sketchup::Group)
        print '.'
        check_transformation(e)
        search_entities(e.entities)
      end

    end
  end
  
  # Check a container's transformation for valid translation values. Then move the 
  # container to [0,0,0] of the parent container if there is a problem
  # TODO: check for insane scaling of container contents.
  #        
  def self.check_transformation(e)
    if e.transformation.to_a[12..14].any?{|n| n.abs>MaximumXYZ}
      print "\nMoving #{e} to the Container Origin"
      tra = e.transformation.to_a
      #puts tra
      tra[12] = 0.0; tra[13] = 0.0; tra[14] = 0.0
      e.transformation= Geom::Transformation.new(tra)
      @number_of_problems += 1
    end
  end
  
  #
  #Entry Point
  #
  start_recovery()
  nil # return nil to the Ruby console
end
end

Cool, it looks like all the stuff that was inside the building got copied over, I think just the walls and the building exterior are missing (which might have been due to the aforementioned purge, will have to compare to the original). I’ll give it a whirl and see if I can replicate this, thanks!

To answer your question, I’m building it as reference for some comics I’m drawing. This is a main setting that I’ll be drawing pretty frequently from a lot of different angles, so the 3D model is mainly to keep things consistent and keep track of what all will be visible from different lines of sight.

You should run sWilliams’s code in the Ruby Console. It’ll bring up even your ungrouped geometry.

Ah… I see. Is this just a hobby?

Thanks a million! The code did the trick, everything’s back.

And yep! Purely for fun. I wouldn’t be using other people’s models from the warehouse if it was something I intended to monetize in any way. That said, it’s been several days of work to put this together and it would have been disappointing to lose it, so I really appreciate the help!

1 Like

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