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.
Assuming the part name is
partName and all sets, top surface and one edge, are created beforehand, this discrete material orientation is determined by the normal direction of the top surface and the tangent direction of the edge. Here comes the code:
model = mdb.models[modelName] part = model.parts[partName] region = (part.cells, ) normalAxisRegion = part.surfaces['Surf-top'] primaryAxisRegion = p.sets['Set-edge'] p.MaterialOrientation(region=region, orientationType=DISCRETE, axis=AXIS_1, normalAxisDefinition=SURFACE, normalAxisRegion=normalAxisRegion, flipNormalDirection=False, normalAxisDirection=AXIS_3, primaryAxisDefinition=EDGE, primaryAxisRegion=primaryAxisRegion, primaryAxisDirection=AXIS_1, flipPrimaryDirection=False, additionalRotationType=ROTATION_NONE, angle=0.0, additionalRotationField='', stackDirection=STACK_3)
Of course, the sets of the part should be set automatically while generating the part, otherwise there should be no need to set the material orientation by script.
And if the part has been set a cell
Set-cell for the whole entity, the expression for the
region can also have the form of following code,
region = part.sets['Set-cell']
If you know any other code for setting the
region, please share it with us in the following comments area 🙂©