Trying to finalize details on these elevations & each time I make a small edit (move or redraw a line of trim) and try to save, the changes I’ve made a deleted under an automatic “check validity” feature? I’ve never had this come up before and am stumped. Help please! PS: yes, things are ungrouped, because grouping has somehow seemed to make things worse?
I didn’t get anything to fix in the model you attached. If you check validity and those invalid ID items are deleted, do you notice what was removed from the model?
I get the message when I go to the “fireplace elevation” scene, select the elevation and try to copy. Even after “check validity.” Are you able to replicate the same message?
For some reason there are 68,150 Screen Text entities in the model. These can be selected, and then deleted, via the the Model Info panel. Dunno if this is the source of your problem.
I used AI Assistant in SketchUp to make a couple of Ruby scripts. Here is one that counts how many text objects there are:
module SU_CountText
def self.count_texts_in_entities(entities)
count = 0
entities.each do |e|
count += 1 if e.is_a?(Sketchup::Text)
if e.is_a?(Sketchup::Group)
count += count_texts_in_entities(e.entities)
elsif e.is_a?(Sketchup::ComponentInstance)
count += count_texts_in_entities(e.definition.entities)
end
end
count
end
def self.run
model = Sketchup.active_model
total = count_texts_in_entities(model.entities)
puts "Total Text objects in model: #{total}"
total
end
end
SU_CountText.run
Here is another one that checks all of the text objects, and deletes them if they have an invalid point, or are more than 100 meters from the Origin:
module SU_DeleteFarText
LIMIT = 100.m
def self.process_entities(entities, origin_world = Geom::Point3d.new(0, 0, 0), tform = Geom::Transformation.new)
deleted = 0
checked = 0
entities.to_a.each do |e|
if e.is_a?(Sketchup::Text)
checked += 1
pt = e.point
if !pt.is_a?(Geom::Point3d)
e.erase!
deleted += 1
next
end
p_world = pt.transform(tform)
if p_world.distance(origin_world) > LIMIT
e.erase!
deleted += 1
end
elsif e.is_a?(Sketchup::Group)
d, c = process_entities(e.entities, origin_world, tform * e.transformation)
deleted += d
checked += c
elsif e.is_a?(Sketchup::ComponentInstance)
d, c = process_entities(e.definition.entities, origin_world, tform * e.transformation)
deleted += d
checked += c
end
end
[deleted, checked]
end
def self.run
model = Sketchup.active_model
model.start_operation("Delete far/no-point Text", true)
deleted, checked = process_entities(model.entities)
model.commit_operation
puts "Checked Text objects: #{checked}"
puts "Deleted Text objects (no point or > 100m from origin): #{deleted}"
[deleted, checked]
rescue => e
model.abort_operation if model
raise e
end
end
SU_DeleteFarText.run
You can copy and paste those into the Ruby Console, and press Enter. The first one shows your model to have the 68190 text objects sWilliams mentioned. The second script reduces that to 40.
Turns out all the bad ones are in the model root context.
My edition goes directly to the DefinitionList and adds in an undo operation.
I didn’t mess with transformations however.
module TextHelper
extend self
def count_text_objects
model = Sketchup.active_model
# Number at model root:
total = model.entities.grep(Sketchup::Text).count
puts "Total at model root: #{total}"
# Number in Definitions:
nested = 0
model.definitions.each do |compdef|
count = compdef.entities.grep(Sketchup::Text).count
nested += (count * compdef.instances.size)
end
puts "Total nested: #{nested}"
grandtotal = total + nested
puts "Grand Total: #{grandtotal}"
return grandtotal
end
def purge_screen_text
model = Sketchup.active_model
root_text = model.entities.grep(Sketchup::Text).select { |text|
!text.point.is_a?(Geom::Point3d)
}
total = root_text.size
puts "Total at model root: #{total}"
if root_text.size > 0
model.start_operation("Purge Screen Text", true)
# Erase from model root:
puts " Erasing #{total} ..."
model.entities.erase_entities(*root_text)
model.commit_operation
end
nested_text = []
# Find in all Definitions:
model.definitions.each do |compdef|
found = compdef.entities.grep(Sketchup::Text).select { |text|
!text.point.is_a?(Geom::Point3d)
}
nested_text.push(*found) if found.size > 0
end
nested = nested_text.size
if nested > 0
transparent = ( total > 0 )
model.start_operation("Purge Screen Text", true, false, transparent)
# Erase the nested text objects:
puts " Erasing #{nested} ..."
nested_text.each(&:erase!)
model.commit_operation
end
puts "Total nested: #{nested}"
grandtotal = total + nested
puts "Grand Total: #{grandtotal}"
return grandtotal
end
end