My .NET plugin builds block definitions containing entities imported from external dwg files and places references to them in the current drawing. Quite often, more than a reference to the same block definition is placed. Each reference represents the same object, but with different material choices for the components (3D solids) that constitute the object.
Is it possible to vary the rendered materials of different references to the same block definition? I'm new to AutoCad, so I really don't know if it is possible to achieve this behavior.
Sure. The blockReference is an object container for a BlockTableRecord. The BlockTableRecord can contain many different entities, and therefore can have multiple rendered materials on each
For the block reference to show the assigned material, ensure that the entity in the block table record has its material set to "ByBlock". I have attached a sample drawing that assigns different materials to the block references all created from the same block.
If the Block Table Record has been created that way, setting the material for the block reference using code is simply assigning a material id.