Model disappears when I click Zoom Extents

The ideal place for beginners to get help using SketchUp

Model disappears when I click Zoom Extents

Postby PhoebeAnn » Mon Sep 09, 2019 3:36 am

I've had this problem in the past when I had too many Dimension items, but this one has none. If anyone can tell me how to locate the reason for the failure, I'd appreciate it.
Sheet4c.skp
0

PhoebeAnn 
 

Re: Model disappears when I click Zoom Extents

Postby TIG » Mon Sep 09, 2019 12:05 pm

This is usually caused by something many miles from the origin causing the model's extents to become unexpectedly large.
A bug in newer SketchUp versions is known, relating to text associated with geometry...
When the geometry is deleted its associated text can whizz off into outer-space...

You can copy+paste this code into the Ruby Console +<enter>
It moves any such wayward Text entities back to the origin...
Code: Select all
model = Sketchup.active_model
model.start_operation("TextCheck", false)
ss = model.selection
txts = []
ctr = 0
puts "\nChecking Text in Model...\n\n"
model.entities.grep(Sketchup::Text).each{|t|
  if t.point.to_a.any?(&:nan?)
    ctr+=1
    puts "#{ctr}: \"#{t.text}\" on Layer \"#{t.layer.name}\" @ #{t.point.to_a} - relocated at [0, 0, 0]"
    t.point=ORIGIN
    t.bounds.clear
    t.layer.visible = true
    t.hidden = false
    txts << t
  end
}
dtxs = []
ctr = 0
puts "\nChecking Text inside Definitions...\n\n"
model.definitions.each{|d|
  d.entities.grep(Sketchup::Text).each{|t|
    if t.point.to_a.any?(&:nan?)
      ctr+=1
      puts "#{ctr}: Defn \"d.name\" : Text = \"#{t.text}\" on Layer \"#{t.layer.name}\" @ #{t.point.to_a} - relocated at [0, 0, 0]"
      t.point=ORIGIN
      t.bounds.clear
      t.layer.visible = true
      t.hidden = false
      dtxs << t
    end
  }
  d.invalidate_bounds
}
view = model.active_view
if txts[0]
  model.bounds.clear
  bb = Geom::BoundingBox.new
  bb.add(ORIGIN)
  model.bounds.add(bb)
  view.refresh
  puts "\nTrying to force Model 'Zoom Extents' - please wait, it might take several seconds..."
  puts "\nThe relocated Model Text will now be Selected - after it completes press Delete if desired..."
  puts "\nAny problem Text relocated inside Definitions must be manually edited..." if dtxs[0]
  ss.clear
  ss.add(txts)
  3.times{
    view.zoom_extents
    view.refresh
  }
  model.commit_operation
  view.refresh
  puts "\nDone."
elsif dtxs[0]
  puts "\nAny problem Text relocated inside Definitions must be manually edited..."
  puts "\nDone."
  view.refresh
  model.commit_operation
else
  puts "\nNo Text problems found..."
  model.abort_operation
end
puts


I ran it on your SKP and it's a single Text entity saying, "6 3/4 x 18 24 FV4 GlueLam (B3) above", that is flaky and so far from the origin it's NaN away !

I haven't attached the fixed SKP, because you can do the simple fix yourself in under a second...

Also note that your model needs 'fixing' because it has duplicate persistent IDs for several groups [use Model Info > Statistics > Fix...]

And it'd also be easier to navigate in your model if the Axes were switched on and you used a Perspective Camera...
2
TIG
User avatar
TIG 
Global Moderator
 

Re: Model disappears when I click Zoom Extents

Postby PhoebeAnn » Mon Sep 09, 2019 2:47 pm

Thanks. I didn't know I had a Ruby console (using Make 2017), but I'll look. Didn't use perspective camera because I'm working in 2D/parallel all the time. Very likely duplicate IDs - I have never been able to find, use, or delete a group after creating one. You may infer I'm a rank beginner...
0

PhoebeAnn 
 

Re: Model disappears when I click Zoom Extents

Postby PhoebeAnn » Mon Sep 09, 2019 5:40 pm

Excellent. Thanks again, and thanks for making me do it myself.
0

PhoebeAnn 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Newbie Forum

Who is online

Users browsing this forum: No registered users and 5 guests

Visit our sponsors: