You only need to create one component definition. You can apply different materials to each component instance. When you apply materials to component instances and groups the faces inside with default material will inherit the group/instance's material.

That's what makes components so great. You can model a car - do all the detailing, add material to the wheels windows etc, but leave the body with default material. So you can then place lots of instance with different materials.

something like:

` model.start_operation('Voxel Thingymajiggy', true) # wrap everything in one operation and disable the UI

voxel_def = model.definitions.add("Voxel") # create new definition
voxel_def.entities.add_face(...) # build the voxel here

<loop> read file calculate a transformation to place the instance

voxel = model.entities.add_instance(voxel_def, transformation)
voxel.material = myPrettyMaterial

</loop>

model.commit_operation`

Very quick and dirty pseudo-code... 😳