@bjornburgh said:
def remove_instances_duplicates defs=Sketchup.active_model.definitions to_delete=[] defs.each do |compo_def| next if compo_def.internal? instances=compo_def.instances instances2=instances instances2.each do |i2| keeping_instance=instances.shift instances.each do |instance| if instance != keeping_instance and instance.transformation.to_a == keeping_instance.transformation.to_a and instance.definition.insertion_point.transform(instance.transformation)==keeping_instance.definition.insertion_point.transform(keeping_instance.transformation) to_delete.push(instance) puts "Erasing duplicate instance of " + instance.definition.name end end end end to_delete.each { |inst| inst.erase! } endPasting the Script in the Ruby console doesn't work. Is there another way?
There was an extra "end" in the code. Removing that should fix the problem.
After pasting into the Ruby Console, press Enter then type in "remove_instances_duplicates" to execute.