Save_copy unable to generate the latest preview!

Sketchup.active_model.start_operation 'test', false
ele_range = [0, 4.m]
save_ents = Sketchup.active_model.entities.to_a.select { |ent|
  next unless ent&.valid?
  next unless ent.respond_to?(:bounds)
  ent.bounds.center.z >= ele_range[0] && ent.bounds.center.z < ele_range[1]
}
return if save_ents.empty?
(Sketchup.active_model.entities.to_a - save_ents).each { |ent|
  next unless ent&.valid?
  ent.erase!
}
Sketchup.active_model.active_view.zoom(save_ents)
Sketchup.active_model.commit_operation
path = Sketchup.active_model.path
Sketchup.active_model.save_copy(File.join(File.dirname(path), "test2.skp"), Sketchup::Model::VERSION_2020)
Sketchup.undo

test.skp (1.3 MB)

result

image
image

This a known issue. Thomas is on the job, so look for a solution in a future release.

2 Likes