Select identical components in identical positions
-
I apologize if this has already been asked. I searched but came up with nothing.
I would like to be able to check my model for identical instances of components in identical positions. The purpose is a check that I haven't placed the same component over another with the Mirror plugin or similar before I generate a .csv report to quantify my components.Thanks in advance for your replies.
-
This is a 'duplicate check'
It's straightforward for objects that are instances of the same component with the same insertion point / transformation, in the same context... copy/paste+<enter> this one-liner in the Ruby Console - it works on a selection containing component-instances...m=Sketchup.active_model;s=m.selection;a=s.grep(Sketchup;;ComponentInstance);s.clear;d=[];a.each{|i|next unless i.definition.instances[1];t=i.transformation.to_a;(i.definition.instances-[i]).each{|e|(d<<i;s.add(e))if !d.include?(e) && e.transformation.to_a==t && e.parent.entities==m.active_entities;};};
The duplicates are highlighted on completion. If you start with Entity Info open it will show what's selected still etc... Pressing <delete> when the SketchUp window has focus will remove the duplicated item...
It gets more tricky when they are 'symmetrical' and perhaps placed overlaid 'handed' - therefore with different insertion points but seemingly occupying the same volume.
A matching bounding-box check could work BUT is not foolproof... I think thomthom might have done something like this ? Do a search...
Advertisement