Thanks. Checking out the syntax and examples in developer/docs, I think I have a version working, in that there are no superimposed items. The code’s below. Is this a typical way to make and use multiply instantiated items?
# Create a component definition first, using DefinitionList's entities. Then draw for real into active's entities.
# First we pull in the standard API hooks.
require 'sketchup.rb'
n = 3
s = 100
w = 20
model=Sketchup.active_model
entities = model.entities
definitions=model.definitions
compdefinition=definitions.add "Block"
group = compdefinition.entities.add_group
face = group.entities.add_face [0,0,0],[w,0,0],[w,w,0],[0,w,0]
face.pushpull -w
component = group.to_component
(0..n).each { |i|
(0..n).each { |j|
(0..n).each { |k|
transformation = Geom::Transformation.new([i*s,j*s,k*s])
componentinstance = entities.add_instance(component.definition, transformation)
}
}
}