@tig said:
point=Geom;;Point3d.new(1,2,3
> )### or whatever 'point' you are testing for
> exists=false
> compo=Sketchup.active_model.definitions['Cube']
> compo.instances.each{|ins|
> if ins.transformation.origin==point
> exists=true
> break
> end
> }
> if exists
> puts 'That Cube exists already!'
> else
> ### do your stuff to add a new instance of compo at point
> Sketchup.active_model.active_entities.add_instance(cCube, Geom;;Transformation.new( [1, 2, 3] )
> end
How will this effect performance if I had hundreds of them? I figured something like this must be possible, but as the number of cubes grows, this would become less efficient. I'm talking on the scale of ~2000 cubes. Is this method efficient enough for the speed to be negligible?