As with dictionaries, you can refer to an object in a repository using its key. The key is typically the name you provided in the constructor command when the object was created. For example, the Viewport constructor creates a new Viewport object in the viewports repository. session.Viewport(name='Side view', origin = (10,10), width=50, height=50) The key to this new Viewport object in the viewports repository is Side view. You use this key to access this particular Viewport object. For example, session.viewports['Side view'].viewportAnnotationOptions.\ setValues(legend=OFF, title=OFF) You can make your scripts more readable by assigning a variable to an object in a repository. For example, you could rewrite the previous statement after assigning the Viewport object to the variable myViewport: myViewport = session.viewports['Side view'] myViewport.viewportAnnotationOptions.setValues( legend=OFF, title=OFF) In general, if the user can create the object, its repository key is a string. In some cases Abaqus/CAE creates an object, and the key can be a string, an integer, or a SymbolicConstant. As with dictionaries, you can use the keys() method to access the repository keys. >>> session.Viewport(name='Side view') >>> session.Viewport(name='Top view') >>> session.Viewport(name='Front view') >>> for key in session.viewports.keys(): ... print key Front view Top view Side view You can use the keys()[ i] method to access an individual key; however, most repositories are not ordered, and this is not recommended. You can use the changeKey() method to change the name of a key in a repository. For example, myPart = mdb.models['Model-1'].Part(name='housing', dimensionality=THREE_D, type=DEFORMABLE_BODY) mdb.models['Model-1'].parts.changeKey(fromName='housing', toName='form') |