Some Python codes for build Region in Abaqus are really difficult to figure out although Abaqus has a lot of examples and detailed manual and reference. Here is an example for creating discrete material orientation using Python script.
Python for Abaqus: code for discrete material orientation assignment
1